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
/
mp_ctl.cgi
< prev
next >
Wrap
Text File
|
2017-09-21
|
5KB
|
242 lines
#!/usr/local/bin/perl
$| = 1;
# script for life section of the Theme Kan
# make MeetingPlace frame...
# 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';
$ThisFile = '/stage/htdocs/cgi-bin/Japan/Theme/mp_ctl.cgi';
$UserName = '';
&init_dbm;
&get_cookie;
&check_users;
&print_frames;
&close_dbm;
#########################################################################
sub init_dbm {
$ListLastPath = "$ThemeDBMPath/$ListLast";
$ListUsersPath = "$ThemeDBMPath/$ListUsers";
$UpdatePath = "$ThemeDBMPath/$LastUpdate";
dbmopen(%LastAccessToPage,$ListLastPath,0666);
dbmopen(%UserAccessToPage,$ListUsersPath,0666);
dbmopen(%LastUpdateToPage,$UpdatePath,0666);
}
#
# get username & location
#
sub get_cookie {
$CookieEnv = $ENV{'HTTP_COOKIE'};
&jcode::convert(*CookieEnv, 'jis');
@Cookies = split(/\;/,$CookieEnv);
# print "Cookies! : $CookieEnv\n da";
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/@@/@/;
}
}
#
# check username in dbm-files
#
sub check_users {
$Accessing = 0;
$ExpireTime = time - $ExpiryTime;
$Last = $LastAccessToPage{'1'};
$LastKey = 1;
$TrueNum = 1;
$Count = 1;
$WhileNo = $PeopleNo + 1;
$MyKey = $WhileNo;
$CleanKey = 0;
while ($Count < $WhileNo) {
# print "$UserAccessToPage{$Count} : $Count\n";
if ($UserName eq $UserAccessToPage{$Count}) {
$Accessing = 1;
# $LastAccessToPage{$Count} = time;
$MyKey = $Count;
}
$Count++;
}
if ($Accessing == 1) {
$Last = $LastAccessToPage{$MyKey};
$Key = 1;
while ($Key < $WhileNo) {
if ($ThisLast = $LastUpdateToPage{$Key}) {
if ($UserAccessToPage{$Key} ne 'none' &&
$UserAccessToPage{$Key} ne 'vacant' &&
$UserAccessToPage{$Key} ne '') {
if ($ThisLast gt $Last) {
$NewCommer = 1;
}
}
}
$Key++;
}
}
$Count = 1;
while ($Count < $WhileNo) {
if ($LastAccessToPage{$Count} > 0) {
if ($LastAccessToPage{$Count} < $ExpireTime) {
$CleanKey = $Count;
$UserAccessToPage{$Count} = "none";
$LastAccessToPage{$Count} = 0;
}
}
$Count++;
}
$Count = 1;
if ($Accessing ne $TrueNum) {
while ($Count < $WhileNo) {
$ThisLast = $LastAccessToPage{$Count};
if ($ThisLast < $Last) {
$Last = $ThisLast;
$LastKey = $Count;
}
$Count++;
}
$UserAccessToPage{$LastKey} = $UserName;
$LastUpdateToPage{$LastKey} = time;
$LastAccessToPage{$LastKey} = time + 1;
$NewCommer = 1;
} else {
$LastAccessToPage{$MyKey} = time;
}
}
#
# print html-codes when user is check-in
#
sub print_frames {
if ($UserName) {
if ($NewCommer == 1 || $CleanKey ne 0) {
&print_mp_entry;
} else {
&print_blank;
}
} else {
&print_blank;
}
}
sub print_mp_entry {
# for Kanji
open(NKF, "| /usr/local/bin/nkf -j");
select(NKF);
print "Content-type: text/html\n";
print "Window-target: MP_ENTRY\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<META HTTP-EQUIV=REFRESH CONTENT=\"$RefreshTime; URL=$ThemeCgi/mp_ctl.cgi\">";
print "<TITLE>Meeting Place Control Frame</TITLE>";
print "</HEAD>\n";
# same as "print_frames in mp_entry.cgi"
# now send the server some html stuff
print "<HTML>\n\n";
print "<BASEFONT SIZE=\"3\">\n\n";
print "<BODY BGCOLOR=#669900>\n\n";
print "<CENTER>\n";
print "<FONT SIZE=\"1\">";
print "<A HREF=\"$ThemeSite$ThemeURL/mplog/index.html\" TARGET=\"_top\">\n\n";
print "go Check-in log";
print "</A></FONT></BR>\n";
print "<IMG SRC=\"$ThemeSite$ThemeURL/image/pp.gif\" BORDER=0 VSPACE=\"5\"></BR>\n\n";
# print "<FONT SIZE=\"1\"><A HREF=\"$ThemeSite$ThemeURL/pp/index.html\" TARGET=\"_top\">go Pocket Park</FONT></A>\n\n";
print "<FONT SIZE=\"1\"><A HREF=\"$ThemeSite$ThemeURL/pp/index.html\" TARGET=\"_top\">go Pocket Park</FONT></A>\n\n";
print "</CENTER>\n\n";
print "<HR>\n\n";
print "<FONT SIZE=\"1\"><I>Here comes...</I></FONT><P>\n\n";
foreach $Key (sort(keys(%UserAccessToPage))) {
if ($UserAccessToPage{$Key} ne 'none') {
$UserName = $UserAccessToPage{$Key};
$UserName =~ s/\@/<img src=\"$ThemeSite$ThemeURL\/image\/people\.gif\">/;
print "$UserName\n\n";
print "<BR>\n\n";
}
}
print "</BODY>\n\n";
print "</HTML>\n\n";
}
sub print_blank {
print "Content-type: text/html\n";
print "Window-target: MP_CTL\n\n";
print "<HTML><HEAD>\n";
print "<META HTTP-EQUIV=REFRESH CONTENT=\"$RefreshTime; URL=$ThemeCgi/mp_ctl.cgi\">";
print "<TITLE>Meeting Place Control Frame</TITLE>";
print "</HEAD></HTML>";
}
sub close_dbm {
dbmclose(%LastAccessToPage);
dbmclose(%UserAccessToPage);
dbmclose(%LastUpdateToPage);
}