HomeMediacenter/php/checkSessionValidity.php
2020-05-16 20:41:32 +02:00

24 lines
489 B
PHP
Executable File

<?php
if(isset($_COOKIE['LAST_ACTIVITY']))
{
if (time() - $_COOKIE['LAST_ACTIVITY'] > 86400) {
// last activity is more than 10 minutes ago
session_destroy();
echo "you are logged out because of the 10 minutes...";
exit();
} else {
// update last activity timestamp
//echo "updated timestamp";
//printf("timestamp updated %d seconds left", 3600 - (time() - $_SESSION['LAST_ACTIVITY']));
$_COOKIE['LAST_ACTIVITY'] = time();
}
}else
{
echo "no cookie...";
exit();
}
?>