I have a problem with some cookies not unsetting. I have had a look through this question but all the answers have not worked.
I have 13 cookies in total, which I need to clear to test occasionally. When I unset them using:
setcookie("name", "", time() - 3600, '/');
What makes this unusual, is that using the same code with a different name unsets 10 of 13 cookies, leaving 3 still set... All the cookies are created at the same time, and I am trying to unset them all at the same time. I have checked the cookie names which all match what is stored on my PC.
As stated, I have tried all the answers in the post linked above, but none have worked. The cookies are set and unset from within the same directory, just a different file of which permissions are the same level.
Any suggestions?
(Not sure if it matters, but I'm using Chrome on Mac)
Example: Setting cookies during login (I've dumbed it down to the 4 key cookies I need)
if($pass == 1) {
setcookie('auth_code',$no_generator,$cookie_expire,'/');
setcookie('username',$_POST['username'],$cookie_expire,'/');
setcookie('admin',$admin,$cookie_expire,'/');
setcookie('login_time',$date,$cookie_expire,'/');
$_SESSION['logged_in'] = "true";
header('Location: /logs.php');
}
Unsetting Cookies:
setcookie("admin", "", time() - 3600, '/');
setcookie("login_time", "", time() - 3600, '/');
setcookie("username", "", time() - 3600, '/');
setcookie("auth_code", "", time() - 3600, '/');
$cookie_expire is set to: $cookie_expire = time() + (21*365*24*60*60);
.