An active user is a user who requested a document in the last X minutes.
So, all you need is a way of identifying a unique user, and storing that
information somewhere.
The sessionID pretty much identifies users,
so you could make a function that is called at the top of every page.
This function would check the sessionid, and update a Last_visit counter in a db table or whatever.
Then when you want to print the number of active users you simply count how many entries you had that are not older than X minutes.
(You might want to remove all entries that are older than X minutes or your list will grow quickly)
Another way could be to look at the webserver log, but with some logs growing well into the Gbytes these days, that seems like a job for "stirdy-server-man"