 |
 |
#!/usr/bin/perl
#####################################################################################
# c22random.pl - Random whatever generator #
# Written by - Richard Livsey of Cache-22 #
# E-mail - R.Livsey@Cache-22.co.uk #
# Web Site - http://www.cache-22.co.uk #
#####################################################################################
# Disclaimer etc.. #
# We at Cache-22 accept no responsibility for any damage to property or profits #
# associated with the use of this script. #
# Feel free to use this script and modify it how you want. If you do do anything to #
# it, then please leave this top part intact. #
# If you wish to use this script then please contact us at the e-mail address above #
# and tell us what you are doing with it. #
#####################################################################################
# ensure the shebang line points to your perl program.
# upload in ASCII and CHMOD to 755.
# create a directory named "c22random" and place in here all your text files.
# I have included a few demo text files, but you shouldnt have any problems.
# Now modified to be able to be used with flash!
# call the script in Flash as http://domain/cgi-local/c22random.pl?file=####&flash=on
# ie as below, but with the flash=on bit tagged on the end.
# an example Flash file is included.
# call the script in an SSI such as -
# where "####" is the name of your text file, without the ".txt" part.
# so if you wanted to load "images.txt" the SSI would be -
#
# The only restriction in creating your text file is that you must have one item per line.
# Thats it, have fun!
#### do not modify below this point ####
print "Content-type: text/html\n\n";
if (length ($ENV{'QUERY_STRING'}) > 0){
$buffer = $ENV{'QUERY_STRING'};
#seperate all name/value pairs at the &
@pairs = split(/&/, $buffer);
foreach $pair (@pairs){
#seperate each name/value pair at =
($name, $value) = split(/=/, $pair);
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$in{$name} = $value;
}
}
$file = $in{'file'};
$flash = $in{'flash'};
if (length($flash) > 0){
$fmsg = 'message=';
}
open (DATA, "banner/$file.txt") || die "Cant open list.txt, $!";
@data = ;
close (DATA);
$line = (int(rand $#data));
print "$fmsg$data[$line]"; |
 |