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
/
theme_add_comment.pl
< prev
next >
Wrap
Perl Script
|
2017-09-21
|
4KB
|
169 lines
#!/usr/local/bin/perl
# theme_add_comment.pl
# Comments construction program in Japan theme pavilion
# kawauso@acs.dnp.co.jp
# 95/12/27
#
# THIS CODE USES THESE LIBRARIES
#
# cgi-lib.pl Copyright 1994 Steven E. Brenner
#
# jcode.pl Copyright (c) 1991,1992 Software Research Associates, Inc.
# Original by srekcah@sra.co.jp, Feb 1992
# Maintained by Kazumasa Utashiro <utashiro@sra.co.jp>
#
require 'cgi-lib.pl';
require 'jcode.pl';
&ReadParse(*in); # initialize for cgi-lib
#
# ñññφñññφñ╩╩╤┐⌠ñ╬Ñ╗Ñ├Ñ╚
#
$date = `date -u`;
chop($date);
#
# Ñ│ÑßÑ≤Ñ╚ñ≥─╔╡¡ñ╣ñδÑ╒ÑíÑñÑδñ╬░╠├╓ñ≥╞└ñδ
#
########
#### www.mediagalxy.co.jpÑ╞Ñ╣Ñ╚═╤ ═╫╜±ñ¡╩╤ñ¿
########
$ac_comment_file = "/stage/htdocs/Japan/Theme/logs/theme_ac_comments.html";
$ac_comment_url = "http://chat.expo96.ad.jp/Japan/Theme/sense";
$ac_tmp = "/stage/htdocs/Japan/Theme/logs/theme_ac_comments.html.new";
#
# HTMLÑ╪Ñ├Ñ└╜╨╬╧
#
print "Content-type: text/html\n\n";
#
# Ñ│ÑßÑ≤Ñ╚ñ¼╢⌡ñ╩ñΘ╜¬╬╗
#
if (!$in{'theme_comment'}) {
&err("Sorry, your comment seems contains no data.\n");
}
#
# ñ└ñ∞ñ½ñ¼╜±ñ¡╣■ñ≤ñ╟ñññδ┤╓ñ╧┬╘ñ─
# ñóñ▐ñΩ┬╘ñ─ñ╩ñΘ╜¬╬╗
#
for($count = 0; -f "$ac_tmp"; $count++) {
sleep(1);
&err("Sorry, another person is writing now.") if ($count > 5);
}
#
# ─╔╡¡Ñ╒ÑíÑñÑδñ╦╦Σñß╣■ñ≤ñ╟íótmpñ╦╜±ñ¡ñ└ñ╣
#
open (TMP, ">$ac_tmp") || &err("Can not open temporary file");
open (FILE, "$ac_comment_file") || &err("Can not open comment file");
while(<FILE>) {
if (/<!---INSERT HERE--->/) {
print TMP "<!---INSERT HERE--->\n";
print TMP "<!------------ Comments from user ---------->\n";
print TMP "<table width=450>\n<tr><td width=33 valign=top>\n";
print TMP "<img src=\"$ac_comment_url/image/zo1.gif\"";
print TMP "width=32 height=23>\n</td>\n<td width=300>\n";
print TMP "<font size=1><b>$date</b><br></font><br>\n";
$code = &jcode'convert($in{'theme_comment'}, 'jis');
print TMP "$in{'theme_comment'}";
print TMP "</p></td><td width=67></td></tr>\n</table>\n";
} else {
print TMP $_;
}
}
close(FILE);
close(TMP);
#
# tmp ñ╬╞Γ═╞ñ≥Ñ│ÑßÑ≤Ñ╚ñ╬HTMLÑ╒ÑíÑñÑδñ╪╛σ╜±ñ¡
#
open (TMP, "<$ac_tmp") || &err("Can not open tmp file");
open (FILE, ">$ac_comment_file") || &err("Can not open comment file");
while(<TMP>) {
print FILE $_;
}
close(FILE);
close(TMP);
#
# ┐╖ñ╖ññ╞Γ═╞ñ≥╔╕╜α╜╨╬╧ñ╪╜╨╬╧
#
open (FILE, "<$ac_comment_file") || &err("Can not open comment file");
while(<FILE>) {
&ac_kprint($_);
}
#
# ┼╨╧┐╜¬╬╗HTML╜╨╬╧
#
#&ac_kprint("<h3><p align=center>ñóñΩñ¼ñ╚ñªñ┤ñ╢ñññ▐ñ╣íú<br>\n");
#&ac_kprint("ñóñ╩ñ┐ñ╬Ñ│ÑßÑ≤Ñ╚ñ≥<a href=\"$ac_comment_url/comments.html\">");
#&ac_kprint("╡─╗÷╧┐</a>ñ╦─╔▓├ñ╖ñ▐ñ╖ñ┐íú</p>\n");
#print "<p align=center>Thank you!<br>\nYour comment has added to";
#print "<a href=\"$ac_comment_url/comments.html\">";
#print "COMMENT LIST.</a></p></h3>\n";
#
# tmp Ñ╒ÑíÑñÑδ║∩╜ⁿ
#
unlink "$ac_tmp";
#
# JIS ñ╟printñ╣ñδ
#
sub ac_kprint {
($ac_print_line) = @_;
$code = &jcode'convert(*ac_print_line, 'jis');
print "$ac_print_line";
}
#
# Ñ¿ÑΘí╝ñ╬╛∞╣τ
#
sub err{
print "<html><head>\n";
print "<title>result</title>";
print "</head><body bgcolor=\"#ffffff\">\n";
local($msg) = @_;
print "<p>$msg</p>\n";
close FILE;
close TMP;
unlink "$ac_tmp";
print "</BODY></HTML>\n";
exit;
}
#
# Ñ┴ѺÑ├Ñ»ÑñÑ≤ñ╖ñ╞ñññδ┐═ñ╬╠╛┴░ñ≥╞└ñδ
# Copyright 1995 Jonathan Haggan
#
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";
}
}