LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP experts help!!!! (https://www.linuxquestions.org/questions/programming-9/php-experts-help-202515/)

maseby 07-08-2004 05:00 AM

PHP experts help!!!!
 
been trying to create an ONLINE LIST for my website, so that one can see who is online and who's not, with out any real progress...


I wonder if there are any scripts out there for me to use...submit some links guys for finished PHP ONLINE SCRIPTS.....

datprogrammer 07-08-2004 05:27 AM

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.


All times are GMT -5. The time now is 04:50 AM.