Jump to content

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??
Link to comment
https://forums.phpfreaks.com/topic/12715-cookie-wont-die/
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...
Link to comment
https://forums.phpfreaks.com/topic/12715-cookie-wont-die/#findComment-48859
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.