note 17236 added to function.session-destroy

From: Date: Fri, 30 Nov 2001 19:57:52 +0000
Subject: note 17236 added to function.session-destroy
Groups: php.notes 
Request: Send a blank email to php-notes+get-21490@lists.php.net to get a copy of this message
The above example requires you (at least in Win2k) to give read/write permission to your sessions directory: unlink(session_save_path().'/sess_'.$PHPSESSID); setcookie('PHPSESSID','',time()-3600,'/'); You can achieve the same without setting the permissions using: session_destroy(); setcookie('PHPSESSID','',time()-3600,'/'); There is no need to unset all your variables either (as some above posts suggested) unless you want to make sure they disappear immediatly; instead of at the end of the page scope. You can also achieve the same by simply adding to the above: if (isset($name_of_any_previous_session)&&endless!="1") { header("Location: ".$PHP_SELF."?endless=1"); //endless is just protection against an endless loop in the case the session just won't die } -- http://www.php.net/manual/en/function.session-destroy.php http://master.php.net/manage/user-notes.php?action=edit+17236 http://master.php.net/manage/user-notes.php?action=delete+17236 http://master.php.net/manage/user-notes.php?action=reject+17236

« previous php.notes (#21490) next »