###################################################################### 
#
#     Dream Catchers CGI Scripts               Feel free to modify 
#     Rotating Link                            this script to your 
#     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 Rotating Link

CONTENTS:

rotlink.cgi - the cgi script which operates your rotating link program
readme - this file
rotcount.txt - a file keeping track of which link to display

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 telnet access to your server, log onto 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 telnet access, ask your server where the perl program resides.

3.  Find which url links you would like to rotate through.  

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

5.  The first line of rotlink.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!!  We would appreciate you using our pages as links, but of course you don't need to.

For example:

$pathtocounter = "/home/you/public_html/rotcount.txt"

you would change to:

$pathtocounter = "/home/sethro/public_html/rotcount.txt"

Change the values of:

$pathtocounter = the actual path on your server to rotcount.txt.  This is the file that keeps track of which link to display.

$page[?] = a url that you would like to link to.  (You will give the title later)

IF YOU WOULD LIKE TO ROTATE BETWEEN MORE THAN 5 PAGES, JUST ADD THEM.  BUT KEEP THE $page[ ] FORMAT, INCREASING BY ONE NUMBER EACH TIME.

$max = the number of urls you are linking to.  This should be the same number that the last $page[?] has between the [ ].

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

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

9.  In the place you would like to have the rotating link, use this tag:

<!--#exec cgi="/cgi-bin/you/rotlink.cgi"-->Rotating Link</a>

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

"Rotating Link" is the title you would like to use.  So say, you are using a rotating sponsor as I am on my page, you would type:

Check out a <!--#exec cgi="../cgi-bin/you/rotlink.cgi"-->Sponsor</a>

10.  Warning!!  If you view the html file off-line (from your hard drive), the link will not appear hyperlinked!  It needs the server script to be able to bring in the correct information to make it an actual link.  NOTE: This script takes into account frames.  It uses the command target="_top" which loads the linked page into the full size of the browser.

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

12.  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).

13.  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:

rotlink.cgi  a+rx or 755

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.

14.  Load the page from the internet, and see if you have a rotating link.  Use RELOAD to cycle through your options

15.  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.

