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 / theme_add_comment.cgi < prev    next >
Text File  |  2017-09-21  |  6KB  |  238 lines

  1. #!/usr/local/bin/perl
  2.  
  3. # theme_add_comment.cgi
  4. # Comments construction program in Japan theme pavilion
  5. # kawauso@acs.dnp.co.jp
  6. # 95/12/27
  7. # updated 96/02/13 by haruki@st.rim.or.jp
  8. # updated 96/03/08 by haruki@st.rim.or.jp
  9. # updated 96/05/01 by haruki@st.rim.or.jp
  10. # updated 96/12/19 by haruki@st.rim.or.jp
  11. #
  12. # THIS CODE USES THESE LIBRARIES
  13. #
  14. #   cgi-lib.pl  Copyright 1994 Steven E. Brenner
  15. #
  16. #   jcode.pl    Copyright (c) 1991,1992 Software Research Associates, Inc.
  17. #               Original by srekcah@sra.co.jp, Feb 1992
  18. #               Maintained by Kazumasa Utashiro <utashiro@sra.co.jp>
  19. #
  20.  
  21. require 'cgi-lib.pl';
  22. require 'jcode.pl';
  23. require 'meetinit.pl';
  24.  
  25. &ReadParse(*in);        # initialize for cgi-lib
  26.  
  27. #
  28. # ñññφñññφñ╩╩╤┐⌠ñ╬Ñ╗Ñ├Ñ╚
  29. #
  30. $date = `date`;
  31. chop($date);
  32. ($week, $month, $day, $time, $tz, $year) = split(' ', $date);
  33. ($hour, $min, $sec) = split(/:/, $time);
  34.  
  35. #
  36. # Ñ│ÑßÑ≤Ñ╚ñ≥─╔╡¡ñ╣ñδÑ╒ÑíÑñÑδñ╬░╠├╓ñ≥╞└ñδ
  37. #
  38. $ac_comment_file = "$ThemePath/logs/theme_ac_comments.html";
  39. $ac_tmp = "$ThemePath/logs/theme_ac_comments.html.new";
  40. $ac_tmp_e = "$ThemePath/logs/theme_ac_comments_e.html.new";
  41.  
  42. #
  43. # Ñ│ÑßÑ≤Ñ╚ñ╬└░╖┴(▓■╣╘▓■╣╘ñ≥<p>ñ╦)
  44. #
  45. $in{'theme_comment'} =~ s/\r//g;
  46. $in{'theme_comment'} =~ s/\n\n/<\/p><p>/g;
  47. $in{'theme_comment'} =~ s/\n//g;
  48. $in{'theme_comment'} =~ s/<p><\/p>//g;
  49.  
  50. #
  51. # recommend url ñ╬├µ┐╚ΦñΩ╜╨ñ#
  52. $in{'recommend_url'} =~ s/http:\/\///g;
  53.  
  54. #
  55. # HTMLÑ╪Ñ├Ñ└╜╨╬╧
  56. #
  57. print "Content-type: text/html\n\n";
  58.  
  59.  
  60. #
  61. # Ñ│ÑßÑ≤Ñ╚ñ¼╢⌡ñ╩ñΘ╜¬╬╗
  62. #
  63. if (!$in{'theme_comment'} && !$in{'recommend_url'}) {
  64.     &err("Sorry, your comment seems contains no data.\n");
  65. }
  66.  
  67. #
  68. # ñ└ñ∞ñ½ñ¼╜±ñ¡╣■ñ≤ñ╟ñññδ┤╓ñ╧┬╘ñ─
  69. # ñóñ▐ñΩ┬╘ñ─ñ╩ñΘ╜¬╬╗
  70. #
  71. #for($count = 0; -f "$ac_tmp" || -f "$ac_tmp_e"; $count++) {
  72. #    sleep(1);
  73. #    &err_no_unlink("Sorry, another person is writing now.") if ($count > 5);
  74. #}
  75.  
  76.  
  77. # get user's name
  78. &get_cookie;
  79.  
  80. #
  81. # ─╔╡¡Ñ╒ÑíÑñÑδñ╦╦Σñß╣■ñ≤ñ╟íótmpñ╦╜±ñ¡ñ└ñ╣
  82. ## 
  83. #open (TMP, ">$ac_tmp") || &err("Can not open temporary file");
  84. #open (FILE, "$ac_comment_file") || &err("Can not open comment file");
  85. #while(<FILE>) {
  86. #    if (/<!---INSERT HERE--->/) {
  87. #        print TMP "<!---INSERT HERE--->\n";
  88. #        print TMP "<!------------ Comments from user ---------->\n";
  89. #        print TMP "<table width=470>\n<tr><td width=40 valign=top>\n";
  90. #        if ($in{'recommend_url'}) {
  91. #            print TMP "<img src=\"$ThemeSite$ThemeURL/comments/image/recom.gif\">\n</td>\n";
  92. #        } else {
  93. #            print TMP "<img src=\"$ThemeSite$ThemeURL/comments/image/com.gif\">\n</td>\n";
  94. #        }
  95. #        print TMP "<td width=300>\n";
  96. #        print TMP "<b> $week $month $day </b><font size=1>$hour:$min $tz $year</font><br>\n";
  97. #        if ($UserName) {
  98. #            print TMP "$UserName";
  99. #        }
  100. #        print TMP "<img src=\"$ThemeSite$ThemeURL/image/people.gif\">";
  101. #        if ($Location) {
  102. #            print TMP "$Location\n";
  103. #        }
  104. #        print TMP "<br>";
  105. #        print TMP "<font size=\"2\">";
  106. #        if ($url = $in{'recommend_url'}) {
  107. #            print TMP "<a href=\"http://$url\">http://$url</a><p>\n";
  108. #        }
  109. #        $code = &jcode'convert($in{'theme_comment'}, 'jis');
  110. #        print TMP "$in{'theme_comment'}";
  111. #        print TMP "</p></td><td width=130></td></tr>\n</table>\n";
  112. #    } else {            
  113. #         print TMP $_;        
  114. #    }                
  115. #}
  116. #close(FILE);
  117. #close(TMP);
  118.  
  119. #
  120. # tmp ñ╬╞Γ═╞ñ≥Ñ│ÑßÑ≤Ñ╚ñ╬HTMLÑ╒ÑíÑñÑδñ╪╛σ╜±ñ¡
  121. #
  122. #open (TMP, "<$ac_tmp") || &err("Can not open tmp file");
  123. #open (FILE, ">$ac_comment_file") || &err("Can not open comment file");
  124. #while(<TMP>) {
  125. #    print FILE $_;
  126. #}
  127. #close(FILE);
  128. #close(TMP);
  129.  
  130.  
  131. #
  132. # ┐╖ñ╖ññ╞Γ═╞ñ≥╔╕╜α╜╨╬╧ñ╪╜╨╬╧
  133. #
  134. #open (FILE, "<$ac_comment_file") || &err("Can not open comment file");
  135. #while(<FILE>) {
  136. #    &ac_kprint($_);
  137. #}
  138.  
  139. # ┐╖├σÑ│ÑßÑ≤Ñ╚ñ╬─╠├╬
  140. #
  141. if (open(ML, "| /usr/local/bin/nkf -j | /usr/lib/sendmail theme-staff\@expo96.ad.jp")) {
  142.     print ML "From: sensorium-comment-page\@chat.expo96.ad.jp\n";
  143.     print ML "Subject: New Comment Comes!\n";
  144.     print ML "X-Mailer: theme_add_comment.pl\n";
  145.     print ML "\n";
  146.     print ML "Ñ│ÑßÑ≤Ñ╚Ñδí╝Ñαñ╦░╩▓╝ñ╬Ñ│ÑßÑ≤Ñ╚ñ¼╞╧ñ¡ñ▐ñ╖ñ┐íú\n";
  147.     print ML "------------------------------------------------------\n";
  148.     if ($UserName) {
  149.         print ML "From: $UserName\n";
  150.     }
  151.     if ($url = $in{'recommend_url'}) {
  152.         print ML "Recommended URL: http://$url\n";
  153.     }
  154.     $code = &jcode'convert($in{'theme_comment'}, 'jis');
  155.     print ML "$in{'theme_comment'}";
  156. }
  157. close(ML);
  158.  
  159. #
  160. # tmp Ñ╒ÑíÑñÑδ║∩╜ⁿ
  161. #
  162. #unlink "$ac_tmp";
  163.  
  164. #
  165. # ┼╨╧┐╜¬╬╗▓Φ╠╠
  166. #
  167. print "<html><head>\n";
  168. print "<title>Thank you</title>";
  169. print "</head><body bgcolor=\"#ffffff\">\n";
  170. print "<center><h3>";
  171. print "<p>Thank you!<br>Your message will be added later.";
  172. print "</a></p></h3></center>\n";
  173. print "<hr>";
  174. print "<address><center><font size=\"3\"><i>Theme pavilion \"sensorium\"</i></font><br>";
  175. print "<font size=\"1\"><i>INTERNET 1996 WORLD EXPOSITION (<a href=\"http://park.org/main.text.html\" target=\"index-frame\">World Public Park</a>) / JAPAN (<a href=\"http://park.org/Japan/\" target=\"index-frame\">Japan EXPO home page</a>)</i></font></center></address></td></tr>\n";
  176.  
  177. #
  178. # ╜¬╬╗
  179. #
  180. exit(0);
  181.  
  182. ### sub routines ###
  183. #
  184. # JIS ñ╟printñ╣ñδ
  185. #
  186. sub ac_kprint {
  187.     ($ac_print_line) = @_;
  188.     $code = &jcode'convert(*ac_print_line, 'jis');    
  189.     print "$ac_print_line";
  190. }
  191.  
  192. #
  193. # Ñ¿ÑΘí╝ñ╬╛∞╣τ
  194. #
  195. sub err{
  196.     print "<html><head>\n";
  197.     print "<title>result</title>";
  198.     print "</head><body bgcolor=\"#ffffff\">\n";
  199.     local($msg) = @_;
  200.     print "<p>$msg</p>\n";
  201.     close FILE;
  202.     close TMP;
  203.     unlink "$ac_tmp";
  204.     print "</BODY></HTML>\n";
  205.     exit;
  206. }
  207.  
  208. sub err_no_unlink{
  209.     print "<html><head>\n";
  210.     print "<title>result</title>";
  211.     print "</head><body bgcolor=\"#ffffff\">\n";
  212.     local($msg) = @_;
  213.     print "<p>$msg</p>\n";
  214.     print "</BODY></HTML>\n";
  215.     exit;
  216. }
  217.  
  218. #
  219. # Ñ┴ѺÑ├Ñ»ÑñÑ≤ñ╖ñ╞ñññδ┐═ñ╬╠╛┴░ñ≥╞└ñδ
  220. # Copyright 1995 Jonathan Haggan
  221. #
  222. sub get_cookie {
  223.   $CookieEnv = $ENV{'HTTP_COOKIE'};
  224.   @Cookies = split(/\;/,$CookieEnv);
  225.   foreach $Cookie (@Cookies) {
  226.     @CurrentCookie = split(/=/,$Cookie);
  227.     $CurrentCookie[0] =~ s/ //;
  228.     if ($CurrentCookie[0] eq 'NAME') {
  229.       $UserName = $CurrentCookie[1];
  230.     }
  231.     if ($CurrentCookie[0] eq 'LOCATION') {
  232.       $Location = $CurrentCookie[1];
  233.     }
  234.   }
  235. }
  236.  
  237.