...

View Full Version : delete session and cookie



urgido
11-04-2006, 05:51 AM
I have the following code:


if($_GET['logout'] == "true") {
session_start();
unset($_SESSION['the_ID']);
session_unset();
session_destroy();
unset($_COOKIE['domainp']);
}

But, when I execute the code don't kill the session and don't remove the cookie... Why? Regards

littlejones
11-04-2006, 10:21 AM
Have you tried IF(isset($_GET['logout']))? Just in case you haven't actually set 'logout' to equal the string 'true', but only you would know that.

Not much help sorry :confused:

urgido
11-04-2006, 10:24 AM
uh? you confuse me more.

ess
11-04-2006, 11:43 AM
Yeah...I have seen this problem before. try adding the following to what you have already written.


// to ensure that all session variables have been deleted
// add the following line.
$_SESSION = array();

// to delete the cookie...just set time to past today's date.
setcookie(session_name(), '', time()-42000, '/');

Good luck.
:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum