Jump to content

Archived

This topic is now archived and is closed to further replies.

.josh

cookie won't die

Recommended Posts

here is my code that sets the cookie:
[code]
setcookie("cowcookie", $_SESSION['Account_Info']['Account_Name'] . " : " . $User_Pw . " : " . time(), time()+12096000);
[/code]

and here is my code that is supposed to kill it:
[code]
<?
session_start();
// kill session variables
unset($_SESSION['Account_Info']);
$_SESSION = array();
session_destroy();

setcookie ("cowcookie", '', time() - 604800);
unset($_COOKIE);
unset($HTTP_COOKIE_VARS);
?>
[/code]
it's way past my bedtime i can't see straight. why won't it die? my main page checks to see if the cookie exists. if it does, it redirects me to the logged in page. if it doesn't, it shows the main page.

this script is my logout script. the user clicks the logout button and he's supposed to be completely logged out forever. but if i try to put a header to my main page after the unset, it still redirects me to the logged in page.

I'm pretty sure my cookie is not dying here, cuz if i go and manually kill all of my cookies through my browser, the cookie detection/redirection script works fine. so what's going on here??

Share this post


Link to post
Share on other sites
Are set_cookie and kill_cookie both happening at the same level in the same folder? I had several immortal cookies in a script of mine before I got the path_to_cookie embedded in the script ... if you know what I mean.

Share this post


Link to post
Share on other sites
ah crap. yeh i think that's probably it. will check

edit: yep, that was it. dunno why i didn't think of that.

i have a question though:

if the path_to_cookie is supposed to specify the scope of the cookie, why must I specify it in deleting cookies? i don't see how that should matter? the manual doesn't go into any of that...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.