###################################################################### 
#
#     Dream Catchers CGI Scripts               Feel free to modify 
#     Created by Seth Leonard                  needs, but please
#     for Dream Catchers Technologies, Inc.    keep this portion so
#                                              that I get credit.  
#     http://dreamcatchersweb.com/scripts      The same goes for 
#                                              distribution.
#
#     (c)1996/1997 Dream Catchers Technologies, Inc.,
#     All Rights Reserved
#
######################################################################
Dream Catchers Technologies, Inc. provides this script free of charge.  However, if you do use this script, a $1.00 donation is appreciated to help support this free resource.  Please send $1.00 to:

Dream Catchers Technologies, Inc.
P.O. Box 8600
Kirkland, WA 90834
(make payments payable to Dream Catchers Technologies, Inc.)

Step by step instructions for Simple Counter

CONTENTS:

counter.cgi - the cgi script which operates your counter program
counter.txt - a file keeping track of how many visitors you've had
readme - this file
0.gif..9.gif - image files that can be used to display your count

Follow these easy steps:

**********************************************************************
** THIS SCRIPT REQUIRES SERVER SIDE INCLUDES, PLEASE MAKE CONTACT   **
** WITH YOUR SERVER TO MAKE SURE THAT YOU HAVE THIS OPTION!!!!      **
**********************************************************************

1.  Contact your server.  Ask them to create a cgi-bin directory for you.  Also ask them how one can access a file in that directory from WWW.  Usually this is "http://www.your_server.com/cgi-bin/your_name/filename".

2.  If you have direct access to your server, log onto your server (Telnet access to your server).  At the command prompt, type "which perl".  Write down the line given to you.  Usually this is /usr/local/bin/perl.  If you do not have a direct connection, ask your server where the perl program resides.

3. If you plan to use graphics to display the counter numbers, then you need to get or make 9 graphics files.  I have included a set of 9 and more can be found at http://www.digitmania.holowww.com.  Any files you use must be labled 1.gif or 1.jpg, 2.gif or 2.jpg, etc...  Basically, make/get a graphic for numbers 0 - 9.  I suggest making a "counter" directory in you html directory (usually public_html).  Put the images as well as counter.txt (came in the zip file) in there.

4.  Open the counter.cgi file included in the files you downloaded from Dream Catchers CGI Scripts page.

5.  The first line of counter.cgi has the line: 

#!/usr/local/bin/perl

If the line you recieved from your server when you typed "which perl" is different, replace the one there.  Keep the #! and don't change anything if it is the same one you were given.

6.  Find the section that says "ONLY EDIT THIS PART OF THE SCRIPT" and change the vaiables so that the match your home directory.

NOTE: The values already placed there are examples!!  You need to change them to match your directory structure.

For example:

$pathtocounter = "/home/you/public_html/counter/counter.txt";

you would change to:

$pathtocounter = "/home/sethro/public_html/counter/counter.txt";

You can change the values of:

(1) $number_of_digits

This is the number of digits you would like displayed from your counter.  

If you would like to have the counter display the number of digits in the count (for example 100 would have 3) then make the line look like this:

$number_of_digits = "";

If you would like to have the counter display, say, 4 digits in the count (so a count of 100 would look like this: 0100) make the line look like this:

$number_of_digits = 4;

If you set the counter to less digits than the count, the count will keep track of the real count, but only display the number of digits you chose.  For example, if you set it to 3 digits and your count is 1000, your counter will display 000.

(2) $end

This is the file ending for the graphic files that you are using.  I assume this is either gif or jpg so your two options are ".gif" or ".jpg"

(3) $pathtocounter

This is the path to the counter.txt file (which keeps track of your hits).  Again, I suggest that you put this file in a "counter" directory in yout html files directory.

(4) $pathtoimages

This is the path to the directory holding the number images.  This can be a url path (http://www.something.com/you/counter/) but you can use the relative path.  For example, if you are at http://dreamcatchersweb.com/scripts/main.htm and the images are in http://dreamcatchersweb.com/scripts/counter/ then all you need to do is type counter/.  NOTE: If you are using the counter in more than one directory (ex. ~you/ and ~you/info/) I would suggest using the full url of the image path!  ALSO: YOU MUST HAVE A / AFTER THE DIRECTORY NAME!!

(5) $graphics

Do you want the counter display to be a graphical one or just text?  If you want graphics, you need to have 9 numbered graphic files and to set this value to "yes".  If you just want text, set the value to "no".

7.  You are done changing this file.  Save the file as counter.cgi, or any other filename ending in .cgi.  NOTE: The file can also be saved as counter.pl if your server prefers this.

8.  Set the value of counter.txt.  It is currently set to 0.  What ever you set it to will be the starting value for your counter.

9.  Create an HTML page.  Do this like a normal page, designing it how you would like page to look.

10.  In the place you would like to have the counter, use this tag:

<!--#exec cgi="/cgi-bin/you/counter.cgi" -->

/cgi-bin/you/counter.cgi is the path to your counter.cgi file on your server.  So /cgi-bin/scripts/counter.cgi would take you from http://dreamcatchersweb.com/scripts/file.htm to http://dreamcatchersweb.com/cgi-bin/scripts/counter.cgi.  NOTE -- EACH SERVER SETS UP SERVER SIDE INCLUDES DIFFERENTLY, CHECK WITH THEM TO SEE WHICH PATH IS CORRECT.

11.  Warning!!  If you view the html file off-line (from your hard drive), the counter will not appear!  It needs the server script to be able to bring in the correct information.

12.  Save the file as anything.html (any name will do).

13.  Upload all .cgi and .txt files into your cgi-bin and .htm or .html files to any directory that can be accessed via the web (many servers require that you upload these types of files in ASCII format, check with your server administrator to be sure).

14.  You now need to set the permissions of the files you've uploaded.  You can do this one of two ways.  

	1. TELNET - telnet into your server and go to the directory which holds the files.  Type chmod [permission] filename.  For example: chmod 755 file.cgi.

	2. FTP SOFTWARE - you'll need to find out how to change permissions of the files using your specific program.  Using WS_FTP (recommended), select the file you want to change permissions of and click your right mouse button and select CHMOD (UNIX).  A box will appear with the option to select any number of 9 separate boxes (top row for read, middle row for write, bottom row for execute).  These translate into actual unix permissions.  If the file needs to be a+rx or 755, select every read box and every execute box (that is every box on the top and bottom rows).  If the file needs to be a+rw or 666, select every read box and every write box (that is every box on the top and middle rows).  These are the only two permissions you need to worry about.

The files included need to following permissions:

counter.cgi  a+rx or 755
counter.txt  a+rw or 666

If you have telnet access, you can also check your scripts for errors by going to the directory they reside in and typing either perl filename.cgi or filename.cgi (depends on your server).  If you get an error, you most likely edited the script where you shouldn't have or forgot to put a " or ; on one of your variable definitions.

15.  Load the page from the internet, and see if you have a counter.  Use RELOAD to add to your counter.

16.  If you want a counters that are specific to each page, you will need to create multiples of the files included and save them with different names. 

17.  Smile, you're done...

All working?  Great!  You now have a Rotating Link.  If there are problems, please consult http://dreamcatchersweb.com/scripts and chose the Frequently Asked Questions option.  You can also post a message on the User Forum asking for help from other users.  Please do not send email, it WILL NOT be answered.  I apologize for this, but there were just too many requests to be able to offer quality help for all as well as work on new projects.

