2013-12-19 184 views
0

我正在尝试从我的会话中注销。注销是成功的,但在命中后退按钮,我将返回到“秘密”页面,我可以访问所有的链接等...注销和浏览器后退按钮

这是我的“秘密”页面:

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

不要混淆了''SESSION''和''COOKIE''! – ins0

+0

使用SESSION而不是COOKIE! –

+0

检查会话是否在您的页面上被解散或者不会被解散,然后将头文件设置为ligin页面。 –

回答

0

将代码这样的事情...

if (check session is alive){ 

} 
else{ 
    header("Location: login.php"); 
} 
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>