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? Link to comment https://forums.phpfreaks.com/topic/93403-deleting-cookies/ Share on other sites More sharing options...
revraz Posted February 27, 2008 Share Posted February 27, 2008 Delete it by using a negative time. Link to comment https://forums.phpfreaks.com/topic/93403-deleting-cookies/#findComment-478480 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 "/". Link to comment https://forums.phpfreaks.com/topic/93403-deleting-cookies/#findComment-478489 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.