Cookie won't unset
        Posted  
        
            by Jordan Satok
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jordan Satok
        
        
        
        Published on 2010-03-23T04:03:49Z
        Indexed on 
            2010/03/23
            4:11 UTC
        
        
        Read the original article
        Hit count: 434
        
OK, I'm stumped, and have been staring at this for hours.
I'm setting a cookie at /access/login.php with the following code:
setcookie('username', $username, time() + 604800, '/');
When I try to logout, which is located at /access/logout.php (and rewritten to /access/logout), the cookie won't seem to unset. I've tried the following:
setcookie('username', false, time()-3600, '/');
setcookie('username', '', time()-3600, '/');
setcookie('username', '', 1, '/');
I've also tried to directly hit /access/logout.php, but it's not working.
Nothing shows up in the php logs.
Any suggestions? I'm not sure if I'm missing something, or what's going on, but it's been hours of staring at this code and trying to debug.
© Stack Overflow or respective owner