cntr.cpp (cntr.exe)
CGI application example
Simple counter for Internet pages

I am not a master of explanations so if
You have trouble with understanding this
description just look inside source file
(cntr.cpp). With some knowledge of C++
it can self-explain all.

When You have cntr.exe (after compiling source
or after downloading exe from author`s website)
You need to place it into /cgi-bin/ of Your
server. Place there also these files:
1.dat
1.report
count.gif

To have the counter on web page just place
there following code:

<script language="JavaScript"
src="/cgi-bin/cntr?cid=1&chto=c"></script>

If counter besides on separate site
use code with absolute URL:

<script language="JavaScript"
src="http://THE_SITE/cgi-bin/cntr?cid=1&chto=c"></script>

where THE_SITE is site host name or IP.

To view current statistics go (in browser)
to following URL:
http://THE_SITE/cgi-bin/cntr?cid=1&chto=v

You can have more than one counter. To do this
just create text file, name it <cid>.dat
(where <cid> is equal to cid parameter in URL
and has meaning of counter`s ID)
and [optionally] create file <cid>.report
Note that currently size of <cid> is limited
to 2 characters (look at source and think
why). Please use digits and/or Latin letters
in <cid>; it is case-insensitive (cause
Windows file system is case-insensitive).
E.g., for cid=a7 You create a7.dat (and place
there one "0" digit in any text editor),
create a7.report (and place there HTML code
of report page template);
after this You can use new counter ID
in URLs; so to view this new counter statistics
go to http://THE_SITE/cgi-bin/cntr?cid=a7&chto=v
Caught idea?

Program outputs "Pragma: no-cache" directive
in responce headers so You need not worry
about caching.
But for those who want more robust code
(for strange-proxies-compatibility) there`s
this:

<script language="JavaScript"><!--
document.write("<sc"+"ript language=\"JavaScript\" "+
"src=\"http:\/\/THE_SITE/cgi-bin/cntr?cid=1&chto=c&nc="+
Math.floor(2000+Math.random()*10000)+"\"></sc"+"ript>");
//--></script>


If You change C++ code here`re some hints for You.
By changing some definitions of variables You can
easily customize application. These variables are
outlined in code by comment as "Option variables".

Keep in mind that counter`s picture URL specified
by counterPictureURL variable MUST be given
relatively to root of counter`s server (not of
"countered" server!) and begin with forward
slash character.
DO NOT ENTER ABSOLUTE URL in this variable!