FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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.
Related topics
managing a bilingual site
PHP: Sessions and Cookies
FireFox and Cookies/Sessions
How to make a log in log out system for a website??
meaning of your username
php SESSIONS question
what is better? Sessions or Cookies
$_COOKIE and $_SESSION help needed!
150 frih to make this SIMPLE script
phpBB sessions
php menus
cookies help - - - Urgent help
Principal, Athletic Director Could Face Jail Time For Prayer
Man/boy love - *yuck*
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

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