24 lines
489 B
PHP
24 lines
489 B
PHP
|
<?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();
|
||
|
}
|
||
|
|
||
|
|
||
|
?>
|