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.0105 / list.cgi < prev    next >
Text File  |  2017-09-21  |  6KB  |  254 lines

  1. #!/usr/local/bin/perl
  2.  
  3. $| = 1;
  4. # script for life section of the Theme Kan
  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.  
  13. $ThisFile = '/stage/htdocs/cgi-bin/Japan/Theme/entry.cgi';
  14.  
  15. # print "Content-type: text/html\n\n";
  16.  
  17. $UserName = '';
  18.  
  19. &read_in_data;
  20. &init_dbm;
  21. &get_cookie;
  22. if ($UserName ne '') {
  23.   &check_users;
  24.   &print_frames;
  25. }
  26. else {
  27.   &Checkin;
  28. }
  29. &close_dbm;
  30.  
  31. #########################################################################
  32.  
  33.  
  34. sub read_in_data {
  35.  
  36. # read in submitted form data contents into the hash %FormDataHash
  37. &ReadInFormData(\%FormDataHash);
  38.  
  39. foreach $Key (keys(%FormDataHash)) {
  40.  
  41. # print "//$Key:$FormDataHash{$Key}//\n";
  42. }
  43.  
  44. $SecName = $FormDataHash{'section'};
  45. $TypeName = $FormDataHash{'sectype'};
  46.  
  47. # print "$FormDataHash{'gif'}\n";
  48. # print "$SecName\n";
  49. # print "$TypeName\n";
  50. }
  51.  
  52. sub init_dbm {
  53.     
  54.   $ListLastPath = "$ThemePath/$SecName/park/dbm/$TypeName/$ListLast";   
  55.   $ListUsersPath = "$ThemePath/$SecName/park/dbm/$TypeName/$ListUsers";   
  56.  
  57.   dbmopen(%LastAccessToPage,$ListLastPath,0666);
  58.   dbmopen(%UserAccessToPage,$ListUsersPath,0666);
  59.  
  60. #  $Count = 1;
  61. #  while ($Count < $PeopleNo) {
  62. #    $UserAccessToPage{$Count} = "none";
  63. #    $LastAccessToPage{$Count} = 0;
  64. #    $Count++;
  65. #  }
  66.  
  67. }
  68.  
  69. sub get_cookie {
  70.  
  71.   $CookieEnv = $ENV{'HTTP_COOKIE'};
  72.   @Cookies = split(/\;/,$CookieEnv);
  73.   foreach $Cookie (@Cookies) {
  74. #       print "Cookie : $Cookie\n";
  75.         
  76.     @CurrentCookie = split(/=/,$Cookie);
  77.     $CurrentCookie[0] =~ s/ //;
  78. #      print "Cookie0 : A$CurrentCookie[0]B\n\n";
  79. #      print "Cookie1 : $CurrentCookie[1]\n\n";
  80.     if ($CurrentCookie[0] eq 'NAME') {
  81.       $UserName = $CurrentCookie[1];
  82. #      print "Cookieif : $UserName";
  83.     }
  84.     if ($CurrentCookie[0] eq 'LOCATION') {
  85.       $Location = $CurrentCookie[1];
  86.     }
  87.     $UserName = "$UserName\@$Location";
  88.     $UserName =~ s/@@/@/;
  89.   }
  90. }
  91.  
  92. sub check_users  {
  93.  
  94.   $Accessing = 0;
  95.   $ExpireTime = time - 33; 
  96.   $Last = $LastAccessToPage{'1'};
  97.   $LastKey = 1;
  98.   $TrueNum = 1;
  99.   $Count = 1;
  100.   $WhileNo = $PeopleNo + 1;
  101.  
  102.   while ($Count < $WhileNo) {
  103. #   print "$UserAccessToPage{$Count} : $Count\n";
  104.     if ($UserName eq $UserAccessToPage{$Count}) {
  105.       $Accessing = 1;
  106.       $LastAccessToPage{$Count} = time;
  107.     }
  108.     $Count++;
  109.   }  
  110.  
  111.   $Count = 1;
  112.  
  113.   if ($Accessing ne $TrueNum) {
  114.  
  115.     while ($Count < $WhileNo) {
  116.     
  117.       $ThisLast = $LastAccessToPage{$Count};
  118.  
  119.       if ($ThisLast < $Last) {
  120.   
  121.         $Last = $ThisLast;
  122.         $LastKey = $Count;
  123.       }
  124.       $Count++;
  125.     }
  126.  
  127.     $UserAccessToPage{$LastKey} = $UserName;
  128. #     print "Replace\n\n";
  129.     $LastAccessToPage{$LastKey} = time;
  130.     $ColorName{$UserName} = $Colors{$LastKey};
  131.   }
  132.  
  133.   $Count = 1;
  134.  
  135.   while ($Count < $WhileNo) {
  136.     if ($LastAccessToPage{$Count} > 0) {
  137.       if ($LastAccessToPage{$Count} < $ExpireTime) {
  138. #      print "$LastAccessToPage{$Count} : $ExpireTime : Clean\n\n";
  139.         $CleanKey = $Count;
  140.         $UserAccessToPage{$Count} = "none";
  141.         $LastAccessToPage{$Count} = 0;
  142.       }
  143.     }
  144.     $Count++;
  145.   }
  146.  
  147. }
  148.  
  149.  
  150. sub print_frames {
  151.  
  152.   select(STDOUT);
  153.   # tell the server that we're sending data back now
  154.   print "Content-type: text/html\n\n";
  155.  
  156.   # now send the server some html stuff
  157.   print "<HTML>\n\n";
  158.  
  159.   print "<HEAD>\n\n";
  160.   print "<TITLE>Entrance Room</TITLE>\n";
  161.   print "</HEAD>\n\n";
  162.  
  163.   print "<META HTTP-EQUIV=REFRESH CONTENT=\"15; URL=list.cgi?section=$SecName§ype=$TypeName\">";
  164.   if ($SecName eq 'linked') {
  165.     print "<BODY>\n\n";
  166.   }
  167.   else {
  168.     print "<BODY BGCOLOR=\"#ffffff\">\n\n";    
  169.   }
  170.  
  171.   if ($TypeName eq 'park') {
  172.  
  173.     print "<center>
  174. <a href=\"$ThemeURL/$SecName/index.html\" target=\"_top\">
  175. <img src=\"$ThemeURL/image/back.gif\" border=0><br>";
  176.  
  177.     if ($SecName eq 'linked') {
  178.       print "<font size=\"2\">Linked Senses</font></a><p>";
  179.     }
  180.     elsif ($SecName eq 'sjapan') {
  181.       print "<font size=\"2\">Sensing Japan</font></a><p>";
  182.     }
  183.     elsif ($SecName eq 'sware') {
  184.       print "<font size=\"2\">Senseware</font></a><p>";
  185.     }
  186.     elsif ($SecName eq 'sense') {
  187.       print "<font size=\"2\">\"Sense\"</font></a><p>";
  188.     }
  189.     elsif ($SecName eq 'library') {
  190.       print "<font size=\"2\">Library</font></a><p>";
  191.     }
  192.     elsif ($SecName eq 'press') {
  193.       print "<font size=\"2\">Media Watch</font></a><p>";
  194.     }
  195.     print "</center>";
  196.   }  
  197.   else {
  198.     print "<center>
  199. <a href=\"$ThemeSite$ThemeURL/$SecName/park/index.html\" target=\"_top\">
  200. <img src=\"$ThemeURL/image/bench.gif\" border=0><br>
  201. <font size=\"2\">Pocket Park</font></a><p>
  202. </center>";
  203.   }
  204.  
  205.   foreach $Key (sort(keys(%UserAccessToPage))) {
  206.     if ($UserAccessToPage{$Key} ne 'none') {
  207.     $UserName = $UserAccessToPage{$Key};
  208.     $UserName =~ s#\@#<img src=\"$ThemeURL/image/people.gif\">#;
  209.     print "$UserName\n\n";
  210.     print "<BR>\n\n";
  211.     }
  212.   }
  213.  
  214.   print "<P></P>";
  215.  
  216.   print "</BODY>\n\n";
  217.  
  218.   print "</HTML>\n\n";
  219. }
  220.  
  221. sub Checkin {
  222.  
  223.   select(STDOUT);
  224.   # tell the server that we're sending data back now
  225.   print "Content-type: text/html\n\n";
  226.  
  227.   # now send the server some html stuff
  228.   print "<HTML>\n\n";
  229.  
  230.   print "<HEAD>\n\n";
  231.   print "<TITLE>Entrance Room</TITLE>\n";
  232.   print "</HEAD>\n\n";
  233.  
  234.   print "<BODY BGCOLOR=\"#ffffff\">\n\n";
  235.  
  236.   print "<CENTER><A HREF=\"$ThemeCgi/checklist.cgi\"><IMG SRC=\"$ThemeURL/image/checkin.gif\" BORDER=0></A></CENTER>";
  237.  
  238.   print "</BODY>\n\n";
  239.  
  240.   print "</HTML>\n\n";
  241. }
  242.  
  243. sub close_dbm {
  244.  
  245.   dbmclose(%LastAccessToPage);
  246.   dbmclose(%UserAccessToPage);
  247.  
  248. }
  249.  
  250.  
  251.  
  252.  
  253.  
  254.