Jump to content

Online Users List


xyn

Recommended Posts

Hey,
I wanted to make a list of members who are ONLINE,
so when they login it will imediatly add them to the list
until they log-off...

I can use AJAX for this, but the problem i am having is
actually setting the users online activity...

If I added a simple online 1/0 fild in the db, if they dont
click "logout" They wil lappear ONLINE until they do click it.

Another Method is to do the last 5 minutes, bu again it's not
percist enough for me.. I know its a little picky, but its quite
important, i'm also hoping to use this script in my AJAX chat.
Link to comment
https://forums.phpfreaks.com/topic/26694-online-users-list/
Share on other sites

You need to make a table which traks a users id and a timestamp. The timesatmp should be updated on each request.

You then run a script as a cron job to check this table and delete users that have a timestamp older than the last five minutes.

If you dont have cron, you can also run this script on each request but its probably a little less reliable.
Link to comment
https://forums.phpfreaks.com/topic/26694-online-users-list/#findComment-122127
Share on other sites

Well if i use that method for ym chat too but
If i use it with AJAX it would
techincly update it every 1 seconds anyway right?
I mean everytime there is a "change" it updates the
timestamp, so then using AJAX i could again run a
online check for the online ppl? and if they dont have
a valid timestamp for the last 1 minute or atleast 30 seconds

class them as logged out?
Link to comment
https://forums.phpfreaks.com/topic/26694-online-users-list/#findComment-122129
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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