简体   繁体   English

会话超时陷入循环

[英]Session timeout stuck in loop

I'm stuck in a session timeout loop, 我陷入了会话超时循环,
Once my session times out i can't sign back in 一旦会话超时,我将无法重新登录

<?php
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 300)) {
    header("location:../index.php");
    exit();
}
$_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
?> 

here is where I included the timeout.php 这是我包含timeout.php的地方

 <?php
//$now = 0;
if (isset($_REQUEST['err'])){
$now = $_REQUEST['err'];
}
?>
<?php
session_start();
include('../includes/session_timeout.php');
if(!isset($_SESSION['isactive'])){
    header('location: index.php?e=li');
}
include('../../administrator/includes/constants.php');
include('../includes/functions.php');
if(isset($_REQUEST['p'])){
    $cmd = $_REQUEST['p'];
}else{..........etc

Try to unset your session variable before redirecting 尝试在重定向之前取消设置会话变量

session_start();
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 300)) {
unset($_SESSION['LAST_ACTIVITY']);
header("location:../index.php");
exit();
}
$_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM