# Welcome to the LogCount

Welcome to the www.dtp-aus.com Counter and Log Viewer scripts.

IMPORTANT INFORMATION THAT MUST BE READ IF YOU WANT TO USE THESE SCRIPTS

The scripts "LOGCNT.CGI" and "LOGLOOK.CGI" written (and (c)) by Ron F Woolley, Melbourne Australia. Copyright 1998 '99 2000. These free-to-use scripts can be altered for personal use, BUT
ALL COPYRIGHT NOTICES must remain in the code, and visible on all output pages,
AND ALL of the header notices MUST REMAIN intact as is,
AND using the script(s) without first reading the README.HTM, is prohibited.

Australian copyright is recognised/supported in over 130 countries
per Berne Convention and other treaties ( including USA! )

The scripts and associated files remain the property of Ron F Woolley/HostingNet.

> NO PROFIT what so ever is to be gained from users for supply of these scripts for the use of these scripts, except that a reasonable minimal charge for installation may be allowed if installing as a site developer, for a user on the users site that is not on / in the developers domain OR site... remote hosting NOT allowed.

> This programs must NOT be used for multiple LogCount users on one site/domain
> and the program/resources must not be supplied as a remote service.

> Ron Woolley, the author, MUST be notified via the addresses/URLs below
> if any monetary charge is applied for the installation of these scripts.

> NOTE: If you use these files, you do so entirely at your own risk, and take on full responsibility for the consequences of using the described files. You must first agree that Ron Woolley / HostingNet, the only permtted supplier of this and/or accompanying files are exempt from any responsibility for all or any resulting problems, losses or costs caused by your using these or any associated files - even if problems are known.

If you disagree with any of these requirements,
you must immediately destroy all files.

Although this program script is free to use, if you use it and find it useful, a donation to help continue this support and keep new scripts / upgrades coming would of course be appreciated.
On line Visa / MasterCard payments are available for donations and low cost installations.

For INTERMEDIATE installation experience....
.....Help / Advice information is available at:
  http://www.dtp-aus.com/cgiscript/scrpthlp.htm
Files from:
  http://www.dtp-aus.com/cgiscript/cntscrpt.shtml
An outline of all dtp-aus scripts is at:
  http://www.dtp-aus.com/cgiscript/allcgi.shtml

These files can only be obtained via the above web addresses, and
must not be passed on to others in any form by any means what so ever.
This does not contradict any other statements above - & ensures user obtained the latest.

• DESCRIPTION • VARIABLES • INSTALLING • TAGS • • LINK COUNTING • LOGLOOK • UTILITIES •

NEW** Version 3.8, February 2000; NEW and CHANGED: **Changed
check every few months for upgrades

Like all other dtp-aus.com free programs, LogCount is a fully working program for webmasters, and not a common "play with and plagiarise" free script as found on many sites...
available / continuously developed for more than 15 months supporting webmasters.

History....
1. v2.0 The auto creation of count and log files has been removed because of the possible temporary loss of access deleting file contents. The empty files are now supplied in the zip file (see 3).
2. v2.0 If your server does not supply 'REMOTE_HOST' info, the counter script now attempts to create this info from the local Domain Name Server.
3. November ’98 vrsn. 2.0 to 2.1
- included free utility SSI script for inserting text counts of counted hyperlinks into SSI HTML pages. (instructions in file, somename.cgi)
- included utility set up script for creating directory structure, files and chmod permissions (makedir.cgi).
4. v3.0 The 'referrer rejection' option did not work at all and had been overlooked. This version fixes that with a very minor change to the $rjct variable values (see 'Rejecting Specific Addresses' below), and corrected code in the logcnt.cgi script. Also added to LogCount is the ability to show a static digital clock or time display (hours and minutes). The clock can be used for display only, or used as the counter adding to the log etc.
v3.1 Minor change that now uses the character "n" in place of "C" to display the time WITHOUT counting. This is necessary for non case-sensitive servers.
5. v3.3 Changes to the date / time routines September '99.
6. v3.5 Major additions to LogLook plus minor changes to the LogCount program and config files October '99.
7. v3.5b Only a week or so after releasing v3.5, the supplied utility SSI program has been upgraded to two SSI programs. "linkname.cgi" that displays just a hyperlink count total as text, and "linkcount.cgi" that displays both the counted hyperlink tag and the hyperlink count total as text. see below
3.5c = minor addition to LogLook counted-link tag generation

8. v3.8 Changes to the config files (LogLook now has its own config file). Ability to display and count individual page counts while still updating the site count and log! Major enhancements to the free LogLook viewer. All page names logged with their directory name (if in a sub dir off the root). Use one of three display methods for SSI counters - display blank (hidden), or Text, or Images! Two new "require" sub routine files to trim the counter program.

Low cost installations can be carried out by the author; see program page for details link.
This program is written to be compiled by Perl versions 5+ on Unix servers

MENU

ABOUT

Six programs are supplied. LogCount the counter, LogLook the very unique basic log viewer, two utilities to help you install the program, and two utilities some may find handy to SSI imbed activated counted hyperlink totals, or link and totals, in ot SSI activated pages

This "About" section plus the other detailed sections will cover all the options available to you for your site. However here is a list of things to look for:
• Leading Zeros control
• Hidden img tag counter
• Visible img tag counter/display
• Visible img tag NON counting display
• Display Time counter
• Display Time NON counter
• SSI Hidden counting
• SSI Text Display counting
• SSI Img Tag Display counting
• Visible SSI Displays with/without leading zeros
• Page Counting Display while still adding to site log AND site counter
• Keep count totals of Clicked Hyperlinks of special interest
• Generate ALL counter and activated named link tags - simple copy and paste!
• visually track visitors page accesses
• view most popular pages
• view browser type comparisons
• view total unique IP#s and pages-viewed averages
• view above for any date retained in the current log
• view IP# page totals for any date in the current log

So, you can use the lot or just one of those options. But you can see why you get such a large help page as this one.

Version 3.8 includes some important set up changes and enhancements to LogLook and a new page counting option - LogCount is a proper site counter - see history above.

v3.5 LogLook included administrative options for creating, editing, resetting, and deleting counted hyperlinks. The tag for any counted hyperlink can be readily generated for a simple copy and paste in to web pages. The tags for all counter methods can also be readily generated via LogLook for simple copy and paste in to web pages, plus several other setup options can be changed.

pre v3.3 UPGRADE
Pre version 3.3 users will find several new variables in the config file. Also note the renaming of both the config and GMT files. If you are using other dtp-aus.com programs sharing the "sets" sub directory, either rename the gmt file reference in those other programs or change the new file name. This has occurred because gradually all programs will be using require files with the extension ".pl". The new LogCount and LogLook programs can upload over v3.3 - unless the previous have been altered... and I cannot help.

Once installed
It is strongly suggested that LogLook be the first program to test. The simple mistakes often made in setting up counter tags can be misleading and many inexperienced people assume wrongly when fault tracking. By using LogLook first, once it works and options can be changed, or even if the error reports inbuilt are generated, then most of the installation can be then be assumed as correct and later counter tags can be looked at with more confidence.

Then install the webmasters access page even if not going to use the supplied one! This includes a couple of NON-counting visible counters to check paths etc. All digits should show zero unless you manually add a count to the count file - see variables below

PROPERLY SET UP the programs CANNOT be accessed from remote pages containing links to them OR a browser command line - this is a first level security feature and INCLUDES YOU!

All relevant files are supplied in one compressed .zip file that includes the recommended directory structure. It is assumed that the .zip file has been uncompressed to the directory structure included in the .zip file on your local pc before proper FTP uploading - keep perl programs away from MSFrontPage and other site posting wysiwyg editors!

You MUST alter all reference to "yourdomain.name" in the config 'require' files plus the webmasters page, and change the configuration variables, as described in this Readme text. Also set up the paths and URLs correctly in both program config files in the sets directory (the "sets" directory is used by all dtp-aus.com programs and will achieve even greater importance in the near future - currently the GMT config file is accessed/can be changed by all dtp-aus.com programs ie one change upgrades all programs!).

Firstly, a few explanations. LogCount does not use in-built count images, allowing you to use any counter image "sets" that are readily available via the Internet. These sets must include 10 images, displaying 0 - 9, and when placed in the appropriate directory (folder), they must be named or renamed "0.gif" through to "9.gif". *Note* The clock option, if used, requires conversion of any of your current images to a full colon ( : ) named "-.gif", an image displaying "am" named "a.gif", and one displaying "pm" named "p.gif".

Both of the supplied image sets have been updated with these images (to display the clock on any page, see "Displaying The Clock" below).

Extra server resources are not called upon by calling additional "on call" programs that create the images. The only loss here is the ability to add "pretty" borders to the count display. Logcount, and Loglook scripts are designed for conservative tracking and analysing visitor trends and page popularity etc, so it is suggested that the majority of pages only include the simple "Hidden Counter" options. Small conservative light and dark background count images are supplied.

Please NOTE:
If you install and use this script, please contact us at logcountreport@dtp-aus.com with server type detailsand how the script installed and worked etc, for a report base assisting others. ( a vote at cgi.resourceindex.com - via red form on the LogCount program page - or any other cgi links site would also be appreciated to help "spread the word" ) Thank you.

MENU

For INTERMEDIATE installation experience - Help / Advice information is available. CONFIGURATION VARIABLES in DETAIL

NOTE: these variables are now spread over two config files but are all covered below!

INCLUDED or REQUIRED FILES
The Perl language allows the inclusion of extra files containing libraries of commonly accessed sub routines or common lists of script variables etc. The scripts logcnt.cgi and loglook.cgi together "require" four such files. One includes a variable used by the date/time routines and the other contains the "user" variables. In case I get a few more scripts prepared and available for general use, I have included the GMT reference variable in a separate file as used by all my scripts on dtp-aus.com. If I need to change this common variable, then I only have to change one file, not many.

SSI IMBEDDED SCRIPT CALLS
If you wish to place a simple "hidden", "text", or "image" count on your page, and your Host service allows SSI (Server Side Includes) calls, then the inclusion of one simple SSI call to the script will perform this task. Place the call in the text of your html page where you want it to appear ie:

"<p>Current site count is <!--#exec cgi="/cgi-bin/logcnt.cgi"--> page views.</p>" and the result could be:
'Current site count is 02365 page views.'

$ssi_img Which of the three display methods depends on the $ssi_img config variable.

LogCount recognises an SSI call and responds accordingly. NOTE: Most servers require the HTML page file extensions of ".shtml" or ".sht" for SSIs to work. NOT all servers allow SSI to receive external data for very good security reasons, Although some simple SSI programs rely on that, LogCount does not and is designed to work without!

Comments about relative paths and directory choices etc are included below.

GMT TIME ZONE reference - NOTE: this value can be set easily from the LogLook admin pages
Like myself with www.dtp-aus.com, Hosting services are being used now that are "remote" from ones local ISP service. Normally this means that all of our scripts etc report dates and times different to that of our local access points, ie our home locality from where we view our sites. To overcome this I use a Perl facility that allows us to use (G)reenwich (M)ean (T)ime with an offset reference reporting in my local time and date. One of the perl "Include" files, 'gmt.set', contains a variable name -
$gmtPlusMinus
- whose value MUST be set for your local GMT offset. I live in a world time zone 15 hours ahead of that of my Host Servers. Therefore, when I set the variable to 36000 (GMT+10hrs), the server logs record, and I view, all dates and times relevant to my locality irrespective of where my Hosting service is. With this method I can move my Domain and the results would not change.

This value can now be changed via the LogLook program. To get an idea of your local GMT zone value, check the "date" set up in your local pc date configuration - ie Windows.

The manual calculation is simple. Your local GMT time, multiplied by 60, and multiplied by 60 again. ie 10X60X60. Therefore my variable entry is "$gmtPlusMinus = 36000". If your GMT zone is a negative value, simply include a negative value ie "$gmtPlusMinus = -36000"

LEADING ZEROs
All displays of the count value will include the standard "leading zeros" method of displaying numbers. The configuration file for LogCount and LogLook is called 'cntcnfg.set'. By adjusting the variable named "$iszeros", you can control the length of the output number. ie
'$iszeros = "000000"' will display 029384, and '$iszeros = "0000"' will display 0087 and so forth. If your site receives a small number of hits per month then it probably looks better with a smaller number of digits. However, never be too pessimistic and allow for growth. ie '00000' will allow the count to proceed up to 99999 without altering your html code calls to the counter, and 000000 will display up to 999999.

The length or number of zeros MUST be matched by the number of <img src... calls and visa versa when using the visible counter options. How you call each digit will be described below.

NOTE: "$ssi_zro" The SSI calls can now be set to include OR not include the leading zeros.

US, BRITISH, or INTERNATIONAL DATE reporting
LogCount and LogLook can save and view logs using the US mm/dd/yyyy format, or the BRITISH dd/mm/yyyy format, or the International date format yyyy/mm/dd. In the configuration file, 'cntcnfg.set', you will find a variable named $dtUS. Leaving this variable value as null, ie '$dtUS = ""' will cause the scripts to use "dd/mm/yyyy". Setting this variable to '$dtUS = "1"' will force 'mm/dd/yyyy'. Setting this variable to '$dtUS = "2"' will force 'yyyy/mm/dd'.

@referers array
CHECKING FOR CORRECT REFERRERS - " Bad referrer, access denied!"
This option in the 'cntcnfg.set' file allows you create an "array" of Domain names and IP numbers that LogCount and LogLook will respond positively to. By including the acceptable calls to your pages and/or your IP#, ie 'http://www.yourdomain.com' and http://yourdomain.com' you effectively stop improper additions to your count and log. However, LogCount saves incorrect referrers to a separate log that you can view from time to time to see if there are any patterns in the list. This is not 100% foolproof, but in most cases you will also be able to detect copied pages from your site that are being viewed on "online servers" elsewhere.
The array is named "@referers" and you simply (MUST) enter your preferences in place of the examples. NOTE: The brackets, quotes and commas enclosing each item must be included else an error will occur, ie:

('www.yourdomain.com','yourdomain.com','000.000.000.000',). Leave out the IP# if you do not have a true domain name with a static IP#. "www.ahost.net/mysite/" etc will also work for second level site calls etc. If your scripts are called from the cgi-bin of a domain that is housing your site and your specific scripts are in that domains cgi-bin, you will have to include the cgi-bin also ie: "ahost.net/cgi-bin/".

NOTE: Even your browser command line AND a copy of your page on your home computer will be blocked by referrer checking. ONLY use links / forms ON your site. This is not just to stop others spamming your counter BUT is a first level security measure should a program have security holes. Use a/the webmasters access page - see below in "utilities" section.

At this point I will bring your attention to the semi colons (;) appearing at the end of
each line in the config files. These MUST remain else an error will occur.

REJECTING SPECIFIC ADDRESSES
If have the need to reject certain domains or IP#s from adding to the count, the variable named $rjct in the 'cntcnfg.set' file must include them. Unlike an indexed array, this is a simple variable that will be searched for items INBETWEEN the important ( | ) separators. NOTE: There is now a required vertical bar character ( | ) at the beginning AND end of this string.
I have left an example string in the variables value, to show the separators, but you can leave this as a null value. ie $rjct = "". Remember, if you include a server address in this variable, then ALL visitors from that server will not be counted - a large company, ISP or university will have many computers that could access your site through that one server address.

PATHS TO FILES ACCESSED BY SCRIPTS
The defaults used in the 'cntcnfg.set' file assume you will place these files in your cgi-bin and add a directory to it called "counters". If you have to use other directory names, or your "cgi-bin" has a different name, then you will have to change the paths accordingly; "cgi-yourdomain" is not uncommon. There are three path types that can be used at various times with in a program or script. A full URL is the same as the path you enter in your browsers address box when typing in a site path that you wish to go to: ie 'http://www.wooz.com/harry.htm'. A relative path is a path description to a source, relative to the directory of the program, file or web page that is calling it: ie "jimbo.htm" means that the file being called should be in the same directory. "inone/jimbo.htm" refers to a file that should be in a directory named 'inone' which is a directory within the current directory, and "../jimbo.htm" means that the file should be in a directory one above the current directory, and "../../jimbo.htm" is in a directory two above etc.

For some servers, a simple relative path called by a script is unacceptable, so a path relative to the sites root directory must be called. There are also variations to this description but "web/yourdomain/yourdirectory/jimbo.htm" (example only) is a relative root path description that works on many servers. Another root path is "/home/yourdomain/www/yourdirectory/jimbo.htm". If you have trouble with accessing the default simple relative paths included in the 'cntcnfg.set' file, try the root reference ie "web/yourdomain/cg-bin/counters/hitcount.t" etc. If this is still a problem, look in any installed scripts on your server for a reference, or contact your hosting support staff and send them the 'cntcnfg.set' file.

NOTE: Double check ALL permission's (below) before changing the default paths, unless you know in advance what the paths should be.

CONFIG FILES PATHS - program code AND config files
The programs need to load the config files. Admin editing also needs a reference to the three config files, cntcnfg.pl and gmtset.pl. Near the top of BOTH program's code just below the header info are paths that must be set before installation.

$gmt_url and $lookcfg_pth are also the variables needed for this purpose in the config files.
NOTE: the LogLook config file includes the "$lookcfg_pth" variable and the LogCount config file includes the "$gmt_url".

RECORDS DIRECTORY AND FILES
These variables direct the programs to the record files. They should be self explanatory and not need changing. NOTE the first is the PATH to the records directory (default relative), the others are the names of files residing in that directory.
$log_path = "counters/"; # - MUST end with a forward slash
$count_name = "hitcount.t";
$log_name = "hitlog.t";
$lnks_name = "hitlnk.t";
$badlog_name = "hitbadlog.t";

DEFAULT PAGE NAME
$def_pge = "index";
When the counter or LogLook viewer encounters a referrer not including a page name (ie "http://yourdomain.name/") this value will be appended. Without an extension it will be distinguishable from the other directory default pages.

Left empty only the directory name will be logged/displayed - LogCount now saves page names WITH their directory name also!! ie:
/
wally/
wally/page.name
even a multi level directory will be displayed as above - reducing viewer distortion from long URLs.

IMAGE SIZE
To generate the tags for you for all the counter methods, LogLook needs to know the image width and height of the bitmaps used to display the count or time. The value of $iwid is the width set to the default images, and the value of $ihgt is the height also set to the default images. Change these only if you decide to use other images.

IMAGE DIRECTORY
LogCount can now access and read/send images from the default "counters" sub directory of the cgi-bin OR now access images from an HTML Docs directory. One or two servers have been reported to get cranky when opening/sending images so this option has been added.
$img_url = "counters/"; - PATH - with forward slash
OR
#$img_url = "http://yourdomain.name/ssi_img/"; - URL - with forward slash

Place a hash character ( # ) at the beginning of the option you do NOT wish to use.
NOTE: the URL option should be set to the same directory as the SSI Images directory - see next variable description.

SSI IMAGE DIRECTORY - value = a URL
$ssi_url SSI counter displays have to be written as a URL to the images - embedded in the pages HTML code - so this is the url to those SSI images. NOTE: this should be the same as the "URL" option in the previous description UNLESS you want to use two different image sets.

LOGLOOK BAR GRAPHS - do NOT change these variables
Version 3.8 of LogCount included major enancements to the free LogLook log viewer and admin program. The first page that should be accessed via the password entry in the webmastres page should be a list of all current log pages listed from most popular down. With this list each page name is also accompanied by a simple but affective bar garph for easy visual comparison. These are the file names of the graph images AND they MUST be in the SSI HTML Docs directory.
$grf1_url = "$ssi_url"."grf0.gif";
$grf0_url = "$ssi_url"."grf1.gif";
NOTE the URL includes the previous variable!!

SSI COUNTER DISPLAY TYPE
$ssi_img Adding more versatility to LogCount, SSI counters can be preset to one of three styles.
They are:
HIDDEN
NUMBER
IMAGES
Preset this value at installation time (or change at time afterwards!)
NOTE: the visible options, "number" and "images" can be enhanced by including leading zeros just like the main standard counter by setting the "$ssi_zro" variable to "1".

RETURN PAGE URL
The value for the variable named "$hm_url" in the 'cntcnfg.set' file needs to be altered to include the FULL URL Path to your home page or any page that you wish to return to after using the LogLook script to view your log details.

LOGLOOK.CGI URL
The value for the variable named "$logScrpt" in the 'cntcnfg.set' file needs to be altered to include the FULL URL Path to the loglook.cgi script (the viewer). It is suggested that the scripts be placed in your cgi-bin or equivalent.

LOGCNT.CGI URL
The value for the variable named "$countScrpt" in the 'cntcnfg.set' file needs to be altered to include the FULL URL Path to the logcnt.cgi script (the counter). It is suggested that the scripts be placed in your cgi-bin or equivalent.

WEBMASTERS E-MAIL ADDRESS
The LogLook script includes various errors that can be reported back to you via an html page. Although it is expected that only you will use the counting facilities, I have included the webmasters address in some of these hyperlink error reports. Probably of little use in the current versions, but change this address to yours or your webmasters if you are not he/she. ie
'$webmstr = "webmaster\@yourdomain.name?subject=Link Error"'.

NOTE: The backslash ( \ ) is very important for Perl 5 users. All string references that include the (@) character must insert a backslash before that character.

DISPLAY LAST 7 DAYS
The value for the variable named "$shwDays7" in the 'lookcnfg.set' file enables the last 7 days display option from the LogLook viewer. If you do not have a high daily hit count and yet keep a large log file, then you can try using the 7 day list view option by setting the value for this variable to ("1"). On the other hand, you just may be cooking AND eating dinner while your server attempts to send back the possibly gynormous (big) html file. Therefore, '$shwDays7 = ""' diables the option, and '$shwDays7 = "1"' enables the display of the last 7.

Note With the supplied and useful LogLook viewer, you can change this value via an admin page.

Note v3.5 Also with the supplied LogLook viewer, you can now delete entries as the log file gets too large. Around midnight Saturdays is a good time to prune or delete files.

SHOW DOMAIN NAMES
LogCount records the domain names as well as the IP#s (referers) for each access. However, not all hosting servers enable this option, resulting in the IP# and the domain name being just an identical IP number. The value for the variable named "$showDoms" in the 'cntcnfg.set' file can disable the duplication of IP#s in the daily log list displayed by LogLook. '$showDoms = ""' disables their inclusion, and '$showDoms = "1"' will display them.

PASSWORDS
You MUST include a basic password-only access to the LogLook script by entering your unique password to the value of the variable named "$theword". The default is "log". Change it to suit.

$pwrd_name the name of the Admin Password file written to by LogLook admin.
The use of LogLook can be protected from others by a basic password method that requires that the password be included in the call to the script. Also, once you have accessed the main page the password is imbeded in the html so that you can jump between the two main pages by hyperlinks. If you are generally the only user of the computer you access the log with, then this is a simple answer. However, you must remember that Browser Cache can keep copies of your pages, and even worse is the History folder that records all page access calls. So editing of options via LogLook is protected via a further "admin" editing password you must create when the LogLook program is first run.

Although I have included the "no-cache" meta tag in the pages generated by LogLook, and a "WebMasters" access page that you can add other utilities to also, the only sure-fire way of protecting access to any web page (unless your host server is hacked) is to place the webmasters access page in a server controlled password protected directory; most decent host services will supply one for you for free, often named "secure" (except perhaps the 'Free Web Page' services).

MENU

INSTALLING

THE PATH TO PERL
At the top of each script (and must remain as the first line) is a default path to the Perl program on your host server. This can vary slightly between UNIX servers. If you have problems running the scripts, check with your host support staff about the correct path described in this line. The default entry is "#!/usr/bin/perl" and another common variation is "#!/usr/local/bin/perl". In Perl scripts the hash sign "#" character comments out the code on a line starting with this character. Here it has a special meaning to Perl.

Even if you have installed other CGI programs you are not necessarily an experienced cgi installer. Because a path worked on another program does not mean it is v5+ (5.003+ preferred)!
The scripts help page (URL above) contains helpful advice; if you are humble enough to learn!

LOG AND COUNT FILES Plus PERMISSIONS
LogCount will attempt to create and set permissions on the files it needs for the count, counter log, and bad referrers log. Should your server refuse to givescripts the right to create new files, then you will have to create them your self via FTP or Telnet. The Link List file needs to be created by you because you have to enter the links and their names (see below). Each of these files must be given read and write permissions (chmod 766). The directory that they are placed in will also have to have read and write permissions. Either read and write chmod 766 (r+w) or possibly chmod 777 (r+w+x) will work - try the first before the latter. Note the makedir comment below if using makedir.cgi to setup quickly.

UP LOADING FILES (Posting)
CGI-BIN permissions are set by the server and no attempt should be made to change them. Should you have to use another directory, AND your server allows the execution of Perl CGI scripts in other directories, then that directory should be set with read and execute permissions - chmod 755 (r+x). Also, The scripts and 'require files should be set to chmod 755 (r+x).

By far the biggest problems faced when installing scripts are firstly the file transport encoding used and secondly the permissions settings set for both files and new directories. Bitmap images must be sent to the server using the "Binary" protocol. Text files, ie html pages, CGI SCRIPTS and require files, MUST be sent in "ASCII" format. Failure to do this will result in a server failing to recognise and execute the scripts. Although often referred to as programs, scripts must be compiled before they do anything. As an example, files with the .EXE extension on programs that are installed on Wintel machines are pre-compiled binary executable programs. Perl scripts on the other hand are compiled in memory by Perl before they can be executed. The script (text) must be in ASCII text format for the interpreter to be able to read it.

REPEAT: Up load scripts as "ASCII" files, images as "Binary".

So, assuming the default directory structure is used, you will up load into:

> Directory:
> cgi-bin (server)
>   logcnt.cgi, loglook.cgi (chmod 755)
> cgi-bin/sets (chmod 766 or 777)
>   cntcnfg.pl, lookcnfg.pl, gmtset.pl (chmod 766 or 777)
> cgi-bin/counters (chmod 766 or 777)
>   hitlnk.t, hitbadlog.t, a_dolink.pl, a_errlog.pl, look.pwd (chmod 766 or 777),
>   hitcount.t, hitlog.t, trans.gif, images(0 to 9 + a,p,-).gif (chmod 766 or 777)
> html page directory ( named "ssi_img" )
>   images(0 to 9 + a,p,-).gif, grf0.gif, grf1.gif, [ trans.gif ? ]
> html page directory - preferably secure
>   webmster.html (server)
> If you have to create them yourself:
> cgi-bin/counters
>   counters/hitcount.t (chmod 766 or 777)
>   counters/hitlog.t (chmod 766 or 777)
>   counters/hitlnk.t (chmod 766 or 777)
>   counters/look.pwd (chmod 766 or 777)
>   counters/hitbadlog.t (chmod 766 or 777)

MENU

TAGS CALLING THE COUNTERS

NOTE: the complete set of counter call tags are generated by LogLook Admin.

INSTALLING COUNTER CALLS IN HTML
If you can follow the above example of a call to LogCount for a link count, then the general counting and display calls are even easier. Remember the "l" (lowercase "L") refers to a link count.

To call a HIDDEN COUNTER - the most common use for LogCount - you include the letter "t" instead of the "l", ie:

<img src="http://yourdomain.name/cgi-bin/logcnt.cgi?t" width="1" height="1">

…and there is no "=**" value needed. The "t" stands for transparent, and there is a tiny transparent GIF file supplied in the default 'counters' directory. When the page is accessed, the server sends the 1X1 pixel image to the browser and records a hit. It is best to place the counter call near the top of the page to ensure the hit is recorded before the visitor goes to another page.

The next VISIBLE COUNTER option requires as many "img src.." tags as there are images to display (numbers). If you want the counter to show five numbers including zero padding (if any), then you simply repeat the tag five times and change the query character in each accordingly ie:

<img src="http://yourdomain.name/cgi-bin/logcnt.cgi?0" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?1" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?2" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?3" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?4" width="13" height="17">

The query tag is a number, 0 to (1 less than the total images), where the total number of images equals the length of 'zeros' configured in the 'cntcnfg.set' file. If you have less image calls than the zero padding, then you will only see the left-most numbers of the count. If you have more the script will return an error because it will look for a digit that does not exist.

To VIEW THE COUNT WITHOUT RECORDING A HIT
Repeat the img tags as above, BUT change the query letter on the first imag tag to "v" (view) ie:

<img src="http://yourdomain.name/cgi-bin/logcnt.cgi?v" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?1" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?2" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?3" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?4" width="13" height="17">

Only the query characters "t" and "0"(zero) will record a hit. Numbers 1 to 7 will simply return the appropriate count character image (a number). LogCount will only! handle numbers up to 8 characters in length. For most of us this would be wishful thinking indeed as that would represent 99999999!!

If you do not understand why I have written the tags with the second and subsequent tags broken after the "<img " name, this is the method used to stop the browser placing one space between objects. You could just write all img src tags out in one long line instead but the above method produces very readable code.

DISPLAYING THE CLOCK
From version 3 onwards the script can be used to show a static digital clock or time display. The time display can also be used as the counter adding to the log etc.

Counting With The Clock
Similar to the normal counter display, the clock is called with "img src" calls, but the number of calls is fixed at 6, and uses two characters as reference. ie:

TIME DISPLAY (number of tags = 6)
<img src="http://yourdomain.name/cgi-bin/logcnt.cgi?c0" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?c1" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?c2" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?c3" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?c4" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?c5" width="13" height="17">

Clock Display Without Counting
To display the clock without adding to the counter or log, use the above code BUT simply change the lowercase "c" to "n".

USING OTHER IMAGE SETS
Correct html coding should always include the width and height attributes in img src... tags. To use other counter image sets, just change the width and height attribute values accordingly. Also make sure the names are (or changed to) 0.gif, 1.gif, 2.gif, 3.gif, 4.gif, 5.gif, 6.gif, 7.gif, 8.gif, 9.gif. DO NOT use .JPGs. NOTE: See the ABOUT section at the top of this page regarding the need for "-.gif, a.gif and p.gif" if you want to use the digital clock with images other than those supplied .

The .zip file includes two extra directories that contain the original default counter digit .gif files. Simply copy either of these image sets in to the "counters" directory or equivalent. The default "counters" directory already includes the white digits on black background images.

Two sample logcnt.cgi counter calls are:

SSI TEXT COUNTER DISPLAY
<!--#exec cgi="/cgi-bin/logcnt.cgi"--> - or similar for your server

HIDDEN COUNTER
<img src="http://yourdomain.name/cgi-bin/logcnt.cgi?t" width="1" height="1">

VISIBLE COUNTER (number of tags = number of zero padding digits)
<img src="http://yourdomain.name/cgi-bin/logcnt.cgi?0" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?1" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?2" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?3" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?4" width="13" height="17">

NO-HIT VISIBLE COUNTER (number of tags = number of zero padding digits)
<img src="http://yourdomain.name/cgi-bin/logcnt.cgi?v" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?1" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?2" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?3" width="13" height="17"><img
src="http://yourdomain.name/cgi-bin/logcnt.cgi?4" width="13" height="17">

LINK TRACKING
<a href="http://yourdomain.name/cgi-bin/logcnt.cgi?l=name">hyperlink</a>

LINK DATA FORMAT (hitlnk.t)
Name|Link|Count (ie "widget|http://www.widgetstuff.com/|0") - also see the supplied sample file.

A Link to the LogLook.cgi log viewer script
<a href="http://yourdomain.name/cgi-bin/loglook.cgi?m=password">View Log Data</a> NOTE: For security, the script can only be called from a hyperlink on a page loaded from your server. Calling it from a remote server or a browsers command line will not work; this is controlled by the security @referers array.

SSI COUNT VIEWS - non counting
Supplied with LogCount and LogLook was a simple SSI program that could be copied and renamed with the name given to a counted hyperlink (ie "widgets.cgi"). As of version 3.5b that one script was replaced by two scripts. "linkname.cgi" works the same as the previous 'somename' in that it displays only the link total for the counted hyperlink it is named after, and now "linkcount.cgi" will display the actual hyperlink tag followed by the count total for the counted hyperlink it is named after.

Because they are SSI programs the SSI call has to be placed in the texts of an SSI html page, ie pagename.shtml, pagename.sht. You have to know if your host service allows SSI HTML pages before using these programs.

So by placing this code calling the linkname.cgi script now copied and renamed barts.cgi (the name barts is the name of a hyperlink created in the LogLook admin pages):
File downloaded <!--#exec cgi="/cgi-bin/barts.cgi"--> times.
in your page when it was loaded you would see
File downloaded 2033 times.
OR
by placing this code calling the linkcount.cgi script now copied and renamed Bonzo-Zip.cgi (the name Bonzo-Zip is the name of a hyperlink created in the LogLook admin pages):
Down Load <!--#exec cgi="/cgi-bin/Bonzo-Zip.cgi"-->.
in your html code you would see
Down Load Bonzo-Zip (284).

You can of course also use the standard hyperlink counting method:
<a href="http://yourdomain.name/cgi-bin/logcnt.cgi?l=linkname">Text</a>
followed by the "linkname.cgi" renaming method:
<!--#exec cgi="/cgi-bin/barts.cgi"-->
to add the count where and how you want. This way you can place it all in the pages texts if the above "linkcount.cgi" method is difficult to include in a manner that makes sense.

So I have included the two utility scripts giving you three SSI counted link options PLUS the standard counted link method generated in the LogLook admin page. Either way for displaying the count next to a counted ink, or just the including the count total in the pages text will work as long as the page is an SSI named and enabled page. Notes for renaming these two cgi scripts are also in the script header.

MENU

COUNTING LINKS

LINK USAGE RECORDS and HYPERLINK CALLS
LogCount can be used to log the number of times visitors use specific hyperlinks on your web pages. Both links from one page to another local page, or links to other sites can be included. The call is a simple change to the "A HREF tag that you wish to track, ie:

<a href="http://yourdomain.name/cgi-bin/logcnt.cgi?l=3">hyperlink</a>
or
<a href="http://yourdomain.name/cgi-bin/logcnt.cgi?l=jimbo"><img src....></a>.

The question mark denotes the start of the query string that follows it. The "l" is a lowercase "L", NOT a numeric 1. The "l" tells LogCount to handle the query as a hyper(l)ink. After the "=" sign is a number in the first example and a word in the second example. I have shown this so you can see that this is indeed a name, and numbers could be used while words could be more descriptive. The name refers to an identical name entered in the Link List file, 'hitlnk.t', that you must configure if using this option.

Also in the examples are two hyperlinked objects, a simple text link in the first example and an image link in the second. If you want your link to open another browser window then include the standard 'target="_blank"' attribute ie:

<a href="http://yourdomain.name/cgi-bin/logcnt.cgi?l=widget" target="_blank">

Note v3.5 The counted hyperlinks can now be set up via the LogLook admin page, plus the tag for each named link can also be readily generated.

I have included an example 'hitlnk.t' file for you to configure and up load to the "counters" directory (default). In this file you will identify four example links, and they include the special "|" vertical line character. The item pattern is as follows: Name|Link|Count, ie
"widget|http://www.widgetstuff.com/|0".
The third item, the count value must be set initially to zero "0". You can configure as many hyperlink click records as you wish, but do not apply them to all of your links just because you can. This is an excellant way of analysing how many visitors leave your site to other sites you link to.

The second page of LogLook will display the count progress of your links. Each listed link shown by LogLook includes an embedded hyperlink to logcnt.cgi allowing you to occasionally check that the call is working and not a broken link.

MENU

LOGLOOK - free LOG VIEWER

There is no need to describe in detail the options/views in LogLook as they are self evident once viewed. REMEMBER you MUST access the program ONLY via a password form ON your site - ie the supplied webmasters page.

Besides the various viewing options, LogLook generates all the necessary tag code for your counters for simple "copy and paste" in to relevant HTML pages (or perhaps a temporary open text file where they can be stored).

LogLook also manages all the creation, editing, and deleting of counted "named" hyperlinks. The html tag code for these links can also be generated once activated.

New views added to v3.8 are:
most popular pages
visitor browser type comparisons
view any date retained in the current log
view IP# page totals for any date in the current log

As your log gets over around 1.4Meg in size (approx. by experinece - some servers will vary) the hit tracking pages may be very slow to load and eventually crash due to server applied "life" time restrictions. Use the admin page to regularly "prune" dates from the log; once viewed, trends noted, days compared, there is realy little need to keep old dates in the log. In the future (partially complete) there will be a history option for those that want to keep a few details but just can't be bothered writing them down!!

MENU

UTILITIES

THE WEBMASTERS PAGE - NOTE: you need this or similar to access LogLook!
The supplied webmasters page includes a form for accessing the LogLook log viewer script. You must enter the correct password in the form on this page to view your logs. This page also includes a current Non-Counting Count display, so the form "action" path and the img src paths need to be altered as instructed.

UTILITY testbin.cgi
I have created a simple utility script that can be placed in your cgi-bin and run from your browsers command line. This script will, in almost all cases, detect the Perl version you are using and report its findings. If it reports version 4 as a default, then you must ask your Host Service for the correct path to Perl 5 (Always top and FIRST line in all scripts). LogCount and LogLook are Perl 5 programs for Unix servers.

Testbin.cgi will attempt to get all perl paths from the server and list them at the bottom of its page. Not all servers will make this information available.

Testbin.cgi can also be used to test your path to "Sendmail". The program will attempt to get this information from the server but not all will make it available. To test the Sendmail path you MUST change the variable value near the top of the code which is the URL to the testbin program!

So!
Place "testbin.cgi" in your cgi-bin directory and chmod 755 (7=r+w+x, 5=r+x).
Then run from a browser command line, ie http://www.yourdomain.path/cgi-bin/testbin.cgi

UTILITY makedir.cgi
I have created a simple utility script that can be placed in your cgi-bin and run from your browsers command line. If your server allows directory creation via cgi scripts, then this utility will attempt to create the default (recommended) directories and file names for you, and set the permissions. It is unprotected and there is no guarantee that it will work; try it at your own risk (disclaimer only). It has worked well on many sites.

Try installing and running this script first. It will report success or failure when creating the files/directories and prove the correctness of your Perl Path", plus indicate that the default relative paths will work OK. If the default urls/paths are not used, then you will have to change them first.

To use it, make sure the "Perl Path" at the top of the script is correct. NOTE: the default Dir/File permissions are set to 766. Change these values to 777 if your site so requires BEFORE running the script. If running the script is successful, you only have to FTP your supplied files over the new empty ones. (note: for security reasons, makedir does NOT prepare an empty file for the cgi scripts, you must upload them (as ascii) and set chmod 755 your self).

777 for sub directories and 766 for files is probably the most common in a well set-up true cgi-bin directory.

Once run, delete the file immediately because it has no input protection and could be run again by some low-life wanting to cause mischief

So!
Place "makedir.cgi" in your cgi-bin directory and chmod 755 (7=r+w+x, 5=r+x). Then run from a browser command line, ie: http://www.yourdomain.path/cgi-bin/makedir.cgi

Enjoy - & please let me know how you get on with this script, how/what server type it installed to.
Ron

MENU