themistral Posted December 3, 2010 Share Posted December 3, 2010 Hi guys, I'm having a problem with destroying Cookies in IE8 (maybe other versions of IE but this is the one I'm testing on). I am checking to see if the referrer of the site is not itself, and if not, delete all cookies with the cookie domain. if ($_COOKIE['exp_last_visit'] < mktime("23", "59", "59", "12", "03", "2010")) { if (!strstr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) { foreach ($_COOKIE as $key => $value) { setcookie($key, $value, time()-10000, "/", ".domain.com"); } } } This works in Chrome and FF, but of course, not IE8. If anyone could shed any light on this I'd be really grateful! Quote Link to comment Share on other sites More sharing options...
themistral Posted December 3, 2010 Author Share Posted December 3, 2010 I think I may have solved this...IE was storing the cookie with www.domain.com and that wasn't being deleted. I now have the following code and it seems to be working. if ($_COOKIE['exp_last_visit'] < mktime("23", "59", "59", "12", "03", "2010")) { if (!strstr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) { foreach ($_COOKIE as $key => $value) { setcookie($key, $value, time()-10000, "/", ".domain.com"); setcookie($key, $value, time()-10000, "/", "www.domain.com"); } } } 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.