Приглашаем посетить
Достоевский (dostoevskiy-lit.ru)

Random Banner Generator

                            BASIC INFORMATION

Name: Selena Sol's Random Banner Generator
Version: 4.0
Last Modified: 07-31-96

                               DESCRIPTION

This script will filter HTML pages that have been tagged with the special
line "<!--IMG GOES HERE-->".  The script will replace occurances of that
tag with a random banner and hyperlink.

                          COPYRIGHT INFORMATION

This application was written by Selena Sol (selena@eff.org,
http://www.eff.org/~erict) having been inspired by countless other Perl
authors.  Feel free to copy, cite, reference, sample, borrow, resell or
plagiarize the contents.  However, if you don't mind, please let me know
where it goes so that I can at least watch and take part in the
development of the memes. Information wants to be free, support public
domain freware.  Donations are appreciated and will be spent on further
upgrades and other public domain scripts.

Finally, PLEASE SEND WORKING URL's to selena@eff.org.  I maintain a list
of implementations around the world.

				 SUPPORT

This script comes with no gaurentees or warranties.  I am not a
programming professional.  I am a web-hobbiest and my scripts are
continually evolving as I learn more. Don't expect the scripts to be
perfect. 

Bug reports are greatly appreciated but installation support is
extremely discouraged. I have attempted to include as much information as
I could think of in this README and in the Customization and Installation
FAQ available at http://www.eff.org/~erict/Scripts/.  Please try ALL
available sources of information BEFORE you email me.  But if you must,
make sure to include the following bits of information (I may not respond
to your email if you do not answer ALL of the following questions):

1. What type of Web server are you running?
2. What type of Operating System is the Web server running on?

3. What is the "exact" error message from the Web?
4. What is the "exact" error message in your web server's error log?
5. What is the "exact" error message you receive when running the script
       from the command line.

6. Are you running this script on an ISP?  If so, what is the email
       address of the Sysadmin there?
7. Are you using a virtual server setup?  If so, what is the root path set
       in your Web server's environment?

8. In which directory is the Perl interpreter located?
9. In which directory is sendmail located (if you are using a script which
       demands use of sendmail)

Again, I MAY NOT ANSWER YOUR QUESTION unless you have answered all nine of
these questions.

                BASIC INSTALLATION (DOWNLOADING THE SCRIPT)

It is recommended that you point your Web browser to "Selena Sol's Script
Archive" to get the latest version of this script.  The Script Archive is
located at the following URL:

                    http://www.eff.org/~erict/Scripts/

From the "Script Archive" frontpage follow the hyperlinks to the detailed
page dedicated to this script.  Then click on the hyperlink "Download the
scripts as a single tar file".

                BASIC INSTALLATION (UNARCHIVING THE APPLICATION)

Once you have downloaded the TAR file (a single file containing all
associated files in their relative positions under the root directory),
transfer the TAR file to an executable directory on your web server and
untar them.  On UNIX systems, you may type the following at the
command line:

                          tar xvfp filename.tar

       (If you are using a non-UNIX Operating System, you may 
       download a TAR/UNTAR program by pointing your Web browser
       to http://www.shareware.com).

                 BASIC INSTALLATION (SETTING PERMISSIONS)

Your Web server must have permission to read, write or execute as needed.
Each sub-directory and file in the application has its own correct
permissions level associated with it.  Once you have unarchived (UNTAR)
the application, you must then set the correct permissions.  On UNIX
systems, you will use the "chmod" command.   The following table is a
quick guide to setting permissions for UNIX servers.

	PERMISSION	COMMAND
	rwxrwxrwx 	chmod 777 filename		
	rwxrwxr-x	chmod 775 filename
	rwxr-xr-x	chmod 755 filename
	rw-rw-r--	chmod 664 filename
	rw-r--r--	chmod 644 filename

	Note: Not setting your permissions correctly is the 
	NUMBER 1 reason why installations fail.  Take time to 
	get this right.

The actual permissions required for the subdirectories and files used by
this application are listed in the next section.

         BASIC INSTALLATION (FILES, DIRECTORIES, AND PERMISSIONS)

The TAR file will then expand into a root directory called Random_banner.
Random_banner will contain several sub-directories and several files.  
The diagram below depicts the directory structure as well as the
permissions which must be applied to the files and subdirectories used by
the application.

Random_banner Root Directory (drwxr-xr-x)
   |____Html Sub-directory (drwxr-xr-x)
   |       |____html_example.html (-rw-r--r--)
   |       |____html_example2.html (-rw-r--r--)
   |____alternative_image.list (-rw-r--r--)
   |____cgi-lib.pl (-rw-r--r--)
   |____default_image.list (-rw-r--r--)
   |____index.cgi (-rwxr-xr-x)
   |____random_banner.setup (-rw-r--r--)


Random_banner is the root directory and must be readable and executable by
	the web server.

Html is a subdirectory containing the HTML files the must be filtered by
	index.cgi.  It must be readable and executable by the web server.
	It contains two example HTML files: html_example.html and
	html_example2.html

	html_example.html is the first example of an HTML file which can
		be filtereed by index.cgi to add a random banner.  It is a
		plain HTML file which must be readable by the web server.
		There are two things of interest.  First, it has the line:

		  <!--IMG GOES HERE-->

		near the bottom.  this crucial "tag" must appear in the
		location in which you want the random clickable banner to
		be located. The scrit will look for the tag and insert the
		banner there.

		Second, the HTML page has a hyperlink aty the bottom
		pointing to index.cgi and passing as parameters the name
		of html_example2.html and the image list
		alternative_image.list.  This hyperlink demonstrates how
		you would call a filtered HTMl page using the script.
		This hyperlink will load the second demo html file.

	html_example2.html is the second example HTML page to be filtered
		which is called from html_example.html.  This example
		HTMl file has the required "<!--IMG GOES HERE-->" tag but
		does not have a link as the example is complete already.
		This file must be readable by the web server.

alternative_image.list and default_image.list are sample image/URl
	databases which this script uses to generate random clickable
	banners. Each must be readable by the web server and follows the
	basic pipe (|) delimited format:

	location of image|URL to click to

	The location of image should be the relative path of the image
	reletive to the URL defined in $image_url and should not include
	the pipe character as that is used to delimit the data file.  The
	url should be the full url with no pipe characters.  For example:

	Icons/ying_yang_icon.gif|http://www.eff.org/~erict/

	points to an image located in the Icons subdirectory under the URL
	specified in $image_url (which for the distribution is
	http://www.foobar.com/pub/Graphics) and sets the URL of the clickable
	image equal to http://www.eff.org/~erict/.

cgi-lib.pl is a library file used to read and parse incoming URL encoded
	data.  This file must be readable by the web server

index.cgi is the main script used for the application.  The reason that it
	is called index.cgi instead of random_banner.cgi is that many
	servers allow you to load index.cgi files without naming them.
	Thus, you might call this script with the URL....

	http://www.foobar.com/

	instead of calling it like.....

	http://www.foobar.com/random_banner.cgi

	This file must be readable and executable by the web server.

random_banner.setup is the file used to define server specific variables
	and must be readable by the web server.

			   RUNNING THE SCRIPT

To access the script, simply reference the location of the
main script as follows:

             http://www.foobar.com/cgi-bin/index.cgi

This will run index.cgi which will take advantage of the default image
file.  Alternatively, you may use this same script with a different
image list and html file as follows:

    http://www.foobar.com/cgi-bin/index.cgi?image_list=xxx&html_file=yyy

The xxx is the name of the alternative image list to use like
alternative_image.list and the yyy is the name of the html file that you
want the random banner displayed in.  These two variables are separated
with the ampersand (&) symbol and the entire encoded part of the URL is
defined after the question mark (?) symbol.

Notice in particular that the HTML file is not called directly.  This
script will filter the HTMl file.