Page 1 of 1

Clearing cookies

Posted: Tue Aug 03, 2004 9:57 am
by jslick
Is there a way to clear all cookies from the website using PHP? Another question (little off topic): I have an auto-increment in a table, how do I reset that (bring down to 1 or 0) with MySQL AND phpMyAdmin?

Posted: Tue Aug 03, 2004 11:15 am
by evilmonkey
Does print_r($_COOKIE) print all cookies, or just ones related to the domain? If it outputs all the user's cookies, I suppose you can cycle through $_COOKIE array and unset them all..something like this

Code: Select all

foreach ($_COOKIE as $cookie_val) {
setcookie ($cookie_val, "", time() - 3600); }

Posted: Tue Aug 03, 2004 1:31 pm
by feyd
note: the cookie has to match on the path and domain used in the original cookie.. at least last I had to play with deleting cookies..

As for resetting the auto_increment, you can do it in the "operations" pane in phpmyadmin of that table.

Posted: Tue Aug 03, 2004 2:07 pm
by jslick
thanks feyd, I found the auto-increment thing.