RE: [PHP] Trying to understand sessions and using them to authenticate...
| From: | Ford, Mike | Date: | Wed, 29 Aug 2007 10:55:47 +0000 |
| Subject: | RE: [PHP] Trying to understand sessions and using them to authenticate... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-261446@lists.php.net to get a copy of this message | ||
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'));
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730 Fax: +44 113 812 3211
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm