Hi,
First of all, I guess you have a database that holds the users, and a login system.
So, all you have to do, is to add one field to the database, for example IsOnline, whose status you change according to the current status of the user. (when user logs in, the IsOnline=1, and on logout it changes to 0).
Then you can simply view the users online by saying:
--snip--
$result=mysql_query("select UserName from User where IsOnline='1'");
print "Users online:<br>\n";
while($row=mysql_fetch_array($result)) {
print $row["Username"]." ";
}
print "<br>\n";
--snap--
This is a simple solution for this kind of problem. The only drawback in this technique is that when the user does not log out manually (only closes the browser), he is still active in the system. But you can do a system, that checks that if user hasn't done anything in a long time, it just changes the status (by using cookies and a database field, for example (LastAction or something like that)).
🙂Mikko