Jump to content

Tracking the online users of a website


fiddy

Recommended Posts

Hi,

I am looking for a way to track users who are logged in to my website. I thought of maintaining it in the DB and reset that DB entry when they logout. But, If the user go's out without logging out (by clicking the close button in the browser), it will show the status of the user as online always.

Expecting help related to this....

Thanks,
Fiddy.[color=black][/color]
Link to comment
Share on other sites

i use this on my site.

place this on top of your page

[code]  function remInActiveUsers() {
    $timeout = time()-(10*60);
    $query = "update members set mem_online=false, mem_session_id='' WHERE u_timestamp < '$timeout'";
    $this->query($query);
    }[/code]

add user after logging onyour site

[code]    function addActiveUsers($id){
    $time = time();
    $ip  = $_SERVER['REMOTE_ADDR'];
    $query = "INSERT INTO forum_active_users(u_userid, u_timestamp, u_ip) VALUES('$id','$time','$ip')";
    $this->query($query);
    }[/code]

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.