PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
dwfait
Forum Contributor
Posts: 113 Joined: Sun Aug 01, 2004 10:36 pm
Post
by dwfait » Thu Aug 05, 2004 8:10 pm
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?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Aug 05, 2004 8:12 pm
$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..
dwfait
Forum Contributor
Posts: 113 Joined: Sun Aug 01, 2004 10:36 pm
Post
by dwfait » Thu Aug 05, 2004 8:20 pm
The cookie is created okay, and my script reads the variable i set in there ok, it just wont..not work.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Aug 05, 2004 8:27 pm
you mean deleting the cookie? the value should be an empty string..
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Thu Aug 05, 2004 8:38 pm
feyd is saying to do this
=]
setcookie ("username", "" ,time()-43200);
dwfait
Forum Contributor
Posts: 113 Joined: Sun Aug 01, 2004 10:36 pm
Post
by dwfait » Thu Aug 05, 2004 9:37 pm
Thanks a lot guys.
Joe
Forum Regular
Posts: 939 Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow
Post
by Joe » Thu Aug 05, 2004 10:26 pm
Setting the cookie to null is a great logout procedure! Just thought I should say
dwfait
Forum Contributor
Posts: 113 Joined: Sun Aug 01, 2004 10:36 pm
Post
by dwfait » Fri Aug 06, 2004 1:31 am
lol. What do you suggest then?
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Fri Aug 06, 2004 4:40 pm
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
dwfait
Forum Contributor
Posts: 113 Joined: Sun Aug 01, 2004 10:36 pm
Post
by dwfait » Fri Aug 06, 2004 4:43 pm
thought he was being sarcastic
lol
Joe
Forum Regular
Posts: 939 Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow
Post
by Joe » Fri Aug 06, 2004 4:44 pm
lol, no I was not being sarcastic.