In .htaccess:
PHP:
Action add-header /cgi-bin/hfr/hfr.pl
AddHandler add-header .html .htm .shtml
In hfr.pl:
PHP:
#!/usr/bin/perl
#
# Simple headers/footers rotater for Apache
#
# Copyright (c) 2002 D.Pokataev. Freeware
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
srand();
print "Content-Type: text/html\n\n";
if (-d "./headers") {
@a = glob "./headers/*.htm";
if (@a) {
push @f, $a[rand(@a)];
}
}
push @f, "$ENV{'PATH_TRANSLATED'}";
if (-d "./footers") {
@a = glob "./footers/*.htm";
if (@a) {
push @f, $a[rand(@a)];
}
}
foreach $i (@f) {
&pf("$i");
}
sub pf($) {
open (PF,"<$_[0]");
while (<PF>) {print};
close(PF);
}
Readme:
# Download License. If you do not agree to license, stop installation
# Save file hfr.pl to your hard drive
# Correct first script line if path to Perl on your server is not "/usr/bin/perl"
# Create directory /cgi-bin/hfr/ on your server
# Upload file hfr.pl to /cgi-bin/hfr directory on ASCII mode
# Change file hfr.pl mode to 755
# Create directory /cgi-bin/hfr/headers on your server (if you will use headers)
# Create directory /cgi-bin/hfr/footers on your server (if you will use footers)
# Create separate files with headers. You can use any names you want, but extension must be .htm
# Create separate files with footers. You can use any names you want, but extension must be .htm
# Upload headers files to /cgi-bin/hfr/headers on your server
# Upload footers files to /cgi-bin/hfr/footers on your server
# Go to web directory where you want to add headers/footers to html pages. Script will work for this directory and all subdirectories
# Add to .htaccess file two lines:
Action add-header /cgi-bin/hfr/hfr.pl
AddHandler add-header .html .htm .shtml
If .htaccess file doesn't exist, just upload .htaccess with two lines above
# If you use other extensions for html files, add them to "AddHandler" line
# Enjoy
ask and you shall receive
hope this helps