#!/usr/local/bin/perl # # Random Quotation generator # (c)1996 Mark Rigby-Jones for mrjsw # mark.rigby-jones@keble.oxford.ac.uk # http://users.ox.ac.uk/~kebl0206/ # $query = $ENV{QUERY_STRING}; @season = (0,0,0,0); if ($query =~ /0/) { $season[0] = 1; } if ($query =~ /1/) { $season[1] = 1; } if ($query =~ /2/) { $season[2] = 1; } if ($query =~ /3/) { $season[3] = 1; } if (($season[0] == 0) && ($season[1] == 0) && ($season[2] == 0) && ($season[3] == 0)) { @season = (1,1,1,1); } $total = (1 * $season[0]) + (22 * ($season[1] + $season[2] + $season[3])); print(<<"BACK_TO_PERL"); Content-type: text/html
BACK_TO_PERL $time = time; open(CNF, "out/quote.cnf"); chop($files =); $fileno = $time % $total; if ($season[0] == 0) { $fileno++; } if (($season[1] == 0) && ($fileno > 0)) { $fileno += 22; } if (($season[2] == 0) && ($fileno > 22)) { $fileno += 22; } for ($i = 0; $i <= $fileno; $i++) { chop($file = ); } open(FILE, $file); chop($quotes = ); $quoteno = (($time - $fileno) / $total) % $quotes; for ($i = 0; $i <= $quoteno; $i++) { while ( !~ /%%/) { } } for ($i = 0; ($line = ) && ($line !~ /%%/); $i++) { $quote[$i] = ($line); } chop(@quote); $maxlength = 0; foreach $line (@quote) { if (length($line) > $maxlength) { $maxlength = length($line); } } foreach $line (@quote) { for ($i = length($line); $i < $maxlength; $i++) { $line .= " "; } print("$line\n"); } open(COUNT, "out/count.quote"); $count = ; close(COUNT); $count++; open(COUNT, "> count.quote"); print(COUNT $count); close(COUNT); print(<
All original material ©The Oxford Babylon 5 Society
Babylon 5 and related material ©Warner Brothers
$count quotes randomly served since 3rd November 1995