I am creating a signup form with a certain number of open slots. I would like to create a timeout/refresh page overlay window if there is no activity for 5 minutes so that people can't let the page sit for an hour and then sign up for a position that has already been taken while they were waiting. Ideally, if they wait too long a translucent window will overlay with a button that will refresh the page and restart the session.
I think that I can use the following in some way:
PHP Code:
<?php
session_start();
// set timeout period in seconds
$inactive = 300;
// check to see if $_SESSION['timeout'] is set
if(isset($_SESSION['timeout']) ) {
//$("timeoutMessage").style.display = "none";
$session_life = time() - $_SESSION['timeout'];
if($session_life > $inactive) {
session_destroy();
//SOMETHING HAPPENS HERE I THINK
}
}
$_SESSION['timeout'] = time();
?>
But I can't figure out how to trigger a div/overlay without manually refreshing the browser. I've seen many, many sites do this but for reason I can't find any examples. I'm not even sure what to call it when I do a search. Can anyone just point me in the right direction?
Thanks.
Bookmarks