HomeMediacenter/php/checkSessionValidity.php

24 lines
489 B
PHP
Raw Normal View History

2020-05-16 18:41:32 +00:00
<?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();
}
?>