netConsole: Hit Counter
The Hit-Counter is a useful script that allows the webmaster to display on a web page how many users have visited a page. The counter displays on your web-page as normal text which can be configured the same way as any other text.
Setting up the Hit Counter
The Counter is a CGI script that relies on Server Side Includes (SSI) to operate. In order for your webpage to be capable of running a CGI script such as this, you must rename your .html or .htm file to use the file-extensions .shtml, .shtm or .sht. For example, index.html should be renamed index.shtml. Don't forget to re-adjust your links after making this change.
Next, in your HTML source at the location in the web-page where you would like the counter to appear, add the following text code:
The counter can be placed be placed between words or HTML tags, for example:
Welcome, Visitor <b>#<!--#exec cgi="/cgi-bin/counter" --></b>, to our web-site! would look like this:
#42, to our web-site!
You can also use a different text code to add a suffix to the hit number:
You are our <!--#exec cgi="/cgi-bin/counter-ord"--> visitor! would appear as:
You are our 42nd visitor!
Things to Remember
Remember to name the HTML files correctly for CGI compatibility (i.e. .html -> .shtml).
Should the Hit-Counter fail to work properly, we recommend that you delete and re-install it from the netConsole.
- IC Tech. Ref. Document: Using the Common Gateway Interface
- IC Tech. Ref. Document: Server Side Includes (SSI)
- Free On-line Dictionary of Computing's definition of the Common Gateway Interface
- Free On-line Dictionary of Computing's definition of the Server Side Includes
- NCSA's The Common Gateway Interface
- NCSA's Introduction to CGI
- NCSA's SSI Tutorial
- Plenty of SSI Documentation courtesy of The CGI Resource