Page 1 of 1

Cookies...again...

Posted: Thu Aug 05, 2004 8:10 pm
by dwfait
Hi. My expire code doesnt seem to be working on my cookies. Here is the code:

Code: Select all

setcookie ("username", $ssppluser,time()-43200);

//code to set the cookie:

setcookie ("username", $ssppluser,time()+43200);
So, im looking for another way. How would you delete the cookie entirely?

Posted: Thu Aug 05, 2004 8:12 pm
by feyd
$ssppluser has to be non-empty (to be set).. also, make sure the path and domain are readable where you are wanting it to be read..

Posted: Thu Aug 05, 2004 8:20 pm
by dwfait
The cookie is created okay, and my script reads the variable i set in there ok, it just wont..not work.

Posted: Thu Aug 05, 2004 8:27 pm
by feyd
you mean deleting the cookie? the value should be an empty string..

Posted: Thu Aug 05, 2004 8:38 pm
by tim
feyd is saying to do this

=]

setcookie ("username", "" ,time()-43200);

Posted: Thu Aug 05, 2004 9:37 pm
by dwfait
Thanks a lot guys.

Posted: Thu Aug 05, 2004 10:26 pm
by Joe
Setting the cookie to null is a great logout procedure! Just thought I should say :D

Posted: Fri Aug 06, 2004 1:31 am
by dwfait
lol. What do you suggest then?

Posted: Fri Aug 06, 2004 4:40 pm
by tim
dwfait, that is the only way to expire cookies on the go.

Unless you set it for an hour, and a hour passes, the code I gave is the only way

If u read what joe said, he said it is a good logout way, which pretty much is the only logout way with cookies


thought I should say that :roll:

Posted: Fri Aug 06, 2004 4:43 pm
by dwfait
thought he was being sarcastic :? lol

Posted: Fri Aug 06, 2004 4:44 pm
by Joe
lol, no I was not being sarcastic.