It was advised on this website that in order to implement strong logout functionality you must mark session IDs as obsolete.
I was wondering how exactly you would do this? I have included session_regenerate_id(true)
, but I'm not sure if that marks the session ID as obsolete.
When the log out form on the index page is submitted they are sent back to the login page:
Login page:
if(isset($_POST["log_out"]) && ($_POST["log_out"] == '1')) {
//this means we have come from another page after pressing the log out button
//so therefore we remove session variables and destroy session
//The logout function on your website should mark session IDs as obsolete.
session_regenerate_id(true); //is this right????????
session_unset();
session_destroy();
$loginMessage = "You have been logged out";
}
Index page logout form:
<form id="form-log-out" name="form-log-out" method="post" action="login.php" onsubmit="return confirmLogOut()">
<input name="log_out" type="hidden" value="1"/>
<input type="submit" class="button_style" value="Log Out" />
</form>