#########################################################################
#
#	My Downloader V1.0
#
#	Copyright, 1998. Jim Melanson, Jim Melanson Web Design.
#	webmaster@thebeaches.to - www.thebeaches.to/jmwd/index.html
#
#	You are free to use and modify this script as you see fit provided
#	that all Copyright information remains intact. Furthermore, you 
#	may redistribute this script under the terms of Charity-Ware which
#	can be found at www.thebeaches.to/jmwd/charity_ware/index.html
#
#	By configuring and or loading this script, you agree to indemnify
#	Jim Melanson and Jim Melanson Web Design from any loss or damage,
#	however caused, including but not limited to negligence, error,
#	misconfiguration, abuse. If the laws governing your local area
#	do not allow such a limitation of exclusion then you do not
#	have my permission to use this script.
#
#########################################################################

				   OVERVIEW

Welcome to My Downloader. This program is designed to help you keep track
of who downloads files, data, zip files, etc from your website. All it takes
to set up the script is set a few variables in the config file, then load
and CHMOD the script to your server. When a person goes to the download page
they will be given instructions for downloading, a list of files and related
information (including descriptions) of files available for download.

After selecting the file they want, they enter their name (mandatory) and
their e-mail (mandatory). If they choose they can enter a company name as
well. They submit this page and are presented with a page confirming the file
they wish to download. If the information is correct, one more click and the
file is automatically sent to them.

ADMINISTRATION:
The administration page allows you to add files (inlcuding all info) to the
database. It also allows you to delete files from the database and choose
files for updating. Each of these three actions requires the use of a USER ID
and password.

UPDATE:
The update option allows you to change or correct information included with a
file for download. Each step of the update is explained as clearly as on the 
administration page.

SETUP:
After you have loaded and CHMODed the script, the first time you run it you
must run the Setup routine. This is accomplished with the URL:

	http://www.yourdomain.com/cgi-bin/path/to/my_downloader.cgi?setup

This will prompt you to enter a User ID and a Password (you will have to
enter it twice). Make sure you write down the User ID and Password as once
the setup program is run, it is impossible to run it a second time unless
you delete the Password file.

#########################################################################
			LOADING AND CHMODing
#########################################################################

You will require a minimum of three different directories for this script
to work. 

	* The first is the directory within your cgi-bin that you will place
	  the scripts. This directory and the scripts must be CHMOD 755.

	* The second is a directory outside the cgi-bin where the data
	  files will be created and stored by the program. This directory
	  and the path to this directory must all be CHMOD 766

	* The third is the directory where you will place the help file.
	  Yo do not need to CHMOD the help file.

There are three files with this script. They are:

1.)	attack.cgi - This is a powerful little parsing script that I have
	written and use exclusively on all my scripts. It has some great 
	little features. It parses out most attempts to attack a server
	through form hijacking and also edits out HTML tags. This prevents
	the unwanted appearance of images, links, etc in documents it is
	working for. You must set two variable in this script. They are:

2.)	my_downloader.cgi - This is the main program for My Downloader and
	does not require any configuration. There is nothing you need to do
	inside this script so don't touch anything !

4.)	help.html - This is an on-line help file that describes how to
	use this program and fill in fields. It must be placed in the
	same directory as your scripts to work. It is great if you are
	setting this script up for someone else and is good for you so that
	you don't have to keep referring back to this Readme file.

3.)	my_config.cgi - This is the script with the variables. There are 
	six variables and you must change five of them. Here is how you
	do this:

$SiteName = "My Company";
	Name of the company or website this program is bein used for. It can
	be anything you want.

$WebsiteURL = "http://www.yourdomain.com/index.html";
	Full URL of the home page for the website using this guestbook. If
	you do not have a virtual domain or a you have a personal website,
	your full URL will be similar to:
		http://www.thedomain.com/my_organization/index.html
					or
		  http://www.thedomain.com/~your_name/index.html

$ErrorNotify = 1;
	If you want email notification when a users input causes an error
	then leave this alone, if you don't want e-mail notification of
	errors, set this value to 0. This feature will allow you to see
	mistakes people are making, especially in the adding/updating or
	deleting of files. This is good if you have set the script up for
	someone and want to monitor it's performance.

$AdminEmail = "yourname\@yourdomain.com";
	Email address of the person you want to receive any error messages.
	When an error occurs because of an action a viewer has taken, the
	error program will send an email announcement to you at this address.
	If you are using the script yourself, then please make this the same
	as the $AttackEmail address. If your using the script for someone
	else, it's up to you whose address you use, theirs or yours.

$AttackWarning = 1;
	The script 'attack.cgi' sends out e-mail warning when someone enters
	improper input in a form. If you want this warning, leave this
	value set to '1', otherwise set it to '0'. This warning is generated
	when someone tries to include HTML or a large number of system
	commands in their form input.

$AttackEmail = "jmelanson\@comnet.ca";
	This is the e-mail where the Attack Warning notification will
	be sent to. Make sure it is in the above format with a backslash
	before the @ symbol. If you want the attack warnings, I recommend
	that they be delivered to you and not your client. This should be
	the same as your $AdminEmail variable.

$RootURL = "http://www.yourdomain.com/";
	This is the main URL of your web site, it MUST END IN A TRAILING
	SLASH. If you do not have a virtual domain, then this value would
	be similar to: 
		      http://www.thedomain.com/my_organization/
					or
		        http://www.thedomain.com/~your_name/

$Data = "/usr/home/name/HTML/logs/path/to/data";
	Absolute path to the DIRECTORY containing the data files for this
	script. You must create this directory outside the cgi-bin. I like
	things to be orderly, so if my script is in the cgi-bin, three levels
	below the Root directory, I will place my data files in a similar
	path, the same number of levels below the Root directory. 
	Nice & Tidy.

$HelpFile = "http://www.thebeaches.to/jmwd/charity_ware/my_downloader/help.html";
	This is the full URL to the help file that came with this script. It
	is of a benefit to the user of "my_downloader" in that it will
	answer questions about how they should perform any actions with the
	script (adding/deleting/updating/viewing).

$MailProgram = "/usr/sbin/sendmail";
	Absolute path for the sendmail program on your server. even if you
	do not choose to have EmailNotify or AttackNotify in operation,
	please fill in this variable anyways so that the program won't fault.

$Face = "arial,verdana";
	Leave this alone unless you are extremely particular about the 
	fonts the program uses on the generated pages.

#########################################################################
			STORING FILES FOR DOWNLOAD
#########################################################################

The files you are going to allow for download should be in place before you 
add them to the script. These files should be placed in a directory of their
own. I recommend that you create a directory in you Root directory and that
is where you will place your files for download. You do not need to CHMOD
this directory nor do you need to define this directory in the config file. 
You will have to express it every time you add a file to the database. 
This allows you to have downloadable filesin different directories if you 
choose.

Here is a representation of the structure of the files and directories 
I have mentioned:

ROOT-----
	|
	|
     cgi-bin----
	|	|
	|      Path------
	|		|
	|	        To-------
	|			|
       Path------	        Scripts-----
	|	|			|	
	|    	To-------		attack.cgi
	|		|		|
	|   	     help.html		my_downloader.cgi
	|				|
	|    				my_config.cgi
	|				|
	|			      	help.html
	|
	|
      Data-------
	|	|
	|      Path------
	|		|
	|	        To-------
	|			|	
	|    		       Data---
	|
	|
	|
    Download-----
		|
		file1.doc
		|
		file2.txt
		|
	       etc.

#########################################################################
			Using the program
#########################################################################

RUN THE SETUP ROUTINE:
As described above, enter the following URL and follow the directions:

	http://www.yourdomain.com/cgi-bin/path/to/my_downloader.cgi?setup

LINK TO DOWNLOAD PAGE:
Anywhere in your website where you mention a script for download or want 
to tell the person where to find download information, your link should be:

<A HREF="http://www.yourdomain.com/cgi-bin/path/to/my_downloader.cgi">Download</A>

Of course,  you can change the link text to anything you want. The link
itself is an exact copy of the $ScriptURL variable you set in the config
file. Simply change the domain name and path to the script as you did in
that variable.

LINK TO FILE INFORMATION PAGE:
Each file described on the download page will be linked to that files
information page. You will establish this link by typing in the path
to that script, relative to the root directory. You will see the Root
directory URL displayed beside the entry box on the additon form and the
update form. If there is no information page for that file, simply leave
that input field blank.

RUNNING ADMINISTRATION ROUTINE:
To run the administration routine, enter the following URL:

     http://www.yourdomain.com/cgi-bin/path/to/my_downloader.cgi?admin

From this page you can add files, delete files and choose to update files.

UPDATING A FILE:
From the administration page, select the file you wish to update. You will
then be taken to an update page. The update page shows the old information
for the file and will provide input boxes where you can change the information
for each file. If you choose not to change some of the information, simply 
leave that box alone and the data will be reposted to the database.

HELP FILE:
The administration page and the update page both contain links to a help
file. This HTML help file is included and must be placed in the same
directory as these scripts are. It explains all this information for the
person you are setting the script up for. If your setting it up for
yourself then include it anyways, that way you won't have to keep referring
back to this Readme file. The regular viewer of the website will not see
any link to this help file.

VIEW THE DOWNLOAD LOG:
To view the download log, enter this URL:

    http://www.yourdomain.com/cgi-bin/path/to/my_downloader.cgi?viewlog

This will present you with a page that displays everyone who has downloaded
a file, when they downloaded it, a link to their email and the name of the
file they downloaded. At present, this list is sorted chronologically. I hope
to have a sortable page in the next major version of this program.

#########################################################################
				Final Words
#########################################################################

I hope you enjoy using this script and find it useful. If you are familiar
with HTML and Perl then you can change the look of the pages. If you require
customization of the script of wish to change the look (but don't know how)
please contact me:

Jim Melanson
416-261-8840
webmaster@thebeaches.to
www.thebeaches.to/jmwd/index.html

I will be glad to present you with a no obligation quotation for any changes
and my fees are extremely competitive. At present my fee is CDN$50.00/hour. 
This fee is in CANADIAN dollars so those of you operating under American 
currency will realise what a bargain this is.

Good Luck and Best Wishes,

Jim Melanson
Toronto, Ontaro
July, 1998.