home *** CD-ROM | disk | FTP | other *** search
/ Internet 1996 World Exposition / park.org.s3.amazonaws.com.7z / park.org.s3.amazonaws.com / cgi-bin / guestbook.pl < prev    next >
Perl Script  |  2017-09-21  |  5KB  |  165 lines

  1. #!/usr/local/bin/perl -- -*-perl-*-
  2.  
  3. #$mailprog = '/usr/lib/sendmail -odq';
  4.  
  5. #$recipient = 'fairmaster@park.org';
  6.  
  7.  
  8. # Print out a content-type for HTTP/1.0 compatibility
  9. print "Content-type: text/html\n\n";
  10.  
  11. if ($ENV{'CONTENT_LENGTH'} <= 0) {
  12.     $reference = $ENV{'QUERY_STRING'} ;
  13.     $reference =~ tr/+/ /s;
  14.  
  15.     print <<EoI;
  16.  
  17. <head><title>Comments about the Internet 1996 World Exposition </title></head>
  18. <BODY BGCOLOR="#FFFFFF" background="/Images/expo_hbk_01.gif" TEXT="#000000" LINK="#97694F" VLINK="#42426f">
  19.  
  20. <a href="/">
  21. <img align="left" width="545" height=127
  22. SRC="/Images/fair_header.gif" border="0">
  23. </a>
  24. <br clear="all">
  25.  
  26. <table width="600" height="0"  border="0" cellpadding="0" cellspacing="0">
  27.     <tr>
  28.         <td align="left" valign="top" width="100" height="26" colspan="2">
  29.     </td></tr>
  30. <tr>
  31. <td align="left" valign="top" width="100" >
  32. <td align="left" valign="top" width="500"  >
  33. <p>
  34.  
  35. <Head><Title>Comments to the Internet 1996 World Exposition</Title></Head>
  36. <Body>
  37. <font size="+2"><b>The Internet 1996 World Exposition is closed </font size="+2"></b><br><p>
  38. Thank you for your interest in the 1996 World Exposition.  For
  39. the past year, this world's fair for the information age has
  40. provided a meeting point for artists, engineers, corporate
  41. executives, and people in all walks of life.  Several thousand
  42. pavilions from 75 countries have participated in this fair
  43. and we've had 5 million visitors from 130 countries and
  44. territories.
  45. <p>
  46. Unfortunately, the world's fair has come to an end.  We appreciate
  47. your interest, but we won't be adding any more pavilions to the fair.  
  48. Please don't feel that this is the only way you can participate in the
  49. network: we encourage you to join thousands of your colleagues
  50. around the world dedicated to building public parks in the
  51. global village.
  52. <p>
  53. Regards,
  54. <p>
  55. Dr. Rob Blokzijl<br>
  56. Secretary-General<br>
  57. The Internet 1996 World Exposition <br>        
  58.     </td>
  59.     </tr>
  60. </table>
  61.  
  62.    <p><a href="/Images/low_speed.map"><img align="left" width="638" height="87" alt="[Unreadable Image]" SRC="/Images/low_speed.gif" ISMAP border="0"></a>
  63.    <br clear="all">
  64.  
  65. </body>
  66. </HTML>
  67.  
  68. EoI
  69.  
  70. } else {
  71.     # Print a title and initial heading
  72.     print "<Head><Title>Thank you</Title></Head>";
  73.  
  74.     # Make the person feel good for writing to us
  75.  
  76. print "<BODY BGCOLOR=\"#FFFFFF\" background=\"/Images/expo_hbk_01.gif\" TEXT=\"#000000\" LINK=\"#97694F\" VLINK=\"#42426f\">";
  77. print "";
  78. print "<a href=\"/\">";
  79. print "<img align=\"left\" width=\"545\" height=\"127\" SRC=\"/Images/fair_header.gif\" border=\"0\"></a>";
  80. print "<br clear=\"all\">";
  81. print "";
  82. print "<table width=\"600\" height=\"0\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
  83. print "    <tr>";
  84. print "        <td align=\"left\" valign=\"top\" width=\"100\" height=\"26\" colspan=\"2\">";
  85. print "    </td></tr>";
  86. print "<tr>";
  87. print "<td align=\"left\" valign=\"top\" width=\"100\" >";
  88. print "<td align=\"left\" valign=\"top\" width=\"500\"  >";
  89. print "<p>";
  90. print "<font size=\"+2\"><b>Thank You!</font size=\"+2\"></b>";
  91. print "";
  92. print "<p>";
  93.  
  94.  
  95.     # Get the input
  96.         read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  97.         # Split the name-value pairs
  98.         @pairs = split(/&/, $buffer);
  99.         foreach $pair (@pairs) {
  100.            ($name, $value) = split(/=/, $pair);
  101.  
  102.            # Un-Webify plus signs and %-encoding
  103.            $value =~ tr/+/ /;
  104.            $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  105.  
  106.            # Stop people from using subshells to execute commands
  107.            $value =~ s/~!/ ~!/g;
  108.             $FORM{$name} = $value;
  109.         }
  110.  
  111. print "Thank you for your comments regarding:";
  112. print "<ul>  $FORM{'subject'} </ul><p>";
  113. print "";
  114.         if (! $FORM{'username'} || ! $FORM{'subject'} || ! $FORM{'comments'}) {
  115.                 print "<p>However, messages with no email address, subject or comments will not be sent.";
  116.                 print "<p>";
  117.         } else {
  118.                 # Now send mail to $recipient
  119.                 &send_mail;
  120.         }
  121.  
  122. print "    </td></tr></table>";
  123. print "";
  124. print "    </td>";
  125. print "    </tr>";
  126. print "</table>";
  127. print "";
  128. print "";
  129. print "<p><a href=\"/Images/low_speed.map\"><img align=\"left\" width=\"638\" height=\"87\" alt=\"[Unreadable Image]\" SRC=\"/Images/low_speed.gif\" ISMAP border=\"0\"></a>";
  130. print "<br clear=\"all\">";
  131. print "</body>";
  132. print "</HTML>";
  133.  
  134. }
  135. exit 0;
  136.  
  137. #
  138. #  send mail message
  139. #
  140. sub send_mail {
  141.     local($about) = $FORM{'about'};
  142.  
  143.     open (MAIL, "|$mailprog $recipient ") || die "Can't open $mailprog!\n";
  144.     print MAIL "Reply-to: $FORM{'username'} ($FORM{'realname'})\n";
  145.     print MAIL "Subject: $FORM{'subject'}\n\n";
  146.     print MAIL "$FORM{'username'} ($FORM{'realname'}) sent the following\n";
  147.     print MAIL "comment about $about:\n";
  148.     print MAIL  "------------------------------------------------------------\n";
  149.     print MAIL "URL: $FORM{'url'}\n";
  150.     print MAIL "$FORM{'comments'}";
  151.     print MAIL "\n------------------------------------------------------------\n";
  152.     print MAIL "Server name: $ENV{'SERVER_NAME'}\n";
  153.     print MAIL "Gateway Interface: $ENV{'GATEWAY_INTERFACE'}\n";
  154.     print MAIL "Path Info: $ENV{'PATH_INFO'}\n";
  155.     print MAIL "Path Translated: $ENV{'PATH_TRANSLATED'}\n";
  156.     print MAIL "Script Name: $ENV{'SCRIPT_NAME'}\n";
  157.     print MAIL "Server protocol: $ENV{'SERVER_PROTOCOL'}\n";
  158.     print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n";
  159.     print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
  160.     print MAIL "User Agent: $ENV{'HTTP_USER_AGENT'}\n"
  161.       if defined($ENV{'HTTP_USER_AGENT'});
  162.     close (MAIL);
  163. }
  164.  
  165.