tags:

views:

313

answers:

3

I tried to use setcookie("user", "", time()-3600) to delete a cookie from php, but it's not working for me, when I check in the tool of the broswer, the cookie seems to still exist. Does anyone know why?

note: this is the domain cookies.. mean I set this cookies with this way setcookie('user','true',time() + 2592000,"/",".user.com",0);

+1  A: 

Try setcookie ('user', "", time() - 3600, "/", ".user.com", 1);
Just a warning- IE and opera sometimes maintain cookie values until after restart- that may be part of the issue.

apocalypse9
I'm using Opera and have had not problems with that in my development! Just make sure you are expiring it on the correct domain. I can't vouch for IE... wouldn't touch it.
Fiarr
A: 

According to the PHP documentation, your code should work properly, though, you could try this:

setcookie("user", "", time() - 3600, "/", ".user.com", 0);
Phoexo
A: 

are you refreshing the page and browsing around a bit before checking? See if you can still read the cookie with php, as that's the "important" thing (whether the tool thinks the cookie is there isn't as important). :D

CrazyJugglerDrummer