Jump to content

Who's Online Stats


FishSword

Recommended Posts

Hiya,

 

What's the best way of finding out and displaying the total number of users currently online, along a breakdown of how many of these users are members or guests?

 

I also wish to find out and display the total number of users who were online today, along with a breakdown of how many of these users are members or guests.

 

I've noticed that users of the same computer could of course use a different browser preference to another user of the same computer.

What should happen in this situation?

 

Any help is much appreciated.

 

Cheers!

Link to comment
Share on other sites

What's the best way of finding out and displaying the total number of users currently online

 

In the database, put a column in the user table that holds the time of their last action.  Put some code in with the session class that checks to see if they're logged in, and get that to update the time in the database everytime they do something (i.e. click a link)

 

for example:

 

session_start();
if (isset($_SESSION['user']))
{
    $query = "update users set tolc=\"". time(). "\" where user=\"". $_SESSION['user']. "\";";
    // run that query.
}

 

You can then write another piece of code that, when you're pulling users from the database, you can get it to ignore users which have been idle for about 10/15 minutes.

 

I've noticed that users of the same computer could of course use a different browser preference to another user of the same computer.

What should happen in this situation?

 

Nothing.  If a user is using a different browser over the same session instance, then i'd start hashing the browser string in with an MD5'd session key.  But as it's two separate users, then just leave it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.