Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Keeping a Count:
Counting Online Users
Oct 07, 2002 @ 12:37:51

Well, back on the 4th, apparently DevArticles.com slipped another one past me without me noticing - but here it is, just for all of you. If you've noticed, there's a box down on the side of this site that allows you to see how many people are "online" right now. It works with a database and tracks various things for me, but that's not the only way it has to work.

This article from DevArticles.com talks about yet another way to make a script that will count the users on your site. This version, though it requires you to use sessions on your site (and who doesn't these days?), is much simpler and doesn't require a database. It simply counts the number of session files currently active on your machine and reports that number.

There's both advantages and disadvantages to this approach, mainly that you have no way of knowing or targeting the users - they're just faceless files. Of course, they give you all of the code and how to test it out, so you can just drop it right into your application/scripts....

tagged:

Link:


Trending Topics: