This topic is locked

Report logged in users

6/4/2010 1:26:05 PM
PHPRunner General questions
G
glazer author

I want to be able when I log in as administrator to see list of all users currently logged in. How can i do this?

Sergey Kornilov admin 6/4/2010

You'll need to add an extra table or an extra field to the login table (LastActivity). On every page you need to update LastActivity field with the current datetime. You can use AfterAppInit event for this purpose.
Now you can run a query to get the list of users who had an activity in, say, last 20 minutes.

Something like this:



select * from users where DATE_ADD(LastActivity,INTERVAL MINUTE 20) > NOW()


It will return the list of active users.