Maybe I'm using the wrong method but I need to destroy all session related data when the user closes or navigates away from my page. I have session_destroy(); at the end of my script but when I close the browser and go back, it remembers my session data and logs me into the secured area.
session_start(); is called in an included header file and session_destroy(); is called in an included footer file. The login process sets the 2 session variables as follows:
if(strtolower($username) === strtolower($mgr['username']) && $password === $mgr['password']){
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
header("Location: admin.php");
}else{
echo "Invalid username and/or password.<br />Click <a class='adminLink' href='javascript:history.go(-1);'>here</a> to login in.";
}