magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1997 > 05 > Programming with Perl  

Not Your Father's Visitor Counter

I am not a big fan of visitor counts. They aren't really accurate — proxies and reloads can skew the count. And what does the visitor count communicate to the other visitors? They're either interested in the information or not. You don't hit a Web page, notice that the visitor count is over 22,435, and leave because too many people have been there!

In jest, I've created my "nonvisitor counter" (NVC). Every time someone reloads my home page, a random number from 1 to 99,999 is generated and the appropriate image (or text) is displayed. Aside from humor, this demonstration has little value; however, some of the tricks I used for it are applicable in other areas.

I use server-side includes (SSIs) to implement the NVC. The server (Apache, in this case) scans the document, looking for items like <!--# ... --> and replacing them with other text as the document is delivered to the requesting client (like a browser). The client never sees these lines of code because they don't appear on the browser when you view the source.

The code I edit looks like Figure 1(a), where the hypothetical SSI directive "include virtual" causes the random_visitor_th CGI script to be executed and its output to be inserted in place of the SSI directive.



  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2