note 89224 deleted from function.session-get-cookie-params by thiago
| From: | thiago@php.net | Date: | Fri, 27 Feb 2009 16:15:56 +0000 |
| Subject: | note 89224 deleted from function.session-get-cookie-params by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151214@lists.php.net to get a copy of this message | ||
Note Submitter: marty at savvysketch dot com
----
$CookieInfo = session_get_cookie_params();
if ( (empty($CookieInfo['domain'])) &&
(empty($CookieInfo['secure'])) ) {
setcookie(session_name(), '', time()-3600, $CookieInfo['path']);
} elseif (empty($CookieInfo['secure'])) {
setcookie(session_name(), '', time()-3600, $CookieInfo['path'],
$CookieInfo['domain']);
} else {
setcookie(session_name(), '', time()-3600, $CookieInfo['path'],
$CookieInfo['domain'], $CookieInfo['secure']);
}
session_destroy();
In the above the setcookie() function needs to be called before the session_start() or the cookie
will not be deleted.