如何更新会话超时表并重定向到主页

时间:2017-05-15 05:52:58

标签: javascript php ajax

会话超时更新表

$idletime = 200; // After this time the user gets logged out

if (time() - $_SESSION['timestamp'] >= $idletime){
    // Update this Query When Time Is over
    $qry = "UPDATE users SET status = ' ' WHERE seats = '".$_SESSION['seats']."' and id='".$ID."'";
    mysqli_query($con, $qry);
    session_destroy();
    header("Location:index.php");
} else {
    // First Time Run This Query
    // This query run  perfectly
    $qry = "UPDATE users SET status = 'HOLD' WHERE seats = '".$_SESSION['seats']."' and id='".$ID."'";
    mysqli_query($con, $qry);
    $_SESSION['timestamp'] = time();
}

如何更新会话超时表并重定向到主页?

0 个答案:

没有答案