View Full Version : Who Is online
11-19-2006, 06:38 PM
Hi, How would I go about making a script that would allow people to see who is online? I want it to display the members name if they are logged in, otherwise display 'guest' if they are not. So, if someone could either explain it here or direct me to a tutorial that'd be great
One way you can do this is to store the ip, username (or "guest") and a timestamp in a db-table. Id a user klicks on a page, you look in your table if the ip exists. If you fount the ip, set the timestamp for this row to NOW().
To display the online-user, just query the db-table for the rows which timestamp is greater than NOW()-10 minutes.
You need also a "cleanup"-script for this table. All rows which are smaller than NOW()-10 minutes should be removed, so you have a clean and small table.
11-19-2006, 10:45 PM
ok...thanks. I'll have a go at it ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.