FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Sessions & cookies - member no longer active question

 


DoctorBeaver
I'm using sessions & cookies on my site & I've got a db table for members who are logged in.

My question is, how do I know if a user has just closed his browser rather than logging out of my site? I don't want to display a member as being logged in when they're not. Do I have to use a cron job to log them out if I get no reply from a cookie read request?
mathiaus
you don't want to log them out though. When they visit a page, record that time in database as well as the normal data. When you see who and how many are online, select from the database everyone who's visit_time is over a certain time (the current time - 5 minutes [or however long you want] ).

You could (I wouldn't suggest it though), make a logout script and use a javascipt popup on your site exit. The downside is that you don't really need it, not everyone (thugh most do) has javascript, and those that do don't like popups.
DoctorBeaver
mathiaus wrote:
you don't want to log them out though. When they visit a page, record that time in database as well as the normal data. When you see who and how many are online, select from the database everyone who's visit_time is over a certain time (the current time - 5 minutes [or however long you want] ).


Good thinking. Thank you.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.