Code: Select all
// start session
session_start();
// unset all of the session variables.
$_SESSION = array();
// if a (client side) cookie is set, expire it (as of 1 hr ago)
if (isset($_COOKIEїsession_name()])){
setcookie(session_name(), '$_COOKIEї'cookiename']' , time()-3600, '/');}
// destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie.
session_destroy();The session starts when step 1 posts to step 2 and the session continues through steps 3 and 4.
Upon completion the user is returned to a page where the above code is run.
I create sessions using session_start().
The problem is that the session id either persists (i.e. the script has failed to expire/delete the cookie) or the session_id is re-instated for the same browser window for a new session.
The goal is to use a single browser window, to effectively 'logout' of a session, and create a new session_id after each transaction.
Any assistance greatly appreciated.
- Andrew