Number Users Currently Online
This code uses a database to check the number of users that are online within a current time period.
http://phpsnips.com/22/Number-Users-Currently-Online