Hello,
I'm wondering how I should go about echoing out a list of users who have clicked ANY link within the past 3 minutes? I know that you can either do it with a TIMESTAMP, or with sessions?
I'm wondering which method would be the most effective, and how exactly said method would work?
Thanks,
Alexi
How to echo out a list of online users
Moderator: General Moderators
Re: How to echo out a list of online users
view this function in php manual
Code: Select all
session_set_save_handler
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: How to echo out a list of online users
It can't be done with sessions. You need to add a column to your users table called "last_visit" or something like that, and store the current time in it whenever a user loads a page. To get the list of current users, just select all users who's last_visit is more recent than a given threshold (say, 2 minutes).
If you have a particularly large users table and/or a lot of traffic, you should instead keep a list of online users in a separate table.
If you have a particularly large users table and/or a lot of traffic, you should instead keep a list of online users in a separate table.
Re: How to echo out a list of online users
Thanks Johan, I'll do that 
Alexi
Alexi