我正在尝试退出我的会话。注销成功但是在按下后退按钮后,我被带回“秘密”页面,我可以访问所有链接等...
这是我的“秘密”页面:
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");
答案 0 :(得分:1)
<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>
答案 1 :(得分:0)
把代码放到这样......
if (check session is alive){
}
else{
header("Location: login.php");
}