This topic is locked

Users logged in

11/5/2009 10:55:43 AM
ASPRunnerPro General questions
P
PCB author

Greetings,
Is there a way to tell if any users are logged in?
I often would like to make changes\updates to my ASPR projects, but get complaints that users get kicked back to the login page if I upload a new version of a project.
What I'm hoping for is something like what is displayed at the bottom of

http://www.asprunner.com/forums/index where it displays the number of active users. The solution does not need to be so elaborate.
Thank you!

Sergey Kornilov admin 11/5/2009

You'll need a separate table for this purpose or an extension of existing login table.
Once user logs in you update "LastSeen" field with current timestamp. When user logs out you can clear this field.
The problem is that many users just close the browser without logging out. As a workaround you need to add a piece of code to each page that updates LastSeen field. In this case you can believe that active users are those who had some activity in last 20 minutes. The best place to put this code is

select username from login where DATE_ADD(LastSeen, INTERVAL 20 MINUTES)>now()