This topic is locked

See Who Is Logged In

4/19/2013 7:57:50 AM
PHPRunner General questions
S
shoppy author

As the topic title says: How can I see who is logged in?
Because of a new phprunner for a group of people I like to see who is logged in and for how long.
Can someone help me how to do that?

Sergey Kornilov admin 4/19/2013

You can do that. Some manual coding skills are required to implement this functionality.

  1. Add a new LastActivity(datetime) field to the login table
  2. When user logs in or accesses any page update LastActivity field for this user with the current timestamp
  3. Now, to find who is currently on website run a SQL query that will pull the list of users who has LastActivity field within last ten minutes. Here is a sample query for MySQL:

select * from users where LastActivity > (now() - interval 10 minute)


Display the list of users that this query returns somewhere on the web page.

S
shoppy author 4/19/2013

Hi Sergey,
I can run the query in MySQL but I get no results.
I think I have to make a php file to get the results?

Sergey Kornilov admin 4/19/2013

Make sure you have added such a field and it's populated with correct values. Once you got it right you can add a PHP code snippet to one of PHPRunner pages that runs this query and displays the list of users.

S
shoppy author 4/22/2013

Could anyone help me make a script like that?
I just want to see witch users are logged on thats all.

Sergey Kornilov admin 4/22/2013

Contact Cristian Gile for a quote:

http://www.asprunner.com/forums/user/7513-cristian-gil/
You can also see our rates at http://xlinesoft.com/buy_support.htm

One hour of custom software development will cover this task.

S
shoppy author 4/22/2013

Thanks Sergey.
I made a field with the name 'LastActivity' in the users table and set it to DATETIME.

But how do I set this field to the current time when a user logs in?

This must be done in the EVENTS tab or not?
Can you tell me?

Sergey Kornilov admin 4/22/2013

You need to use AfterAppInit event for this purpose. It's not enough to update this field after the login. You need to do that after each new page user loads so you know they are still on the website.

S
shoppy author 4/22/2013



You need to use AfterAppInit event for this purpose. It's not enough to update this field after the login. You need to do that after each new page user loads so you know they are still on the website.



I still work with 4.2 and have no AfterAppIni.

Sergey Kornilov admin 4/22/2013

You need to upgrade to the latest version then.