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