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
/
entry.cgi
< prev
next >
Wrap
Text File
|
2017-09-21
|
8KB
|
324 lines
#!/usr/local/bin/perl
$| = 1;
# script for meeting room
# jrh
$CgiPath = '/stage/htdocs/cgi-bin/Japan/Theme';
push(@INC, "$CgiPath");
require 'jcode.pl'; # tends to be in /usr/local/lib/perl
require 'read-form.pl'; # tends to be in your cgi path
require 'meetinit.pl';
require 'frames.pl';
$ThisFile = '/stage/htdocs/cgi-bin/Japan/Theme/entry.cgi';
# print "Content-type: text/html\n\n";
$UserName = '';
&get_referer;
&get_cookie;
&read_in_data;
if ($UserName ne '') {
&init_dbm;
&check_frames;
if ($Open == 1) {
&log_user;
&print_frames;
}
else {
if ($Present == 1) {
&reject_present;
}
else {
&reject_full;
}
}
}
else {
&reject_user;
}
&close_dbm;
#########################################################################
sub get_referer {
$Referer = $ENV{'HTTP_REFERER'};
}
sub get_cookie {
$CookieEnv = $ENV{'HTTP_COOKIE'};
@Cookies = split(/\;/,$CookieEnv);
foreach $Cookie (@Cookies) {
# print "Cookie : $Cookie\n";
@CurrentCookie = split(/=/,$Cookie);
$CurrentCookie[0] =~ s/ //;
# print "Cookie0 : A$CurrentCookie[0]B\n\n";
# print "Cookie1 : $CurrentCookie[1]\n\n";
if ($CurrentCookie[0] eq 'NAME') {
$UserName = $CurrentCookie[1];
# print "Cookieif : $UserName";
}
if ($CurrentCookie[0] eq 'LOCATION') {
$Location = $CurrentCookie[1];
}
$UserName = "$UserName\@$Location";
$UserName =~ s/@@/@/;
}
}
sub read_in_data {
# read in submitted form data contents into the hash %FormDataHash
&ReadInFormData(\%FormDataHash);
foreach $Key (keys(%FormDataHash)) {
# print "//$Key:$FormDataHash{$Key}//\n";
}
$OwnURL = 0;
$GifName = "image/$FormDataHash{'gif'}";
if ($GifName eq 'image/') {
$GifName = $FormDataHash{'urlgif'};
if ($GifName eq 'http://') {
$GifName = 'image/face1.gif';
}
else {
$OwnURL = 1;
}
}
$ParkName = $FormDataHash{'park'};
if ($OwnURL == 0) {
$Temp = $GifName;
$GifName = "$ThemeURL/$ParkName/park/$Temp";
}
# print "$FormDataHash{'gif'}\n";
# print "$UserName\n";
}
sub init_dbm {
$LastPath = "$ThemeDBMPath/$ParkName/$LastAccess";
$UserPath = "$ThemeDBMPath/$ParkName/$UserAccess";
$UpdatePath = "$ThemeDBMPath/$ParkName/$LastUpdate";
$EntryPath = "$ThemeDBMPath/$ParkName/$EntryTime";
$GifPath = "$ThemeDBMPath/$ParkName/$GifNumber";
$ColorFilePath = "$ThemeDBMPath/$ParkName/$ColorFile";
$ColorNamesPath = "$ThemeDBMPath/$ParkName/$ColorNames";
dbmopen(%LastAccessToPage,$LastPath,0666);
dbmopen(%UserAccessToPage,$UserPath,0666);
dbmopen(%LastUpdateToPage,$UpdatePath,0666);
dbmopen(%EntryToPage,$EntryPath,0666);
dbmopen(%GifToPage,$GifPath,0666);
dbmopen(%Colors,$ColorFilePath,0666);
dbmopen(%ColorName,$ColorNamesPath,0666);
}
sub check_frames {
# Set Up Constant factors
$ExpireTime = time - $ExpiryTime;
$WhileNo = $FrameNo + 1;
$Key = 1;
# Clean out expired frames
while ($Key < $WhileNo) {
if ($LastAccessToPage{$Key} > 0) {
if ($LastAccessToPage{$Key} < $ExpireTime) {
$CleanKey = $Key;
$UserAccessToPage{$Key} = "vacant";
$LastAccessToPage{$Key} = 0;
$LastUpdateToPage{$Key} = time;
$GifToPage{$Key} = "$ThemeSite$ThemeURL/$ParkName/park/image/vacancy.gif";
&clean_frame;
}
}
$Key++;
}
# Check for open frame
$Present = 0;
$Open = 0;
$Key = 1;
while ($Key < $WhileNo) {
if ($UserAccessToPage{$Key} eq $UserName) {
$Present = 1;
}
if ($LastAccessToPage{$Key} == 0) {
$Open = 1;
$LastKey = $Key;
}
$Key++;
}
if ($Present == 0) {
if ($Open == 1) {
&replace_frame;
$EntryToPage{$LastKey} = time;
$LastUpdateToPage{$LastKey} = time;
$UserAccessToPage{$LastKey} = $UserName;
$LastAccessToPage{$LastKey} = time + 1;
if ($GifName =~ /http/) {
$GifToPage{$LastKey} = $GifName;
}
else {
$GifToPage{$LastKey} = "$ThemeSite/$GifName";
}
$ColorName{$UserName} = $Colors{$LastKey};
}
}
else {
$Open = 0;
}
}
sub log_user {
open (TEXT,">> $ThemePath/logs/$ParkName\.entry\.log");
select (TEXT);
print "$UserName : ".gmtime(time)." GMT\n";
select (STDOUT);
close (TEXT);
}
sub print_frames {
select(STDOUT);
# tell the server that we're sending data back now
print "Content-type: text/html\n\n";
# now send the server some html stuff
print "<HTML>\n\n";
print "<HEAD>\n\n";
print "<TITLE>Entrance Room</TITLE>\n";
print "</HEAD>\n\n";
print "<FRAMESET COLS=\"20,60,20\">";
print "<NOFRAMES>";
print "<BODY>\n\n";
print "<H1>No Frames!! don't bother </H1>\n\n";
print "<P></P>";
print "</BODY>\n\n";
print "</NOFRAMES>\n\n";
print "<FRAMESET ROWS=\"33,33,33\">\n\n";
print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park6.html\" NAME=\"FRAME6\">\n\n";
print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park4.html\" NAME=\"FRAME4\">\n\n";
print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park2.html\" NAME=\"FRAME2\">\n\n";
print "</FRAMESET>\n\n";
print "<FRAMESET ROWS=\"*,75\">\n\n";
print "<FRAME SRC=\"$ThemeCgi/meet.cgi?gif=$GifName&username=$UserName&park=$ParkName\" NAME=\"DISPLAY\">\n\n";
print "<FRAME SRC=\"$ThemeCgi/textpre.cgi?username=$UserName&park=$ParkName\" NAME=\"INPUT\">\n\n";
print "</FRAMESET>\n\n";
print "<FRAMESET ROWS=\"33,33,33\">\n\n";
print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park5.html\" NAME=\"FRAME5\">\n\n";
print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park3.html\" NAME=\"FRAME3\">\n\n";
print "<FRAME MARGINWIDTH=\"1\" MARGINHEIGHT=\"1\" SRC=\"$ThemeURL/$ParkName/park/park1.html\" NAME=\"FRAME1\">\n\n";
print "</FRAMESET>\n\n";
print "</FRAMESET>\n\n";
print "</HTML>\n\n";
}
sub reject_user {
select(STDOUT);
# tell the server that we're sending data back now
print "Content-type: text/html\n\n";
# now send the server some html stuff
print "<HTML>\n\n";
print "<HEAD>\n\n";
print "<TITLE>Pocket Park Checkin</TITLE>\n";
print "</HEAD>\n\n";
print "<BODY BGCOLOR=\"\#ff ff ff\">\n\n";
print "<H2>You need to check in to use the Pocket Park";
print "</H2>";
print "<HR>";
print "<P>";
print "<FORM ACTION= \"$ThemeCgi/checkin.cgi\" METHOD=\"POST\">\n\n";
print "Choose a UserName";
print "<BR>\n\n";
print "<INPUT TYPE=\"TEXT\" NAME=\"your_name\" SIZE=10>";
print "<BR>\n\n";
print "<BR>\n\n";
print "What is your location?";
print "<BR>\n\n";
print "<INPUT TYPE=\"TEXT\" NAME=\"your_location\" SIZE=10>";
print "<BR>\n\n";
print "<BR>\n\n";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"park\" VALUE=\"$ParkName\">";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"referer\" VALUE=\"$Referer\">";
print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Submit\">";
print "<INPUT TYPE=\"RESET\" NAME=\"Reset\">";
print "</FORM>";
print "<HR>\n\n";
print "</BODY>\n\n";
print "</HTML>\n\n";
}
sub reject_present {
print "Location: $ThemeSite$ThemeURL/$ParkName/park/present.html\n";
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Redirect</TITLE></HEAD><BODY><H1>Redirect</H1></BODY></HTML>";
}
sub reject_full {
print "Location: $ThemeSite$ThemeURL/$ParkName/park/full.html\n";
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Redirect</TITLE></HEAD><BODY><H1>Redirect</H1></BODY></HTML>";
}
sub close_dbm {
dbmclose(%LastAccessToPage);
dbmclose(%UserAccessToPage);
dbmclose(%EntryToPage);
dbmclose(%GifToPage);
dbmclose(%Colors);
dbmclose(%ColorName);
}