Plain Flailing Posted February 27, 2008 Share Posted February 27, 2008 I've searched through a number of threads on this topic, but none have seemed to help. I'm having trouble deleting a cookie. I can set it fine like this: setrawcookie("username", $username, time()+3600); But I can't delete it like this: setrawcookie("username", "", 1); I've also tried adding a "/" in the domain parameter: setrawcookie("username", $username, time()+3600, "/"); setrawcookie("username", "", 1, "/"); If it matters, the cookie is set on the page mysite.com/login/index.php and is (theoretically) deleted on the page mysite.com/logout/index.php - could the directories be causing the problem? If not, where am I going wrong? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 27, 2008 Share Posted February 27, 2008 Delete it by using a negative time. Quote Link to comment Share on other sites More sharing options...
Plain Flailing Posted February 27, 2008 Author Share Posted February 27, 2008 The reason I tried it with 1 is because I read this page, which says it's a more timezone-proof method of setting a time in the past. But now I've tried this and it still doesn't work: setrawcookie("username", "", time()-3600*24, "/"); Again, with and without the "/". Quote Link to comment 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.