Jump to content

Recommended Posts

Hi Guys,

I need to (through a MySQL Database) log users "activity" basically need to know if they are active or not. I am building a chat script like that of Facebook and need to figure out how they do the "online" "offline" thing for users. So my DB would need to track session activity (I think).

 

If any one can help, or provide links that would be much appreciated.

Cheers

Link to comment
https://forums.phpfreaks.com/topic/238656-users-online-sessions/
Share on other sites

A common answer to this, is store a time stamp of their activity, then check it for a time frame (say 5 mins) then show them as active or not based on that.

 

This is answered almost weekly, so you should find ideas about this topic already in the forums.

Well the AJAX isn't the difficult bit -- AJAX is in theory is very simple, and jQuery.ajax makes it even easier. All you need to do is set a timer interval to execute an AJAX request to a PHP script, that would query the database for the status of the user's friends and return the data in JSON format. The JS would then receive that data and update the HTML to match the new statuses.

 

The logic is fairly simple, just tackle it one step at a time. If you get stuck, by all means post here with a specific problem.

"A common answer to this, is store a time stamp of their activity, then check it for a time frame (say 5 mins) then show them as active or not based on that.

 

This is answered almost weekly, so you should find ideas about this topic already in the forums."

 

Okay so how with PHP do I log activity, etc? I need a clean neat way of doing it.

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.