I'm having problems, if the user is idle for more than 24 minutes, the page remains the same.
If I am on my page and the session is expired due to inactivity (it has passed 24 minutes), I still can interact on the page, but if I want to send the data (I send this data via ajax
), , the page asks to HTML
again and all this data is lost.
Is there a way to unplug after the session has expired if the user has not interacted with the form? or some other approach that I can do?
public function run(){
Session::init();
$uname = $_POST['form-username'];
$upass = $_POST['form-password'];
$database = $this->db;
$query = "
SELECT * FROM tabela
WHERE BINARY user_name=:user_name AND BINARY user_pass=:user_pass LIMIT 1";
$stmt = $database->prepare($query);
$stmt->execute(
array(
':user_pass'=>$upass,
':user_name'=>$uname
)
);
$resultado = $stmt->fetch();
$contador = $stmt->rowCount() ;
Session::set("loggedIn",false);
if($contador > 0){
Session::set("loggedIn",true);
Session::set("id",$resultado['id']);
header("location: ../outrapagina");
} else {
Session::set("mensagemErro","Login ou Senha Errada");
header("location: ../login");
}
}