#!/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";
##
#!/usr/local/bin/perl -wT
use strict;
use CGI;
use LWP::Simple;
my %hosts = (
'skylab' => 'http://skylab.org/',
'tarball' => 'http://tarball.wgz.org/',
'google' => 'http://www.google.com/',
'secure' => 'http://secure.wgz.com/',
);
my $q = new CGI;
my $dest = $q->param('dest') || '';
my $dest_url = $hosts{lc($dest)};
my $message = '';
if(defined($dest_url))
{
if(head($dest_url))
{
print $q->redirect(-location=>$dest_url);
exit(0);
}
else
{
$message = "$dest is unavailable";
}
}
else
{
if($dest)
{
$message = "$dest is not a recognized destination";
}
else
{
$message = 'No dest specified';
}
}
print $q->header();
print $q->start_html(-title=>$message);
print $q->h1($message);
print $q->h2('Please try again');
print $q->end_html();