#!/usr/bin/perl
###################################################################
# FILE UPLOADER									
# Distribution by Psybercore.com, Inc.	info@superscripts.com    
#
# My name is Drew Star... and I am funky http://www.mp3.com/drewstar/
#
# http://www.superscripts.com/
#             
###################################################################
# FILE UPLOADER									
#                         
# Duplicating or redistributing this program without prior
# written consent is expressly forbidden.  You must Obtain
# permission before redistributing this software by any means.
# In all cases this copyright/license notice must remain intact.
#
# http://Marek'sScripts.w2w.cc/ 
#               
###################################################################


Copyright
====================

   Duplicating or redistributing this program without prior written consent is 
   expressly forbidden.  You must Obtain permission before redistributing this 
   software by any means. In all cases the copyright/license notice must remain 
   intact.


Description
====================

   Upload It makes it quick and easy for visitors or clients to send you files 
   by uploading them to your web site.  Features include the ability to 
   optionally restrict file types, email the webmaster with a list of uploaded 
   files, and or create a log file listing uploaded files. For security reasons 
   the location of all uploaded files is kept hidden (It can even be on a 
   different server!). This script is ideal for adult webmasters or any one else 
   who wants to allow visitors to be able to easily upload content.


Features
====================

	- Makes it quick and easy for visitors or clients to send you files.

	- Optionally restrict file types by extension (e.g. .jpg).

	- Optionally email the webmaster each time files are uploaded.

	- Optionally keep a log file listing all uploads.

 	- Hides the location of uploaded files from visitors.


Requirements
====================

	- Perl 5

	- Unix Based Web Server

	- cgi capability

	- Sendmail (optional)


Installation Steps
====================

   A. Edit the first line of the main  script from #!/usr/bin/perl to the required
      Perl path specified on your server. (If you don't know contact somebody
      who does, such as a web host's technical support. Commonly it can be
      /usr/bin/perl, /usr/sbin/perl, /usr/local/perl, etc...)

   B. Modify the variables in the up.cgi (open it using notepad and scroll down 
      until you see the line "Define Variables").

     1. $imagedir = "/home/yourdomain/www/upfiles";
        ====================================================================
        The full path to the directory where you wish to store the uploaded 
        files. Do not include the trailing slash.


     2. $log = "/home/yourdomain/www/cgi-bin/up.log";
        ====================================================================
        The full path to the location of your log file (up.log) including the 
        file name.  The default file name is "up.log". 


     3. $numfiles = "5";
        ====================================================================
        The number of files you want to have uploaded at one time.  Set this 
        equal to the number of files fields on your up.html (see Installation 
        Step B. below).


     4. @referers = ('yourdomain.com', www.yourdomain.com', '209.456.66.132');
        ====================================================================
        The referrers list is the list of domains and IP addresses that are
        allowed access the script. Use it to prevent others from accessing the 
        program from another server.  Replace yourdomain.com and the IP numbers 
        to match your site (case insensitive). You can add as many as you like.

        @referers = ('yourdomain.com','another.com','another2.com');
        @referers = ('yourdomain.com');

        As you can see each item should be in single quotes and seperated
        by a comma (unless there is only 1 item, then no comma is required)


     5. $allowall = "no";
        ====================================================================
        Set this variable to allow all file ("yes") types to be uploaded or to 
        restrict file types ("no").  Use lower case yes/no only.


     6. @filetypes = ('.jpg', '.jpeg', '.gif');
        ====================================================================
        The file types list is the list of file type extensions you wish to 
        allow visitors to be able to upload. Use it to prevent visitors from 
        uploading unwanted file types. You can add as many as you like (case 
        insensitive). 

        Graphic Files Only:	@filetypes = ('.jpg', '.jpeg', '.gif',);
        text/html Files Only:	@filetypes = ('.txt', '.htm', '.html');
        Zip Files Only:		@filetypes = ('.zip');

        As you can see each item should be in single quotes and seperated
        by a comma (unless there is only 1 item, then no comma is required)


     7. $EMail = "yes";
        ====================================================================
        Here you have two choices "yes" and "no".  If you want to be emailed 
        each time files are uploaded select "yes", otherwise select "no".  
        Note: "yes" and "no" must be in lower case.  "YES" and "NO" will not 
        work.


     8. $sendmail="/usr/bin/sendmail";
        ====================================================================
        Enter the full path to sendmail on your server (If you don't know 
        contact somebody who does, such as a web host's technical support. 
        Commonly it can be /usr/lib/sendmail, /usr/sbin/sendmail, 
        /usr/bin/sendmail, etc...).


     9. $ConfirmToEmail = "youremail\@yourdomain.com";
        ====================================================================
        Your email address.  Make sure you include the "\" before the @ symbol.  
        If you don't it will cause the script to crash.


     10. $subject = "Files Uploaded";
        ====================================================================
        Enter the subject of the email notification.


     11. Results Page Background and Coulour Options (Optional)
        ====================================================================
        Use the following variables to customize the look and feel of the 
        results page to match the rest of your site:


			Background Colour: 	$bgcolor = "#FFFFFF";

			Text Colour: 			$text = "#000000";

			Link Colour: 			$link = "#0000FF";

			Visited Link Colour: 	$vlink = "#800080";

			Background Image:		$background = ""; # (e.g. "abc.gif")


     12. Results Page Text Options (Optional)
        ====================================================================
        Use the following variables to customize the results page text:

			Page Title:		$html_title="Thank You!";

			Page Header 1:	$html_header="Thank You!";

			Page Header 2:	$html_header2="Files Uploaded";

			Message:		$message = "Thank you for uploading.";


     13. Results Page Link Options
        ====================================================================
        Use the following variables to customize the results page Links:

			Link 1 URL:		$link1 = "http://www.yourdomain.com/index.html";

			Link 1 Text:	$text_link1 = "Home";

			Link 2 URL:		$link2 = "http://www.yourdomain.com/links.html"; 

			Link 2 Text:	$text_link2 = "Links";

			Link 3 URL:		$link3 = "http://www.yourdomain.com/up.html";

			Link 3 Text:	$text_link3 = "Back";



   C. Modify the up.html (open it using notepad and scroll down 
      until you see the line "<form method="POST"").  Change 
      action="cgi-bin/up.cgi" to reflect the path to the script on your 
      server.  Optionally, you can include a full URL 
      (e.g. action="http://www.yourdomain.com/cgi-bin/up.cgi").

      You can add as many upload fields as you like (see "3. $numfiles" above) 
      but be sure to give each a unique number.  Name them "FILE#" (e.g. 
      name="FILE6") or the script will not work.

   D. Upload up.cgi and up.log into your cgi-bin directory using ASCII mode 
      (any other mode would make things not work).


   E. Chmod the up.cgi to 755. Chmod the up.log to 777.

   F. Upload up.html to your site.  Access it using your browser, and start 
      uploading files.

   G. You are now setup to run the Upload It!, have fun and if you
      have any problems please feel free to contact me.



To Do List
====================

	- validate email address

	- add optional place for banner code

	- limit number of files and size

	- limit log size/duration

	- put a back button on error pages

	- thank you email

- target tag on links (e.g.frames)

- optional redirect.

- exclude file types.

- add more user defined fields.




