evanct Posted June 5, 2009 Share Posted June 5, 2009 So when user logs in, cookie is set in loggedin.php: <?php $id=$_GET['id']; setcookie('login',$id,time()+7200,'/'); header('location:index.php'); ?> Then when the user logs out, as part of the logout function(which otherwise works) the cookie is allegedly unset: setcookie ('login', '', time() - 7200); It then redirects to index.php, where if $_COOKIE['login'] is not set it will redirect to login.php. it doesn't redirect. print_r($_COOKIE) reveals that $_COOKIE['login'] is in fact still set to the value it was set to in loggedin.php. What's going on? Quote Link to comment Share on other sites More sharing options...
btherl Posted June 5, 2009 Share Posted June 5, 2009 Can you try setting the path argument ("/") when you unset the cookie? Quote Link to comment Share on other sites More sharing options...
evanct Posted June 5, 2009 Author Share Posted June 5, 2009 Yeah that fixed it. should have tried that myself, didn't think it would make a difference. thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.