note 30350 added to function.session-destroy

From: Date: Fri, 14 Mar 2003 20:44:25 +0000
Subject: note 30350 added to function.session-destroy
Groups: php.notes 
Request: Send a blank email to php-notes+get-45322@lists.php.net to get a copy of this message
I'm afraid that what Dave wrote doesn't work always, in my case it doesnt. I simply couldnt assign directly a value to $_SESSION table. So this is what I did, and it worked... /* prepare temporary table */ $session_temp = array(); session_start(); $former_session_id = session_id(); /* save session variables */ if (count($_SESSION)>0) { while (list($name, $value) = each($_SESSION)) { $session_temp[$name] = $value; } } unset($_COOKIE); // kill the cookie session_destroy(); // kill the session /* in my case this type of caching works the best */ session_cache_limiter('none'); session_id($former_session_id); session_start(); /* restore session variables */ while (list($name, $value) = each($session_temp)) { session_register($name); } This works always... CU Fabian -- http://www.php.net/manual/en/function.session-destroy.php http://master.php.net/manage/user-notes.php?action=edit+30350 http://master.php.net/manage/user-notes.php?action=delete+30350 http://master.php.net/manage/user-notes.php?action=reject+30350

« previous php.notes (#45322) next »