I am trying to write PHP code to delete all user cookies in my domain.
Here is what I got:
<?php
$domain = 'www.example.com';
$deleteExpiration = time() - 60*60*24*365*10;
foreach (array_keys($_COOKIE) as $cookie) {
setcookie($cookie, 0, $deleteExpiration, '/', $domain);
}
Running this code at http://www.example.com/delete_cookies.php deletes all cookies set on the server, but not cookies set in JavaScript.
I checked using the Firefox Cookies dialog box in which the cookie problem really is (path = /; domain = www.example.com). Using Live HTTP headers, I see that the following header is being sent:
Set-Cookie: CookieName=0; expires=Fri, 12-Mar-1999 19:36:15 GMT; path=/; domain=www.example.com
Therefore, I believe the setcookie command works as expected. Firefox just does not fulfill the request.
, , , cookie domain=www.example.com , cookie Firefox domain=".www.example.com", cookie JavaScript, .
? cookie?