53329 Posted September 14, 2007 Share Posted September 14, 2007 For some strange reason I can't seem to delete cookies. First it kept adding a new cookie a dot in front of the host when I set an already existing one with a negative expiry but now nothing happens at all. The code I'm using (with the domain changed) is: setcookie( "member_id", "4", time()-3600, "/", "www.mysite.net" ); The cookie remains unchanged and I have no idea why. The name, value, path, and host are correct but I still get nothing. I also tried: setcookie( "member_id", "", time()-3600); Again to no avail. It doesn't work on IE or FF. PHP version is 4.4.7 OS is Linux No error messages are displayed Thanks in advance for any input. Quote Link to comment https://forums.phpfreaks.com/topic/69291-cant-delete-cookies/ Share on other sites More sharing options...
redarrow Posted September 14, 2007 Share Posted September 14, 2007 // to create a session cookie use zero (0) instead of time setcookie("name", "value", 0); // to destroy the session-cookie use setcookie("name", "", -1); Quote Link to comment https://forums.phpfreaks.com/topic/69291-cant-delete-cookies/#findComment-348189 Share on other sites More sharing options...
53329 Posted September 14, 2007 Author Share Posted September 14, 2007 Thanks a lot. Using 0 and -1 were a big help. Fixed everything. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/69291-cant-delete-cookies/#findComment-348208 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.