Posts Tagged ‘users’
Posted on September 23, 2007 - by Jordan H
PHP Session Purging
I’ve been trying to make a login script that purges the sessions database so that users will only stay inactive for 1 hour until they have to log in again. All seems to be well, but then it just doesn’t work.
This is the code which I have on every page:
$time = date("ymdHis");
$cutoff = $time-1000;
$sql = "DELETE FROM adminsessions WHERE time<'$cutoff'";
mysql_query($sql) or die(mysql_error());
It should log the user out after 10 mins of inactivity. Doesn’t seem to be doing that at the moment. Anyone got any ideas?
