我试图在一段时间后破坏会话但它直接销毁我的意思是当我按下登录时它会被破坏。我认为这意味着条件不能正常运作。
提前致谢。
<?php
include "baglanti.php";
session_start();
$user_check = $_SESSION['login_admin'];
$ses_sql = mysqli_query($baglanti,"select admin_username from admin where admin_username='$user_check' ");
$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);
$login_session = $row['admin_username'];
if(!isset($_SESSION['login_admin'])){
header("location:.login.php");
}
$inactive=100000;
ini_set('session.gc_maxlifetime',$inactive);
if(time() - $_SESSION['login_admin']>$inactive){
session_unset();
session_destroy();
header("location:.login.php");
}
$_SESSION["login_admin"]=time();