Make a function that you can put at the top of each page.
Something like
function checktime() {
$time = mysql_fetch_array(mysql_query("SELECT timestamp FROM table WHERE id = '#'"));
$ts = $time['timestamp'];
if ($ts > (time() - 900)) {
logout();
}
} // End function
That might work. I'm not...