Page 1 of 1

Cookie Problem in Firefox

Posted: Fri Aug 03, 2007 4:18 pm
by mtairhead
I've been having a PHP problem, and I guess it warrants a question for the Gurus.

I have found that I can easily set a cookie:

Code: Select all

setcookie("cookiename", "", exptime);
No problem. I cannot, however, seem to get my cookie to be UNset. I only have this problem when I use Firefox. Internet Explorer sets unsets cookies like a dream, however cookies set in Firefox won't go away until they've expired, and it's driving me crazy.

I've attempted all of the following methods:

Code: Select all

setcookie("emailAddress", "", time()-86400);
setcookie("emailAddress", "", time()-9999999999999999999999999999999999999999999999999); //(Exaggeration)
session_destroy();
setcookie("emailAddress" ,"",0,"/");
Thanks for any insight.

~Andrew

Posted: Sat Aug 04, 2007 9:14 am
by feyd
Firefox will only unset the cookie if it matches the precise combination of name, path, domain and security level, if memory serves.

Posted: Mon Aug 13, 2007 10:58 am
by mtairhead
Yep...Thanks, feyd

About the delete part, I found that Firefox only remove the cookie when you submit the same values for all parameters, except the date, which sould be in the past. Submiting blank values didn't work for me.

Example :
- set -
setcookie( "name", "value", "future_timestamp", "path", "domain" );

- delete -
setcookie( "name", "value", "past_timestamp", "path", "domain" );

Jonathan
http://us2.php.net/setcookie

~Andrew[/url][/quote]