I'm trying to put on my page that if the visitor stays 20min inactive, the session expires, php destroys the session and redirects the visitor to the login page. But it's not working. My code looks like this:
session_start();
$_SESSION['inicio'] = time();
$_SESSION['final'] = $_SESSION['inicio'] + (1 * 60) ;
$agora = time();
if(isset($_SESSION['final'])){
if($agora > $_SESSION['final']){
session_destroy();
header("Location: ../index.php?id=998&tp=bi");
}
}