Forum Moderators: coopster
I have a welcome.php page, in which a session variable is already set for a logged in user. On this page there is a hyperlink, once clicked it causes a .php file to be executed.
Here is the code inside of logout.php
unset($_SESSION['username']);
session_destroy();
header("Location: http://localhost/Welcome.php");
The above code was supposed to destroy the $_SESSION and send the user back to welcome.php. As far as I know, the session variable
$_SESSION['username'] should be unset when the welcome page is loaded. But it's not. It remains set. I tested many times, for
$_SESSION['username'] and it's still there. Therefore, the user is still logged in, even though he has clicked "log out" and the logout code is executed. I'm not sure if what is going on and why. I'd appreciate it if you would share with me your insight about this. THank you.
JAG