i have created one project in PHP, into which i am managing sessions.
I am creating session in my config.php file by writing following line of code.
Store time() in the $time variable. create variable called $setTime and set the time you want user to timeout.
After that check the condition that if $_SESSION['setTime'] is empty OR not set then store the timeout value into the session, otherwise when the page will refresh the new value will be assigned to the $_SESSION['setTime'].
$time = time ();
$setTime = time () + 60;
if (empty ( $_SESSION ['setTime'] ) || !isset ( $_SESSION ['setTime'] )) {
$_SESSION ['setTime'] = $setTime;
}
After that check that current time is more than equal to the stored time. and if it is unset the session. destroy the session as well.
if (time () >= ( int ) $_SESSION ['setTime']) {
session_unset ();
session_destroy ();
}