note 58157 added to function.session-start

From: Date: Tue, 25 Oct 2005 22:40:51 +0000
Subject: note 58157 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-97602@lists.php.net to get a copy of this message
I've not yet found out how to do the following: When a suitable session for the user exists, then it shall be loaded. If no session exists, then *no session shall be created*. session_start() will create a new session if none exists, so the only solution is to call this function conditionally. But how to check whether a suitable session exists on the server? I could check for the presence of a cookie with the SID, but that doesn't imply that the session really exists on the server. session_id() doesn't return anything useful as long as session_start() hasn't been called, so it's of no use. Anyone got a clue? Of course, I can find other alternatives for my real life code; they are a little bit suboptimal, but still more than acceptable. I'm asking this out of curiosity, because I want to know if there's a clean way to do it. ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58157 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58157&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58157&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58157&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58157&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58157&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58157&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58157&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58157&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97602) next »