Shouldn't be too hard...
I assume you;re requiring users to log on? if so, why not just have a mySQL table that tracks "users logged on" - columns could be
username varchar(20),
loggedonat DATETIME
lastaccess DATETIME
Everytime they log on, you write a row to this table, and if they explicitly log off, delete the row. Assume some sensible timeout value for people leaving the site without logging off (10 minutes maybe).
Then all you have to do is have a little php function to select the names off this table where lastaccess is less than your timeout value and there's your list of logged on memebrs...
Probably a good idea to also have some sort of cleanup function that deletes all records with an old lastaccess time
That's how I would go about it anyways.
|