刷新页面后其注销我可以做什么?

时间:2019-05-07 09:52:09

标签: php mysql

刷新页面后其从系统注销

此会话代码:

<?php

if(!isset($_SESSION['username'])){
    echo "<script>window.location.href='login.php'</script>";

    exit;
    }

$check_session=$db->countRecords("select * from user_sessions where username='".$_SESSION["username"]."' and session_id='".$_SESSION["session_id"]."'");


if($check_session<=0)
    {

        session_start();
        session_destroy();
    echo "<script>window.location.href='login.php'</script>";

    }

    $last_month=date("Y-m-1",strtotime("-1 Months")); 


    $delete_session=$db->Delete_Record("admin_sessions"," session_date<='".$last_month."'");
?>

0 个答案:

没有答案