If you want to delete all cookies on your domain, you may want to use the value of:
<?php $_SERVER['HTTP_COOKIE'] ?>
rather than:
<?php $_COOKIE ?>
to dertermine the cookie names.
If cookie names are in Array notation, eg: user[username]
Then
 PHP will automatically create a corresponding array in $_COOKIE. 
Instead use $_SERVER['HTTP_COOKIE'] as it mirrors the actual HTTP 
Request header. 
Taken from that page, this will unset all of the cookies for your domain:
// unset cookies
if (isset($_SERVER['HTTP_COOKIE'])) {
    $cookies = explode(';', $_SERVER['HTTP_COOKIE']);
    foreach($cookies as $cookie) {
        $parts = explode('=', $cookie);
        $name = trim($parts[0]);
        setcookie($name, '', time()-1000);
        setcookie($name, '', time()-1000, '/');
    }
}
http://www.php.net/manual/en/function.setcookie.php#73484

 
 
 
 
 
 
 
 
0 Comments