|
Posted by Ewout de Boer on 10/10/45 11:12
Ryan A schreef:
> Hi,
> I have been searching the archives with little luck so I need a reminder
> here,
> I remember a little while ago someone asked how to implement the "users
> online" functionality
> that some sites have...now i have been asked to do exactly that but with a
> small twist:
> instead of displaying "xx number of users online" they want me to display
> all the usernames who are online
> with a link to their profile.
>
> I have a few ideas on how this can be done, but I would like advise from
> people who have already done this
> or thought of doing it (i think there was also a class that does something
> like this i'll check while waiting for a reply from you guys) so i can
> compare it with my ideas (which are in the infancy stage ;-) )
Easiest way of doing this is adding a 'last seen' field to your user
profiles and updating that record with the current timestamp every time
the user requests a page.
Al you need to do when displaying the 'users online' info is getting al
profiles with the 'last seen' record on a time between now and x minutes
ago (depending on what you consider to be an 'online' user).
If you're using a database like mysql or postgresql for profile storage,
use a field type that the database software can handle internaly, this
can speed up the query.
regards,
Ewout
Navigation:
[Reply to this message]
|