Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

user.cgi.. Sessions

Quote Reply
user.cgi.. Sessions
i found it useful to do this..

change:

Code:
$db->do (qq!
DELETE FROM Sessions
WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(Created) > 10800
!);

to

Code:
$db->do (qq!
DELETE FROM Sessions
WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(Created) > 10800 OR
Username = '$u'
!);

it deletes all the username's old entries.. even under 3 hours old.. i made an auto_login subroutine for the "remember me" function found on many sites.. and i found that there were A LOT of old sessions for that one user..

something that isn't too great for this is that the user will not be able to login at two locations anymore and be able to be active at both locations..

but i don't care about that.. i just changed the error message for invalid sessions to

Invalid Session or Another Remote Login

basically if a user logs in 50 times it will only keep 1 session for the user instead of having 50 and deleting them in 3 hours.. but if you have a lot of users.. those can add up

jerry