Subscribe
$cookiesSet = array_keys($_COOKIE);
for ($x = 0; $x < count($cookiesset); $x++) {br> if (is_array($_COOKIE[$cookiesSet[$x]])) {
$cookiesSetA = array_keys($_COOKIE[$cookiesSet[$x]]);
for ($c = 0; $c < count($cookiesseta); $c++) {br> $aCookie = $cookiesSet[$x].'['.$cookiesSetA[$c].']';
setcookie($aCookie,"",time()-1);
}
}
setcookie($cookiesSet[$x],"",time()-1);
}>>
delete_all_cookies function implemented in Javascript -- down a ways.deletecookies.php' in the root of your folder, and then from drupal make a link that says "having trouble logging in? _click here_" pointing that file. You could then add a header("Location: /"); to redirect users to your site root once the cookies are cleared, but theat doesn't give any visual feedback that anything happened. Maybe just have that page display a "all cookies have been cleared! return to the _login page_" message when it is done. (heck, throw a meta-redirect to redirect there automatically after x seconds too)header() work or set any cookies after output has already been sent.You are not logged in, either login or create an account to post comments
Every time a user visits any page on your site, they send ALL the cookies that their browser has, which were given to them by your site. This is in the "cookies" header. Whatever server you have, and whatever programming language you have access to, you can grab this header and parse the cookie names out of it. Then, you can re-send the cookies with an immediate expiration time.
The actual details of this are left as an excercise since it'll depend a lot on your platform and programming language. Once you figure out how to grab the actual value of the cookies header, you'll see what I mean, the cookes are "packed" into the cookie header in an easily parseable format.
posted by RustyBrooks at 12:43 PM on May 12, 2006