home *** CD-ROM | disk | FTP | other *** search
/ Internet 1996 World Exposition / park.org.s3.amazonaws.com.7z / park.org.s3.amazonaws.com / cgi-bin / Japan / Theme / entold.cgi < prev    next >
Text File  |  2017-09-21  |  7KB  |  290 lines

  1. #!/usr/local/bin/perl5
  2.  
  3. $| = 1;
  4. # script for meeting room
  5.  
  6. # jrh
  7. $CgiPath      = '/stage/htdocs/cgi-bin/Japan/Theme';
  8. push(@INC, "$CgiPath");
  9. require 'jcode.pl'; # tends to be in /usr/local/lib/perl
  10. require 'read-form.pl'; # tends to be in your cgi path
  11. require 'meetinit.pl';
  12. require 'frames.pl';
  13.  
  14. $ThisFile = '/stage/htdocs/cgi-bin/Japan/Theme/entry.cgi';
  15.  
  16. # print "Content-type: text/html\n\n";
  17.  
  18. $UserName = '';
  19. &get_referer;
  20. &get_cookie;
  21. &read_in_data;
  22. if ($UserName ne '') {
  23.   &init_dbm;
  24.   &check_frames;
  25.   if ($Open == 1) {
  26.     &log_user;
  27.     &print_frames;
  28.   }
  29.   else {
  30.     &reject_full;
  31.   }
  32. }
  33. else {
  34.   &reject_user;
  35. }
  36. &close_dbm;
  37.  
  38. #########################################################################
  39.  
  40.  
  41. sub get_referer {
  42.  
  43.   $Referer = $ENV{'HTTP_REFERER'};
  44. }
  45.  
  46. sub get_cookie {
  47.  
  48.   $CookieEnv = $ENV{'HTTP_COOKIE'};
  49.   @Cookies = split(/\;/,$CookieEnv);
  50.   foreach $Cookie (@Cookies) {
  51. #       print "Cookie : $Cookie\n";
  52.         
  53.     @CurrentCookie = split(/=/,$Cookie);
  54.     $CurrentCookie[0] =~ s/ //;
  55. #      print "Cookie0 : A$CurrentCookie[0]B\n\n";
  56. #      print "Cookie1 : $CurrentCookie[1]\n\n";
  57.     if ($CurrentCookie[0] eq 'NAME') {
  58.       $UserName = $CurrentCookie[1];
  59. #      print "Cookieif : $UserName";
  60.     }
  61.     if ($CurrentCookie[0] eq 'LOCATION') {
  62.       $Location = $CurrentCookie[1];
  63.     }
  64.     $UserName = "$UserName\@$Location";
  65.     $UserName =~ s/@@/@/;
  66.   }
  67. }
  68.  
  69. sub read_in_data {
  70.  
  71. # read in submitted form data contents into the hash %FormDataHash
  72. &ReadInFormData(\%FormDataHash);
  73.  
  74. foreach $Key (keys(%FormDataHash)) {
  75.  
  76. # print "//$Key:$FormDataHash{$Key}//\n";
  77. }
  78.  
  79. $GifName = "image/$FormDataHash{'gif'}";
  80. if ($GifName eq 'image/') {
  81.   $GifName = $FormDataHash{'urlgif'};
  82.   if ($GifName eq 'http://') {
  83.     $GifName = 'image/face1.gif';
  84.   }
  85. }
  86.  
  87. $ParkName = $FormDataHash{'park'};
  88.  
  89. # print "$FormDataHash{'gif'}\n";
  90. # print "$UserName\n";
  91. }
  92.  
  93. sub init_dbm {
  94.  
  95.   $LastPath = "$ThemePath/$ParkName/park/dbm/$LastAccess";   
  96.   $UserPath = "$ThemePath/$ParkName/park/dbm/$UserAccess";   
  97.   $EntryPath = "$ThemePath/$ParkName/park/dbm/$EntryTime";   
  98.   $GifPath = "$ThemePath/$ParkName/park/dbm/$GifNumber";   
  99.   $ColorFilePath = "$ThemePath/$ParkName/park/dbm/$ColorFile";   
  100.   $ColorNamesPath = "$ThemePath/$ParkName/park/dbm/$ColorNames";   
  101.   dbmopen(%LastAccessToPage,$LastPath,0666);
  102.   dbmopen(%UserAccessToPage,$UserPath,0666);
  103.   dbmopen(%EntryToPage,$EntryPath,0666);
  104.   dbmopen(%GifToPage,$GifPath,0666);
  105.   dbmopen(%Colors,$ColorFilePath,0666);
  106.   dbmopen(%ColorName,$ColorNamesPath,0666);
  107.  
  108. }
  109.  
  110.  
  111. sub check_frames  {
  112.  
  113.  
  114. # Set Up Constant factors
  115.   $ExpireTime = time - $ExpiryTime; 
  116.   $WhileNo = $FrameNo + 1;
  117.   $Key = 1;
  118. # Clean out expired frames
  119.  
  120.   while ($Key < $WhileNo) {
  121.     
  122.     if ($LastAccessToPage{$Key} > 0) {
  123.       if ($LastAccessToPage{$Key} < $ExpireTime) {
  124.         $CleanKey = $Key;
  125.         $UserAccessToPage{$Key} = "vacant";
  126.         $LastAccessToPage{$Key} = 0;
  127.         $GifToPage{$Key} = "$ThemeSite$ThemeURL/$ParkName/park/image/vacancy.gif";
  128.         &clean_frame;
  129.       }
  130.     }
  131.     $Key++;
  132.   }
  133.  
  134. # Check for open frame
  135.  
  136.   $Open = 0;
  137.   $Key = 1;
  138.  
  139.   while ($Key < $WhileNo) {
  140.     
  141.     if ($LastAccessToPage{$Key} == 0) {
  142.       $Open = 1;
  143.       $LastKey = $Key;
  144.     }
  145.     $Key++;
  146.   }
  147.   
  148.   if ($Open == 1) {
  149.  
  150.     &replace_frame;
  151.     $UserAccessToPage{$LastKey} = $UserName;
  152.     $LastAccessToPage{$LastKey} = time;
  153.     $EntryToPage{$LastKey} = time;
  154.     if ($GifName =~ /http/) {
  155.       $GifToPage{$LastKey} = $GifName;
  156.     }
  157.     else {
  158.       $GifToPage{$LastKey} = "$ThemeSite$ThemeURL/$ParkName/park/$GifName";
  159.  
  160.     }
  161.     $ColorName{$UserName} = $Colors{$LastKey};
  162.   }
  163. }
  164.  
  165.  
  166. sub log_user {
  167.  
  168.   open (TEXT,">> $ThemePath/logs/$ParkName\.entry\.log");
  169.   select (TEXT);
  170.   print "$UserName : ".gmtime(time)." GMT\n";
  171.   select (STDOUT);
  172.   close (TEXT);
  173. }
  174.  
  175.  
  176. sub print_frames {
  177.  
  178.   select(STDOUT);
  179.   # tell the server that we're sending data back now
  180.   print "Content-type: text/html\n\n";
  181.  
  182.   # now send the server some html stuff
  183.   print "<HTML>\n\n";
  184.  
  185.   print "<HEAD>\n\n";
  186.   print "<TITLE>Entrance Room</TITLE>\n";
  187.   print "</HEAD>\n\n";
  188.  
  189.   print "<FRAMESET COLS=\"20,60,20\">";
  190.   print "<NOFRAMES>";
  191.  
  192.  
  193.   print "<BODY>\n\n";
  194.  
  195.   print "<H1>No Frames!! don't bother </H1>\n\n";
  196.  
  197.   print "<P></P>";
  198.  
  199.   print "</BODY>\n\n";
  200.  
  201.   print "</NOFRAMES>\n\n";
  202.   print "<FRAMESET ROWS=\"33,33,33\">\n\n";
  203.   print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park6.html\" NAME=\"FRAME2\">\n\n";
  204.   print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park4.html\" NAME=\"FRAME3\">\n\n";
  205.   print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park2.html\" NAME=\"FRAME4\">\n\n";
  206.   print "</FRAMESET>\n\n";
  207.   print "<FRAMESET ROWS=\"85,15\">\n\n";
  208.   print "<FRAME SRC=\"$ThemeCgi/meet.cgi?gif=$GifName&username=$UserName&park=$ParkName\" NAME=\"DISPLAY\">\n\n";
  209.   print "<FRAME SRC=\"$ThemeCgi/textpre.cgi?username=$UserName&park=$ParkName\" NAME=\"INPUT\">\n\n";
  210.   print "</FRAMESET>\n\n";
  211.   print "<FRAMESET ROWS=\"33,33,33\">\n\n";
  212.   print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park5.html\" NAME=\"FRAME5\">\n\n";
  213.   print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park3.html\" NAME=\"FRAME6\">\n\n";
  214.   print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park1.html\" NAME=\"FRAME7\">\n\n";
  215.   print "</FRAMESET>\n\n";
  216.   print "</FRAMESET>\n\n";
  217.   print "</HTML>\n\n";
  218. }
  219.  
  220. sub reject_user {
  221.  
  222.   select(STDOUT);
  223.   # tell the server that we're sending data back now
  224.   print "Content-type: text/html\n\n";
  225.  
  226.   # now send the server some html stuff
  227.   print "<HTML>\n\n";
  228.  
  229.   print "<HEAD>\n\n";
  230.   print "<TITLE>Pocket Park Checkin</TITLE>\n";
  231.   print "</HEAD>\n\n";
  232.  
  233.   print "<BODY BGCOLOR=\"\#ff ff ff\">\n\n";
  234.  
  235.   print "<H2>You need to check in to use the Pocket Park";
  236.   print "</H2>";
  237.   print "<HR>";
  238.   print "<P>";
  239.  
  240.   print "<FORM ACTION= \"$ThemeCgi/checkin.cgi\" METHOD=\"POST\">\n\n";
  241.  
  242.   print "Choose a UserName";
  243.   print "<BR>\n\n";
  244.  
  245.   print "<INPUT TYPE=\"TEXT\" NAME=\"your_name\" SIZE=10>";
  246.  
  247.   print "<BR>\n\n";
  248.   print "<BR>\n\n";
  249.   print "What is your location?"; 
  250.   print "<BR>\n\n";
  251.  
  252.   print "<INPUT TYPE=\"TEXT\" NAME=\"your_location\" SIZE=10>";
  253.   print "<BR>\n\n";
  254.   print "<BR>\n\n";
  255.   print "<INPUT TYPE=\"HIDDEN\" NAME=\"park\" VALUE=\"$ParkName\">";  
  256.   print "<INPUT TYPE=\"HIDDEN\" NAME=\"referer\" VALUE=\"$Referer\">";  
  257.  
  258.   print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Submit\">";
  259.   print "<INPUT TYPE=\"RESET\" NAME=\"Reset\">";
  260.   print "</FORM>";
  261.  
  262.   print "<HR>\n\n";
  263.  
  264.   print "</BODY>\n\n";
  265.  
  266.  
  267.   print "</HTML>\n\n";
  268.  
  269. }
  270.  
  271. sub reject_full {
  272.  
  273.   print "Location: $ThemeSite$ThemeURL/$ParkName/park/full.html\n";
  274.   print "Content-type: text/html\n\n";
  275.   print "<HTML><HEAD><TITLE>Redirect</TITLE></HEAD><BODY><H1>Redirect</H1></BODY></HTML>";
  276.  
  277. }
  278.  
  279. sub close_dbm {
  280.  
  281.   dbmclose(%LastAccessToPage);
  282.   dbmclose(%UserAccessToPage);
  283.   dbmclose(%EntryToPage);
  284.   dbmclose(%GifToPage);
  285.   dbmclose(%Colors);
  286.   dbmclose(%ColorName);
  287.  
  288. }
  289.  
  290.