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 / meet.cgi < prev    next >
Text File  |  2017-09-21  |  3KB  |  150 lines

  1. #!/usr/local/bin/perl
  2.  
  3. $| = 1;
  4.  
  5. # script for meeting room
  6.  
  7. # jrh
  8. $CgiPath      = '/stage/htdocs/cgi-bin/Japan/Theme';
  9. push(@INC, "$CgiPath");
  10. require 'jcode.pl'; # tends to be in /usr/local/lib/perl
  11. require 'read-form.pl'; # tends to be in your cgi path
  12. require 'meetinit.pl';
  13. require 'frames.pl';
  14. require 'output.pl';
  15.  
  16. $ThisFile = '/stage/htdocs/cgi-bin/Japan/Theme/meet.cgi';
  17.  
  18. # print "Content-type: text/html\n\n";
  19.  
  20. &read_in_data;
  21. &init_dbm;
  22. &calculate_frame;
  23. &print_frame;
  24. &close_dbm;
  25.  
  26. #########################################################################
  27.  
  28.  
  29.  
  30.  
  31. sub read_in_data {
  32.  
  33.   # read in submitted form data contents into the hash %FormDataHash
  34.   &ReadInFormData(\%FormDataHash);
  35.   $GifName = $FormDataHash{'gif'};
  36.   $UserName = $FormDataHash{'username'};
  37.   $ParkName = $FormDataHash{'park'};
  38.  
  39. # print "$FormDataHash{'gif'}\n";
  40. # print "$FormDataHash{'username'}\n";
  41. }
  42.  
  43. sub init_dbm {
  44.     
  45.   $LastPath = "$ThemeDBMPath/$ParkName/$LastAccess";   
  46.   $UserPath = "$ThemeDBMPath/$ParkName/$UserAccess";   
  47.   $UpdatePath = "$ThemeDBMPath/$ParkName/$LastUpdate";   
  48.   $EntryPath = "$ThemeDBMPath/$ParkName/$EntryTime";   
  49.   $GifPath = "$ThemeDBMPath/$ParkName/$GifNumber";   
  50.   $TextPath = "$ThemeDBMPath/$ParkName/$TextLocation";
  51.   $ColorFilePath = "$ThemeDBMPath/$ParkName/$ColorFile";   
  52.   $ColorNamesPath = "$ThemeDBMPath/$ParkName/$ColorNames";   
  53.   dbmopen(%LastAccessToPage,$LastPath,0666);
  54.   dbmopen(%UserAccessToPage,$UserPath,0666);
  55.   dbmopen(%LastUpdateToPage,$UpdatePath,0666);
  56.   dbmopen(%EntryToPage,$EntryPath,0666);
  57.   dbmopen(%GifToPage,$GifPath,0666);
  58.   dbmopen(%TextDB,$TextPath,0666);
  59.   dbmopen(%Colors,$ColorFilePath,0666);
  60.   dbmopen(%ColorName,$ColorNamesPath,0666);
  61.   
  62. }
  63.  
  64. sub calculate_frame {
  65.  
  66.   $Accessing = 0;
  67.   $ExpireTime = time - $ExpiryTime; 
  68.   $LastKey = 1;
  69.   $WhileNo = $FrameNo + 1;
  70.   $Key = 1;
  71.   $NewUpdate = 0;
  72.  
  73.   while ($Key < $WhileNo) {
  74.  
  75.     if ($UserName eq $UserAccessToPage{$Key}) {
  76.       $Accessing = 1;
  77.       $MyKey = $Key
  78.     }
  79.     $Key++;
  80.   }  
  81.  
  82.   $Key = 1;
  83.  
  84.   while ($Key < $WhileNo) {
  85.  
  86.     if ($LastUpdateToPage{$Key} ge $LastAccessToPage{$MyKey}) {
  87.       $NewFrame{$Key} = 1;
  88.       $NewUpdate = 1;
  89.     }
  90.     else {
  91.       $NewFrame{$Key} = 0;
  92.     }
  93.     $Key++;
  94.   }
  95.  
  96.   if ($Accessing == 1) {
  97.     $LastAccessToPage{$MyKey} = time;
  98.   }
  99.  
  100.   $Key = 1;
  101.  
  102.   while ($Key < $WhileNo) {
  103.     if ($LastAccessToPage{$Key} gt 0) {
  104.       if ($LastAccessToPage{$Key} < $ExpireTime) {
  105.         $CleanKey = $Key;
  106.         $UserAccessToPage{$Key} = "vacant";
  107.         $LastAccessToPage{$Key} = 0;
  108.         $LastUpdateToPage{$Key} = time;
  109.         $GifToPage{$Key} = "$ThemeSite$ThemeURL/$ParkName/park/image/vacancy.gif";
  110.         &clean_frame;
  111.       }
  112.     }
  113.     $Key++;
  114.   }
  115. }
  116.  
  117. sub print_frame {
  118.  
  119.   if ($NewUpdate == 1) {
  120.     $Key = 1;
  121.     $UpdateString = "";
  122.  
  123.     while ($Key < $WhileNo) {
  124.       if ($NewFrame{$Key} == 1) {
  125.         $UpdateString .= "$Key";
  126.         $LastKey = $Key;
  127.       }
  128.       $Key++;
  129.     } 
  130.     chop ($UpdateString);
  131.     &print_user;    
  132.   }
  133.   else {
  134.     &print_meet;
  135.   }
  136.  
  137. }
  138.  
  139.  
  140. sub close_dbm {
  141.  
  142.   dbmclose(%LastAccessToPage);
  143.   dbmclose(%UserAccessToPage);
  144.   dbmclose(%TextDB);
  145.   dbmclose(%Colors);
  146.   dbmclose(%ColorName);
  147.  
  148. }
  149.  
  150.