Page 1 of 1

list of users online in a members site...

Posted: Sat Oct 15, 2005 7:17 am
by The-Master
hi, i want to make a list of users online on my site, but not the "there are X users online", i want to make a list of users online that are members of the site... the table of users is "users": "user" is the row with the users' nicks and ofcourse a "id" row for an id... (this is just like in phpBB stats on the forum's index)

Posted: Sat Oct 15, 2005 7:28 am
by qads
make another table 'usersonline' with

Code: Select all

ID, userid, stamp
and when an user logs in, insert a record into usersonline with userid and current time(), when the user moves around the site, update the stamp field with current time().

to remove any loged out users, just do

Code: Select all

DELETE FROM usersonline  WHERE STAMP < 5 MINS ETC

to show, just

Code: Select all

select users.username from users,usersonline where users.id = usersonline.userid
good luck