Page 1 of 1

DELETE COOKIE!!! You hear me?!!!!

Posted: Sun Dec 12, 2004 12:32 am
by Steveo31
Oh man, this is really irkin me the wrong way.

No matter how many combos of setcookie, I can't get one to delete.

Code: Select all

setcookie("log", $cookies['username']."-".$cookies['email'], time()+2278326, '/'); //+ about 1 month
And to, what I thought was deletion...

Code: Select all

setcookie('log', FALSE, time(), '/');
But noooooooooooo, that's too easy.

Still there. Argh!! :evil:

Posted: Sun Dec 12, 2004 12:48 am
by nigma
You use setcookie() to set a cookie with the same name as the one you want to delete, but set the expire time to (time() - 2278326).

Posted: Sun Dec 12, 2004 7:31 am
by timvw
the answer was already given: make sure the expiration date of the cookie is in the past..

instead doing calculations yourself:
[php_man]strtotime[/php_man]

fe:

Code: Select all

strtotime("now +2 months")
will give you a date 2 months from now...

Posted: Sun Dec 12, 2004 3:16 pm
by Steveo31
Knew it was simple. Thanks guys.

And yea, Tim, I did that elsewhere, but my hand had a spasm on the keypad for this one, heheh ;)