Jump to content

[SOLVED] Logout problems


cordoprod

Recommended Posts

Hello.

 

I develope a community system, and on the top of the page it says X users online.

 

I store the online users in a DB where the cols are nick and time.

 

But, if the users just close the browser the users are still in the DB as online, is it possible to do something with that?

 

I use sessions, btw..

 

Link to comment
https://forums.phpfreaks.com/topic/105765-solved-logout-problems/
Share on other sites

Put an INTEGER UNSIGNED column in the table and every time a user loads a page from your site... set the column to the current UNIX timestamp from the time() function.

 

If you want to consider people who have been logged out for 10 minutes as offline, you could

$result = $db -> query('SELECT * FROM mytable WHERE last_hit > ' . (time() - 600)); 

 

to see who's still "signed in" for instance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.