greens85
12-10-2007, 11:35 AM
Hi all,
I currently have a login area with the remember me features, this works fine but im having trouble getting the logout feature to work. I have set 2 cookies 'user_name' & 'password' and one session called 'loggedin'. I have tried the following code on a page called logout.php
<?php
session_start();
setcookie('user_name', '', time()-60);
setcookie('password', '', time()-60);
unset ($_SESSION['loggedin']);
header("Location: http://www.mysite.com");
exit();
?>
But although the redirect works the user isnt logged out, which would suggest that the session and/or cookies are not being reset. Can anyone see why this may be the case?
Thanks in advance
I currently have a login area with the remember me features, this works fine but im having trouble getting the logout feature to work. I have set 2 cookies 'user_name' & 'password' and one session called 'loggedin'. I have tried the following code on a page called logout.php
<?php
session_start();
setcookie('user_name', '', time()-60);
setcookie('password', '', time()-60);
unset ($_SESSION['loggedin']);
header("Location: http://www.mysite.com");
exit();
?>
But although the redirect works the user isnt logged out, which would suggest that the session and/or cookies are not being reset. Can anyone see why this may be the case?
Thanks in advance