#!/util/bin/perl
require "/home/unix/web/htdocs/h/o/holidays.bfn.org/cgi-bin/cgi-lib.pl";
$Head = "\n\t
\n\t\thttp://holidays.bfn.org Random Quote\n\t\n\nRandom Quote
\n
\n";
$Foot = "\n";
print &PrintHeader;
$refer = $ENV{'HTTP_REFERER'};
$_ = $refer;
if($refer) {
if( !/holidays.bfn.org/i && !/freenet.buffalo.edu/i && !/bfn.org/ && !/128.205.200.12/) {
print "You may only access this program from http://holidays.bfn.org
";
print $Foot;
exit;
}
}
open(QUOTES,"alt.quotes.txt") || die "Oops, the cookie crumbled!";
$InQuote = 0;
while() {
if (/^%%$/) {
if($InQuote == 0) {
$idx++;
$InQuote = 1;
} else
{
$InQuote = 0;
}
}
if($InQuote == 1 && !/^%%$/) {
# if($SIGOne == 0) {
s/^ -- / -- /;
# $SIGOne = 1;
# }
$Aquote{$idx} = $Aquote{$idx} . $_;
}
# print $_;
}
close(QUOTES);
#print $idx;
srand;
while($ThisQuote == 0) {
$ThisQuote = int(rand($idx));
}
$Aquote{$ThisQuote} =~ s/\n/
\n/g;
#$Aquote{$ThisQuote} =~ s/ / /g;
$Aquote{$ThisQuote} =~ s/^$/
\n;/g;
print $Head;
print "
\n";
print $Aquote{$ThisQuote};
print "
\n";
print $Foot;