Jump to content


Photo

cookie won't die


  • Please log in to reply
2 replies to this topic

#1 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 23 June 2006 - 09:28 AM

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

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

setcookie ("cowcookie", '', time() - 604800);
unset($_COOKIE);
unset($HTTP_COOKIE_VARS);
?>
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??
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 23 June 2006 - 11:58 AM

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.
Legend has it that reading the manual never killed anyone.
My site

#3 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 23 June 2006 - 05:24 PM

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...
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users