#!/usr/local/bin/perl -w use Socket; $query = "$ENV{'QUERY_STRING'}"; $pro = "http"; if ($query eq "y") { $hostname = "www.yahoo.com"; } elsif ($query eq "Skippy") { $hostname = "skippy.wgz.org"; } elsif ($query eq "Winpatch") { $hostname = "winpatch.wgz.org"; } elsif ($query eq "Spectral") { $hostname = "spectral.wgz.org"; } elsif ($query eq "Magic") { $hostname = "magic.hurrah.com"; } elsif ($query eq "Skylab") { $hostname = "www.skylab.org"; } elsif ($query eq "biff") { $hostname = "biff.ch.up.edu"; } else { print "Content-type: text/html\n\n"; print <<"EOF"; Invalid Option

Invalid Option


"$query" is not a valid option.
Back
keys\@babylo n5fan.com EOF $stat = "Invalid"; &end; } $hostaddr = (gethostbyname($hostname))[4] || &fail; $proto = (getprotobyname ('tcp'))[2] || &err ("Protocol Failure"); socket (SOCK, AF_INET, SOCK_STREAM, $proto) || &err ("Socket Failure"); connect (SOCK, pack "SnA4x8", AF_INET, $port || 80, $hostaddr) || &fail; select (SOCK); $| = 1; select (STDOUT); print "Location: $pro://$hostname"; print ":$port" if $port ne ""; print "$ENV{'PATH_INFO'}\n\n"; $stat = "Redirected"; &end; sub fail { print "Content-type: text/html\n\n"; print <<"EOF"; Service Unavailable

$query is unavailable


Service for $pro on $query is currently down. Please try again later.
Back
keys\@babylo n5fan.com EOF $stat = "Unavailable"; &end; } sub err { my ($error) = @_; print "Content-type: text/html\n\n"; print <<"EOF"; Error

Error


An error has occurred. With any luck I should already know about it, though...
Back
keys\@babylon5fan.com EOF $stat = "Error: $error"; &end; } sub end { chmod (0602, "./hidden/server.cgi.log"); open (FILE, ">> ./hidden/server.cgi.log") || open (FILE, "> ./hidden/server.cgi.log"); print FILE scalar localtime; print FILE ",$ENV{'REMOTE_HOST'},$ENV{'HTTP_REFERER'},$query,$stat\n"; close (FILE); exit(0); }