I would like to know how to remove a user when it becomes inactive on the page, for example in PHPMyAdmin, which removes the user after 24 minutes of inactivity?
If the first part is very difficult to explain could they at least tell if this is a correct code to make the removal of the idle user? Are there any security holes? Are there any possible improvements? Possible problems?
<?php
if ( isset($_SESSION['ultimoClick']) && !empty($_SESSION['ultimoClick']) ) {
$tempoAtual = time();
if ( ($tempoAtual - $_SESSION['ultimoClick']) > '900' ) {
session_unset($_SESSION['ultimoClick']);
$_SESSION = array();
session_destroy();
header("Location:logout.php");
exit();
}else{
$_SESSION['ultimoClick'] = time();
}
}else{
$_SESSION['ultimoClick'] = time();
}
?>