note 28385 added to function.session-destroy

From: Date: Sat, 11 Jan 2003 04:44:50 +0000
Subject: note 28385 added to function.session-destroy
Groups: php.notes 
Request: Send a blank email to php-notes+get-41990@lists.php.net to get a copy of this message
Howto start new session with the old sessions-variables? (Or: Yet another reason why you should use $_SESSION) Just read this: ... //First, destroy old session, but save session-vars! $temp_session=$_SESSION; $_SESSION= array(); unset($_GET[session_name()]); session_destroy(); //Now start new session and thake old-session-vars over to new session. session_start(); $_SESSION=$temp_session; //But remember: New session needs new timestamp! $_SESSION["timestamp"] = time(); ... In words: Save session vars, destroy session, start new session, thake old session vars over to new session. Tricky, eh? Cu, Dave -- http://www.php.net/manual/en/function.session-destroy.php http://master.php.net/manage/user-notes.php?action=edit+28385 http://master.php.net/manage/user-notes.php?action=delete+28385 http://master.php.net/manage/user-notes.php?action=reject+28385

« previous php.notes (#41990) next »