Re: Trying to understand sessions and using them to authenticate...

From: Date: Wed, 29 Aug 2007 12:25:32 +0000
Subject: Re: Trying to understand sessions and using them to authenticate...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-261452@lists.php.net to get a copy of this message
Ford, Mike wrote:
On 28 August 2007 15:56, Stut wrote:
Jason Pruim wrote:
One other question, to logout, can I just call a file that has session_destroy() and a header("Location: ???"); in it? Or should I do something else for logging out?
foreach (array_keys($_SESSION) as $key)
     unset($_SESSION[$key];
session_destroy();
$_SESSION = array(); session_destroy(); session_commit(); setcookie(session_name(), "", ini_get('session.cookie_lifetime'), ini_get('session.cookie_path'), ini_get('session.cookie_domain'));
$_SESSION = array(); will usually suffice. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support

« previous php.general (#261452) next »