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 >
Perl Script  |  2017-09-21  |  4KB  |  169 lines

  1. #!/usr/local/bin/perl
  2.  
  3. # theme_add_comment.pl
  4. # Comments construction program in Japan theme pavilion
  5. # kawauso@acs.dnp.co.jp
  6. # 95/12/27
  7. #
  8. # THIS CODE USES THESE LIBRARIES
  9. #
  10. #   cgi-lib.pl  Copyright 1994 Steven E. Brenner
  11. #
  12. #   jcode.pl    Copyright (c) 1991,1992 Software Research Associates, Inc.
  13. #               Original by srekcah@sra.co.jp, Feb 1992
  14. #               Maintained by Kazumasa Utashiro <utashiro@sra.co.jp>
  15. #
  16.  
  17. require 'cgi-lib.pl';
  18. require 'jcode.pl';
  19.  
  20. &ReadParse(*in);        # initialize for cgi-lib
  21.  
  22. #
  23. # ñññφñññφñ╩╩╤┐⌠ñ╬Ñ╗Ñ├Ñ╚
  24. #
  25. $date = `date -u`;
  26. chop($date);
  27. #
  28. # Ñ│ÑßÑ≤Ñ╚ñ≥─╔╡¡ñ╣ñδÑ╒ÑíÑñÑδñ╬░╠├╓ñ≥╞└ñδ
  29. #
  30. ########
  31. #### www.mediagalxy.co.jpÑ╞Ñ╣Ñ╚═╤ ═╫╜±ñ¡╩╤ñ¿
  32. ########
  33. $ac_comment_file = "/stage/htdocs/Japan/Theme/logs/theme_ac_comments.html";
  34. $ac_comment_url = "http://chat.expo96.ad.jp/Japan/Theme/sense";
  35. $ac_tmp = "/stage/htdocs/Japan/Theme/logs/theme_ac_comments.html.new";
  36.  
  37. #
  38. # HTMLÑ╪Ñ├Ñ└╜╨╬╧
  39. #
  40. print "Content-type: text/html\n\n";
  41.  
  42.  
  43. #
  44. # Ñ│ÑßÑ≤Ñ╚ñ¼╢⌡ñ╩ñΘ╜¬╬╗
  45. #
  46. if (!$in{'theme_comment'}) {
  47.     &err("Sorry, your comment seems contains no data.\n");
  48. }
  49.  
  50. #
  51. # ñ└ñ∞ñ½ñ¼╜±ñ¡╣■ñ≤ñ╟ñññδ┤╓ñ╧┬╘ñ─
  52. # ñóñ▐ñΩ┬╘ñ─ñ╩ñΘ╜¬╬╗
  53. #
  54. for($count = 0; -f "$ac_tmp"; $count++) {
  55.     sleep(1);
  56.     &err("Sorry, another person is writing now.") if ($count > 5);
  57. }
  58.  
  59. #
  60. # ─╔╡¡Ñ╒ÑíÑñÑδñ╦╦Σñß╣■ñ≤ñ╟íótmpñ╦╜±ñ¡ñ└ñ╣
  61. open (TMP, ">$ac_tmp") || &err("Can not open temporary file");
  62. open (FILE, "$ac_comment_file") || &err("Can not open comment file");
  63. while(<FILE>) {
  64.     if (/<!---INSERT HERE--->/) {
  65.     print TMP "<!---INSERT HERE--->\n";
  66.     print TMP "<!------------ Comments from user ---------->\n";
  67.     print TMP "<table width=450>\n<tr><td width=33 valign=top>\n";
  68.     print TMP "<img src=\"$ac_comment_url/image/zo1.gif\"";
  69.     print TMP "width=32 height=23>\n</td>\n<td width=300>\n";
  70.     print TMP "<font size=1><b>$date</b><br></font><br>\n";
  71.     $code = &jcode'convert($in{'theme_comment'}, 'jis');
  72.     print TMP "$in{'theme_comment'}";
  73.     print TMP "</p></td><td width=67></td></tr>\n</table>\n";
  74.     } else {            
  75.     print TMP $_;        
  76.     }                
  77. }
  78. close(FILE);
  79. close(TMP);
  80.  
  81. #
  82. # tmp ñ╬╞Γ═╞ñ≥Ñ│ÑßÑ≤Ñ╚ñ╬HTMLÑ╒ÑíÑñÑδñ╪╛σ╜±ñ¡
  83. #
  84. open (TMP, "<$ac_tmp") || &err("Can not open tmp file");
  85. open (FILE, ">$ac_comment_file") || &err("Can not open comment file");
  86. while(<TMP>) {
  87.     print FILE $_;
  88. }
  89. close(FILE);
  90. close(TMP);
  91.  
  92.  
  93. #
  94. # ┐╖ñ╖ññ╞Γ═╞ñ≥╔╕╜α╜╨╬╧ñ╪╜╨╬╧
  95. #
  96. open (FILE, "<$ac_comment_file") || &err("Can not open comment file");
  97. while(<FILE>) {
  98.     &ac_kprint($_);
  99. }
  100.  
  101. #
  102. # ┼╨╧┐╜¬╬╗HTML╜╨╬╧
  103. #
  104. #&ac_kprint("<h3><p align=center>ñóñΩñ¼ñ╚ñªñ┤ñ╢ñññ▐ñ╣íú<br>\n");
  105. #&ac_kprint("ñóñ╩ñ┐ñ╬Ñ│ÑßÑ≤Ñ╚ñ≥<a href=\"$ac_comment_url/comments.html\">");
  106. #&ac_kprint("╡─╗÷╧┐</a>ñ╦─╔▓├ñ╖ñ▐ñ╖ñ┐íú</p>\n");
  107. #print "<p align=center>Thank you!<br>\nYour comment has added to";
  108. #print "<a href=\"$ac_comment_url/comments.html\">";
  109. #print "COMMENT LIST.</a></p></h3>\n";
  110.  
  111.  
  112. #
  113. # tmp Ñ╒ÑíÑñÑδ║∩╜ⁿ
  114. #
  115. unlink "$ac_tmp";
  116.  
  117. #
  118. # JIS ñ╟printñ╣ñδ
  119. #
  120. sub ac_kprint {
  121.     ($ac_print_line) = @_;
  122.     $code = &jcode'convert(*ac_print_line, 'jis');    
  123.     print "$ac_print_line";
  124. }
  125.  
  126. #
  127. # Ñ¿ÑΘí╝ñ╬╛∞╣τ
  128. #
  129. sub err{
  130.     print "<html><head>\n";
  131.     print "<title>result</title>";
  132.     print "</head><body bgcolor=\"#ffffff\">\n";
  133.     local($msg) = @_;
  134.     print "<p>$msg</p>\n";
  135.     close FILE;
  136.     close TMP;
  137.     unlink "$ac_tmp";
  138.     print "</BODY></HTML>\n";
  139.     exit;
  140. }
  141.  
  142.  
  143. #
  144. # Ñ┴ѺÑ├Ñ»ÑñÑ≤ñ╖ñ╞ñññδ┐═ñ╬╠╛┴░ñ≥╞└ñδ
  145. # Copyright 1995 Jonathan Haggan
  146. #
  147. sub get_cookie {
  148.   $CookieEnv = $ENV{'HTTP_COOKIE'};
  149.   @Cookies = split(/\;/,$CookieEnv);
  150.   foreach $Cookie (@Cookies) {
  151. #       print "Cookie : $Cookie\n";
  152.  
  153.     @CurrentCookie = split(/=/,$Cookie);
  154.     $CurrentCookie[0] =~ s/ //;
  155. #      print "Cookie0 : A$CurrentCookie[0]B\n\n";
  156. #      print "Cookie1 : $CurrentCookie[1]\n\n";
  157.     if ($CurrentCookie[0] eq 'NAME') {
  158.       $UserName = $CurrentCookie[1];
  159. #      print "Cookieif : $UserName";
  160.     }
  161.     if ($CurrentCookie[0] eq 'LOCATION') {
  162.       $Location = $CurrentCookie[1];
  163.     }
  164.     $UserName = "$UserName\@$Location";
  165.   }
  166. }
  167.  
  168.