@SyCoDec 14.2007 — #No not by IP that will only tell you where they are not when. You can track timestamps against ips, or set a cookie and track that against a timestamp. With IPs you can't be sure the IP wasn't re-allocated to another DHCP customer giving you false results. If users log in then track their userid against a timestamp. Personally if I don't know who it is because if there not logged in, then I just track session ids which gives me all the data i need.
So if by currently active you mean users currently on the site then you can record timestamp and session ids into a database table when a user arrives at the site. Either change session auto start in the PHP.ini file or add session_start() to the top of every page you wish to track users in. Create timestamps using time(). Update the timestamps when the users visit a new page. Have a script that runs every x minutes via cron (or schedule task on IIS) that removes old time stamps.
The nice thing about this is you can watch users move through the site in almost real time. If you decide not to delete the users data you set the session ids in one table and relate another table to record the URLs and timestamps. you can set a flag 'active' to 0 against the session when you consider them inactive. You then have loads of data to analyze how users move through your site (when where and for how long) and can tweek your site to better serve them.
The basic principle is record the time since last active and have a auto timed script that runs every x minutes/days/weeks or whatever. Anything longer than an hour (usual session life) will need cookies or a login requirement.