Clear out old expired sessions on log out.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
Loui Chang 2008-11-13 15:18:48 -05:00
parent 53bb32a15a
commit cf2a82fe85
2 changed files with 16 additions and 7 deletions

View file

@ -625,7 +625,6 @@ function try_login() {
$num_tries = 0;
# Account looks good. Generate a SID and store it.
#
$dbh = db_connect();
while (!$logged_in && $num_tries < 5) {
@ -790,4 +789,15 @@ function user_is_privileged( $id )
}
?>
# Clear out old expired sessions.
function clear_expired_sessions($dbh) {
global $LOGIN_TIMEOUT;
if (empty($dbh))
$dbh = db_connect();
$q = "DELETE FROM Sessions WHERE LastUpdateTS < (UNIX_TIMESTAMP() - $LOGIN_TIMEOUT)";
db_query($q, $dbh);
return;
}