php » Cookies

Clear Unset All Domain Cookies

This will clear (expire/unset) all domain cookies quickly:

$cookies=array_keys($_COOKIE);
$domain=”.mydomain.com”;
foreach($cookies as $cookie){
$when=time()-3600;
setcookie($cookie, “”, $when, “/”, $domain);
}
// Don’t forget to refresh the browser:
header(”location: somenewpage.php”)

Posted by Mark on October 7th, 2009 under Cookies, php  •  No Comments