Bug #17598 Updated: no way to detect a session without creating a session
| From: | postings dot dynweb at hans-spath dot de | Date: | Wed, 05 Jun 2002 13:00:03 +0000 |
| Subject: | Bug #17598 Updated: no way to detect a session without creating a session | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9543@lists.php.net to get a copy of this message | ||
ID: 17598
Updated by: postings.dynweb@hans-spath.de
Reported By: adam@adeptsoftware.com
Status: Open
Bug Type: Session related
Operating System: WinXP
PHP Version: 4.2.1
New Comment:
// just a untested quick-hack
// if it doesn't work, I hope you get the idea
function session_exists( $name=NULL )
{
if( $name === NULL )
$name = ini_get('session.name');
if( ini_get(session.use_cookies) == 1 )
return isset($_COOKIE[$name]);
else
return isset($_GET[$name]);
}
Previous Comments:
------------------------------------------------------------------------
[2002-06-04 12:40:49] adam@adeptsoftware.com
There is no way to detect if a session exists, without creating a
session. This can trigger warnings like this in cookie detectors:
This page wishes to set the cookie
PHPSESSID="bd977b12c9da97f1ba0b07e4fe25a176"
A page needs to generate differently based on whether a user is "logged
in" (a session exists) or just a "visitor".
You shouldn't have to create a session to know if it exists. I suppose
you could manually check cookies & the URL etc but shouldn't there be a
function for this?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17598&edit=1