This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2004 > Re: PHP Session end problems





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: PHP Session end problems
N Rohler

2004-08-04, 7:15 pm

Just a tip...when removing cookies, use time()-86400 or more, so that if the
user is in a different time zone than the server the cookie will still be
removed.

Here's a script from php.net that should remove the session cookies. You also
need to use session_destroy after session_unset.

session_start();

$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']);
}
unset($_COOKIE[session_name()]);
session_unset();
session_destroy();

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews