note 52689 modified in function.session-id by danbrown

From: Date: Tue, 11 Nov 2008 16:16:24 +0000
Subject: note 52689 modified in function.session-id by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146390@lists.php.net to get a copy of this message
Note that Firefox and Mozilla use the same process for launching new windows or tabs, they will pick up the same session id as the previous windows until the parent process dies or is closed. This may cause undesired results if the session id is stored in a db and checked, a solution is to check at the new entry point (new tab or window if the user went back to the index page) for an existing session. If a session id exists and a new one is required use something like: <?php $ses_id = session_id(); $bsid_exists = false; $bsid_exists = check_session_id_from_db($ses_id); if ($bsid_exists){ //This is a reentry and the session already exists // create a new session ID and start a new session_regenerate_id(); $ses_id = session_id(); } ?> --was-- Note that Firefox and Mozilla use the same process for launching new windows or tabs, they will pick up the same session id as the previous windows until the parent process dies or is closed. This may cause undesired results if the session id is stored in a db and checked, a solution is to check at the new entry point (new tab or window if the user went back to the index page) for an existing session. If a session id exists and a new one is required use something like: $ses_id = session_id(); $bsid_exists = false; $bsid_exists = check_session_id_from_db($ses_id); if ($bsid_exists){ //This is a reentry and the session already exists // create a new session ID and start a new session_regenerate_id(); $ses_id = session_id(); } http://php.net/manual/en/function.session-id.php

« previous php.notes (#146390) next »