note 54084 added to function.session-id
| From: | jpjounier at hotmail dot com | Date: | Thu, 23 Jun 2005 11:28:55 +0000 |
| Subject: | note 54084 added to function.session-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90831@lists.php.net to get a copy of this message | ||
About the note from Cybertinus :
The following test doesn't work, the code following is always executed :
if(!session_id())
{
// Always executed even if there's already an opened session
}
session_id() returns an empty string if there is no current session, so to test if a session already
exists, it's better to write this :
if(session_id() == "")
{
start_session();
}
else
{
// Anything you want
}
----
Manual Page -- http://www.php.net/manual/en/function.session-id.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54084
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54084&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54084&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54084&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54084&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54084&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54084&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54084&report=yes
Search -- http://master.php.net/manage/user-notes.php