home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet 1996 World Exposition
/
park.org.s3.amazonaws.com.7z
/
park.org.s3.amazonaws.com
/
main.cgi
< prev
next >
Wrap
Text File
|
2017-09-21
|
8KB
|
294 lines
#!/usr/local/bin/perl
#
# file: index.cgi
# desc: generate default index page based upon browser type
#
eval 'exec /usr/local/bin/perl -s $0 ${1+"$@"}'
if 0;
# map of server host names to host.park.org domain
%host2park = (
'town', 'park.org',
'ventus', 'adelaide.park.org',
'amsterdam', 'amsterdam.park.org',
'phoenix', 'imperial.park.org',
'iwe', 'japan.park.org',
'seoul', 'korea.park.org',
);
# get FQDN park.org host name for this particular server
chop($park_host = `/sbin/uname -n`);
$park_host = $host2park{(split(/\./, $park_host))[0]};
# non-buffered STDOUT
$| = 1;
# attempt to redirect based upon incoming domain
$rem_host = $ENV{'REMOTE_HOST'};
$rem_addr = $ENV{'REMOTE_ADDRESS'};
if ($rem_host) {
if ($park_host !~ /japan/ && $rem_host =~ /\.jp$/i) {
&redirect("http://japan.park.org/bandwidth.cgi");
} elsif ($park_host !~ /imperial/ && $rem_host =~ /\.uk$/i) {
&redirect("http://imperial.park.org/bandwidth.cgi");
} elsif ($park_host !~ /adelaide/ && $rem_host =~ /\.au$/i) {
&redirect("http://adelaide.park.org/bandwidth.cgi");
} elsif ($park_host !~ /seoul/ && $rem_host =~ /\.kr$/i) {
&redirect("http://korea.park.org/bandwidth.cgi");
} elsif ($park_host !~ /amsterdam/ &&
(
($rem_host =~ /\.al$|\.am$|\.at$|\.az$/i) ||
($rem_host =~ /\.be$|\.bg$|\.by$/i) ||
($rem_host =~ /\.ch$|\.cy$|\.cz$/i) ||
($rem_host =~ /\.dz$/i) ||
($rem_host =~ /\.eg$|\.es$/i) ||
($rem_host =~ /\.ge$|\.gr$/i) ||
($rem_host =~ /\.hr$|\.hu$/i) ||
($rem_host =~ /\.ie$/i) ||
($rem_host =~ /\.li$/i) ||
($rem_host =~ /\.ma$|\.md$|\.mk$|\.mt$/i) ||
($rem_host =~ /\.nl$/i) ||
($rem_host =~ /\.pt$/i) ||
($rem_host =~ /\.ro$|\.ru$/i) ||
($rem_host =~ /\.si$|\.sk$|\.su$/i) ||
($rem_host =~ /\.tn$/i) ||
($rem_host =~ /\.ua$/i) ||
($rem_host =~ /\.va$/i) ||
($rem_host =~ /\.yu$/i)
) ) {
&redirect("http://amsterdam.park.org/bandwidth.cgi");
}
}
# make sure we print MIME type
print "Content-Type: text/html\n\n";
# who am i?
($prog = $0) =~ s#.*/##;
# which client type?
$_ = $ENV{'HTTP_USER_AGENT'};
# generate page based upon browser type
if (
/^aolbrowser\/1\.0/ ||
/^Cello/ ||
/^Chimera\/1/ ||
/^CyberJack/ ||
/^IBM WebExplorer/ ||
/^Lynx/ ||
/^Midas/ ||
m#NCSA_Mosaic/.*\(X11# ||
/NetCruiser/ ||
/^PRODIGY-WB\/1\.4/ ||
/TkWWW/
) {
&low_bandwidth(); # text-only or brain-dead browsers
} elsif (/Explorer\/4\.40\.308/ ) {
&old_microsoft_browser_html(); # older (pre-HTML 3.0) browsers
} elsif (/^Mozilla\/1\.0/ ) {
&old_browser_html(); # older (pre-HTML 2.0) browsers
} else {
&high_bandwidth(); # default - HTML 3.0 and netscape 2.x
}
exit 0;
#
# generate html index page for text-only or brain-dead browsers
#
sub low_bandwidth {
print <<EoI;
<HTML>
<HEAD>
<TITLE>Internet 1996 World Exposition</TITLE>
<base href="http://$park_host/">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#97694F" VLINK="#42426f">
<a href="/About/index.text.html">
<img align="left" width="533" height=127
ALT="[INTERNET 1996 WORLD EXPOSITION]"
SRC="/Images/fair_header.gif" border="0">
</a>
<br clear="all">
<p>
<h1><a href="/About/Fair/index.text.html">Welcome to the Fair!</a></h1>
<p>
You've reached the text and simple graphics version of the Internet 1996
World Exposition. If your browser has support for tables, you might
want to visit the high-bandwidth theater <a href="main.html">version of the fair.</a>
<P>
<hr>
<p align="center">
<a href="http://www.cyber24.com">Coming Feb. 8: 24 Hours in Cyberspace!</a></h3>
<hr>
<img align="left" ALT="[Antique Postcard]" SRC="/Images/postcard_02.jpg" width="200" height="78" border="0"><br>
<p>
<ul>
<li><a href="/Pavilions/index.text.html">Pavilions</a>
<li><a href="/Regions/index.text.html">Regions</a>
<li><a href="/Places/index.text.html">Places</a>
<li><a href="/Events/index.text.html">Events</a>
<li><a href="http://park.org/cgi-bin/form-mail.fairmaster?Feedback">Feedback (Forms)</a>
<li><a href="mailto:fairmaster\@park.org">Feedback (No Forms)</a>
<li><a href="/Letters/index.text.html">Letters of Support</a>
<li><a href="/Sponsors/index.text.html">Our Sponsors</a>
</ul>
<a href="/cgi-bin/imagemap/Images/htoolbar.text.map">
<img align="left" width="486" height="101" alt="[Unreadable Image]"
SRC="/Images/htoolbar.gif" ISMAP border="0"></a>
<br clear="all">
<a href="/About/index.text.html">[About the Fair]</a> <a href="/Sponsors/index.text.html">[Sponsors]</a>
<a href="/WhatsNew/index.text.html">[What's New]</a> <a href="http://park.org/Tools/Guestbook/index.text.html">[Guestbook]</a>
<a href="/Tools/index.text.html">[Toolbox]</a>
</body>
</HTML>
EoI
}
#
# generate html index page for pre HTML 3.0 browsers (e.g., netscape 1.0)
#
sub old_microsoft_browser_html {
print <<EoI;
<HTML>
<HEAD>
<TITLE>Internet 1996 World Exposition</TITLE>
<base href="http://$park_host/">
</HEAD>
<BODY BGCOLOR="#FFFFFF" background="/Images/expo_bk_main.gif" TEXT="#000000" LINK="#97694F" VLINK
="#42426f">
<a href="/cgi-bin/imagemap/Images/main_masthead.map">
<img SRC="/Images/main_masthead.gif" ismap width="534" height="130" border="0"></a><br clear="all">
<p>
<font size="+2"><b>Greetings!</b></font size="+2">
<p>
Welcome to the Internet 1996 World Exposition! We noticed that you are running an
old version of the Microsoft Internet Explorer browser. Our site will look much
better if you upgrade to the current version, which fixes some problems with how
tables are shown on your screen.
<p>
<ul>
<li><a href="http://www.msn.com/ie/ie.htm">Upgrade your software.</a>
<li><a href="/main.html">Visit the fair with your current browser.</a>
</ul>
</body></html>
EoI
}
sub old_browser_html {
print <<EoI;
<title>Your Browser Is Old</title>
<h1>Your Browser</h1>
</center>
<p>
Hello!
<p>
Welcome to the Internet 1996 World Exposition.
We noticed that you are using an old version of your browser.
We're terribly sorry, but your browser does not support
the tables and other features that were used in building
the Internet 1996 World Exposition. Some of the ones we
have tested include current versions of
<a href="http://home.netscape.com/comprod/mirror/index.html">Netscape Navigator,</a>
<a href="http://www.msn.com/ie/ie.htm">Microsoft Internet Exporer,</a> and
<a href="http://www.qdeck.com/qdeck/demosoft/QMosaic/" >Quarterdeck Mosaic.</a>
<p>
We'd like to suggest that you look into upgrading your browser.
In the mean time, please accept our regrets.
If you'd like to try to look at the fair anyway, please
<a href="/main.text.html">press here</a>
for the "low bandwidth" version of the fair.
EoI
}
#
# generate default html index page (HTML 3.0 and netscape 2.0 enhancements)
#
sub high_bandwidth {
print <<EoI;
<!DOCTYPE HTML PUBLIC "-//Netscape Comm. Corp.//DTD HTML//EN">
<HTML>
<HEAD>
<TITLE>Internet 1996 World Exposition</TITLE>
<base href="http://$park_host/">
</HEAD>
<BODY BGCOLOR="#000000" TEXT="#ffffff" LINK="#d98719" VLINK="#97694F">
<center>
<a href="/cgi-bin/imagemap/Images/bandwidth.map">
<img alt="[Try http://$park_host/main.text.html]" ISMAP src="/Images/tunnels.jpg" width="465" height="349" border="0" hspace="30" vspace="30" align="center"></a>
<table cellpadding="5" width="465">
<tr><td align="center" valign="top" width="235">
<font size="-1">Choose <a href="main.html"><b>high</b></a> when connected with permanent Internet access or ISDN.</font>
</td>
<td align="center" valign="top" width="215">
<font size="-1">Choose <a href="main.text.html"><b>low</b></a> when dialing in with a modem.</font>
</td></tr></table>
</center><br clear>
</body>
</HTML>
EoI
}
#
# redirect to specified URL
#
sub redirect {
local($url) = shift;
local($logfile) = '/var/log/park-redirect.log';
# keep track of redirected hosts for debugging
system("/bin/echo \"[`date`]: $rem_host -> $url\" >> $logfile");
print "Status: 302\n"; # redirect status code
print "Location: $url\n\n"; # where they should go...
exit 0;
}