CGI SYNTAX - CGI and COUNTERS


FormMail.pl - Html form delivery by e-mail

counter.pl - counter with start date
This script allows you to track and display the number of users that visit your webpage.  It is highly accurate.  Of course you can track your most popular pages just by using WEBALIZER in your control panel, but this is another option.  This script uses server side includes which means any webpage it resides on must be called or renamed to end with .shtml not .html.  So if you want to put a counter on a page called mypage.html, the page needs to be renamed mypage.shtml.

counter.pl install:

(1) We can install count.pl into your account at your request.  Just contact technical support.
(2) Alternatively you may install counter.pl yourself.  Very easy.  Doing so is also good practice in how to configure scripts and use your server's cgi systems.  If you would like to try a self-install, which is very easy, then this is the procedure.

  1. Download textcount.tar by clicking on the link.
  2. Upload textcount.tar via FTP (in binary mode not ascii) to your httpdocs directory
  3. Now you have to unpack it

  4. so go into your Telnet SSH shell and run the following command from the httpdocs directory:
    tar -xf textcount.tar
  5. The file will unpack your files.
  6. A new directory has been created called textcounter.  Go to it:

  7. cd textcounter
  8. Here you will see that your counter.pl script is now present along with a few other files and a data directory which will store all user hit information.
  9. Now we need to set some permissions.  in the textcounter directory issue the following commands:
    chmod 777 data
    and
    chmod 755 counter.pl
  10. Now you need to setup the script's variables.  There are just a few.  If you edit it on your computer make sure to download and upload it in ascii mode.  In pico or a pure text editor go into counter.pl
    1. Set the first line of the script to the correct perl path:  
      #!/usr/bin/perl
    2. A little ways down set the data directory to:
      $data_dir = "data/";
    3. A little more down you will see a show link swtting.  You should set this
      to your domain as follows so people hitting on the counter will be taken to your homepage:
      $show_link = "http://yourdomain.com";
    4. Save counter.pl
    5. Believe it or not your done!
    6. You may want to read the readme file for other varible options which you can utilize.
Using counter.pl

Using counter.pl is very easy.  It automatically creates a counter file for every page you put it on!  All you have to do is the following:

(1) make sure any page you put it on is SSI enables, which means its name ends in .shtml
(2) somewhere in that page's code insert the following code where you want the counter to appear: (assuming you are calling it from your httpdocs directory):
<!--#exec cgi="textcounter/counter.pl"-->
(3) If the above is correct you should see a counter the next time you load your page!