Reputation: 11
I am trying to log out from my session. The logout is successful but upon hitting the back button, I am taken back to the 'secret' page and I can access all the links etc ...
This is in of my 'secret' page:
if(isset($_COOKIE['ID_my_site']))
{ ........... }
else { header("Location: login.php"); }
And my logout page is as follows:
unset($_COOKIE['ID_my_site']);
session_destroy();
$past = time() - 01;
setcookie(ID_my_site, gone, $past);
setcookie(Key_my_site, gone, $past);
header("Location: login.php");
Upvotes: 0
Views: 292
Reputation: 1957
<script type="text/javascript">
function doLogout() {
var backlen = history.length;
history.go(-backlen);
window.location.replace("index.html");
}
</script>
<a data-role="none" href="#" onclick="doLogout"></a>
Upvotes: 1
Reputation: 2358
put code something like this...
if (check session is alive){
}
else{
header("Location: login.php");
}
Upvotes: 0