|
ok.. here's the way i have it done on my CMS system (which keeps people logged in as well as user tracking). There is a table with user id, users sessison id, when they first logged on and when they were last seen.
When a user first logs in (first time ever, lets say) a session is started, and the session id is grabbed from there, and put into the database. At the same time, a cookie is set which only has two bit of numbered information - their userid (a number) and their session id - so the cookie means nothing to a hacker.
Each time a user navigates through the site, it updates the last seen field in the session table. It also check to see if they are online by matching the session number in their cookie with the session number in the table - this keeps them logged in.
I know i've very generally explained this, but it's because the whole system i a **** of a lot more complex than this. But simply, if i want to check who is online, i simply query the session table to see who has been active in the last, say, 5 minutes (the last seen field).
It is actually impossible, in PHP anyway, to check who is online in real time (i believe)
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill
Please visit my sites: Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
|