View Full Version : Displaying users online

Al Capone
02-14-2006, 12:52 AM
Hello and good after noon :),

I want to be able to display all users browsing my site on the right navigation of my site.

I have one header that is included on every page of my site so I am guessing i will need to place the code that counts a person there, and that would be no problem.

I need a code to count people which will go in my header

and a code that will display people which will go in my navigation menu

any help on this subject is greatly appriciated, thanks in advance :)

02-14-2006, 03:05 PM
It can be done in different ways.

One way is to have a dedicated session table.
When a user logs in a session is created and that ID is inserted into the database with a last_active time.

You can then check against this table to count the number of users. You can also do some joins to get their user name, level etc.
And you can also check against the last_active time. If it is not within 15 mins then you can assume the session has ended and delete the session.

Al Capone
02-15-2006, 05:27 AM
thanks for the reply :)

would anyone be able to tell me how to accomplish this

thanks :)