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_e.cgi < prev    next >
Text File  |  2017-09-21  |  8KB  |  292 lines

  1. #!/usr/local/bin/perl
  2.  
  3. # theme_add_comment_e.cgi
  4. # Comments construction program in Japan theme pavilion for English page
  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/02 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. $ac_comment_file = "$ThemePath/logs/theme_ac_comments.html";
  38. $ac_tmp = "$ThemePath/logs/theme_ac_comments.html.new";
  39. $ac_comment_file_e = "$ThemePath/logs/theme_ac_comments_e.html";
  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. #
  53. $in{'recommend_url'} =~ s/http:\/\///g;
  54.  
  55.  
  56. #
  57. # HTMLÑ╪Ñ├Ñ└╜╨╬╧
  58. #
  59. print "Content-type: text/html\n\n";
  60.  
  61. #
  62. # Ñ│ÑßÑ≤Ñ╚ñ¼╢⌡ñ╩ñΘ╜¬╬╗
  63. #
  64. if (!$in{'theme_comment'} && !$in{'recommend_url'}) {
  65.     &err("Sorry, your comment seems contains no data.\n");
  66. }
  67.  
  68. #
  69. # ñ└ñ∞ñ½ñ¼╜±ñ¡╣■ñ≤ñ╟ñññδ┤╓ñ╧┬╘ñ─
  70. # ñóñ▐ñΩ┬╘ñ─ñ╩ñΘ╜¬╬╗
  71. #
  72. #for($count = 0; -f "$ac_tmp" || -f "$ac_tmp_e"; $count++) {
  73. #    sleep(1);
  74. #    &err_no_unlink("Sorry, another person is writing now.") if ($count > 5);
  75. #}
  76.  
  77.  
  78. # get user's name
  79. &get_cookie;
  80.  
  81. #
  82. # ─╔╡¡Ñ╒ÑíÑñÑδñ╦╦Σñß╣■ñ≤ñ╟íótmpñ╦╜±ñ¡ñ└ñ╣
  83. #open (TMP_E, ">$ac_tmp_e") || &err("Can not open temporary file");
  84. #open (FILE_E, "$ac_comment_file_e") || &err("Can not open comment file");
  85. #while(<FILE_E>) {
  86. #    if (/<!---INSERT HERE--->/) {
  87. #        print TMP_E "<!---INSERT HERE--->\n";
  88. #        print TMP_E "<!------------ Comments from user ---------->\n";
  89. #        print TMP_E "<table width=470>\n<tr><td width=40 valign=top>\n";
  90. #        if ($in{'recommend_url'}) {
  91. #            print TMP_E "<img src=\"$ThemeSite$ThemeURL/comments/image/recom.gif\">\n</td>\n";
  92. #        } else {
  93. #            print TMP_E "<img src=\"$ThemeSite$ThemeURL/comments/image/com.gif\">\n</td>\n";
  94. #        }
  95. #        print TMP_E "<td width=300>\n";
  96. #        print TMP_E "<b> $week $month $day </b><font size=1>$hour:$min $tz $year</font><br>\n";
  97. #        if ($UserName) {
  98. #            print TMP_E "$UserName";
  99. #        }
  100. #        print TMP_E "<img src=\"$ThemeSite$ThemeURL/image/people.gif\">";
  101. #        if ($Location) {
  102. #            print TMP_E "$Location\n";
  103. #        }
  104. #        print TMP_E "<br>";
  105. #        print TMP_E "<font size=\"2\">";
  106. #        if ($url = $in{'recommend_url'}) {
  107. #            print TMP_E "<a href=\"http://$url\">http://$url</a><p>\n";
  108. #        }
  109. #        $code = &jcode'convert($in{'theme_comment'}, 'jis');
  110. #        print TMP_E "$in{'theme_comment'}";
  111. #        print TMP_E "</font></p></td><td width=130></td></tr>\n</table>\n";
  112. #    } else {            
  113. #         print TMP_E $_;        
  114. #    }                
  115. #}
  116. #close(FILE_E);
  117. #close(TMP_E);
  118.  
  119. #
  120. # tmp ñ╬╞Γ═╞ñ≥Ñ│ÑßÑ≤Ñ╚ñ╬HTMLÑ╒ÑíÑñÑδñ╪╛σ╜±ñ¡
  121. #
  122. #open (TMP_E, "<$ac_tmp_e") || &err("Can not open tmp file");
  123. #open (FILE_E, ">$ac_comment_file_e") || &err("Can not open comment file");
  124. #while(<TMP_E>) {
  125. #    print FILE_E $_;
  126. #}
  127. #close(FILE_E);
  128. #close(TMP_E);
  129.  
  130.  
  131. #
  132. # ┐╖ñ╖ññ╞Γ═╞ñ≥╔╕╜α╜╨╬╧ñ╪╜╨╬╧
  133. #
  134. #open (FILE_E, "<$ac_comment_file_e") || &err("Can not open comment file");
  135. #while(<FILE_E>) {
  136. #    &ac_kprint($_);
  137. #}
  138.  
  139. #
  140. # ╞ⁿ╦▄╕∞╚╟─╔╡¡Ñ╒ÑíÑñÑδñ╦╦Σñß╣■ñ≤ñ╟íótmpñ╦╜±ñ¡ñ└ñ╣
  141. #open (TMP, ">$ac_tmp") || &err("Can not open temporary file for japanese");
  142. #open (FILE, "$ac_comment_file") || &err("Can not open comment file for japanese");
  143. #while(<FILE>) {
  144. #    if (/<!---INSERT HERE--->/) {
  145. #        print TMP "<!---INSERT HERE--->\n";
  146. #        print TMP "<!------------ Comments from user ---------->\n";
  147. #        print TMP "<table width=470>\n<tr><td width=40 valign=top>\n";
  148. #        if ($in{'recommend_url'}) {
  149. #            print TMP "<img src=\"$ThemeSite$ThemeURL/comments/image/recom.gif\">\n</td>\n";
  150. #        } else {
  151. #            print TMP "<img src=\"$ThemeSite$ThemeURL/comments/image/com.gif\">\n</td>\n";
  152. #        }
  153. #        print TMP "<td width=300>\n";
  154. #        print TMP "<b> $week $month $day </b><font size=1>$hour:$min $tz $year</font><br>\n";
  155. #        if ($UserName) {
  156. #            print TMP "$UserName";
  157. #        }
  158. #        print TMP "<img src=\"$ThemeSite$ThemeURL/image/people.gif\">";
  159. #        if ($Location) {
  160. #            print TMP "$Location\n";
  161. #        }
  162. #        print TMP "<br>";
  163. #        print TMP "<font size=\"2\">";
  164. #        if ($url = $in{'recommend_url'}) {
  165. #            print TMP "<a href=\"http://$url\">http://$url</a><p>\n";
  166. #        }
  167. #        $code = &jcode'convert($in{'theme_comment'}, 'jis');
  168. #        print TMP "$in{'theme_comment'}";
  169. #        print TMP "</p></td><td width=130></td></tr>\n</table>\n";
  170. #    } else {            
  171. #         print TMP $_;        
  172. #    }                
  173. #}
  174. #close(FILE);
  175. #close(TMP);
  176.  
  177. #
  178. # tmp(j) ñ╬╞Γ═╞ñ≥╞ⁿ╦▄╕∞╚╟Ñ│ÑßÑ≤Ñ╚ñ╬HTMLÑ╒ÑíÑñÑδñ╪╛σ╜±ñ¡
  179. #
  180. #open (TMP, "<$ac_tmp") || &err("Can not open tmp file for japanese");
  181. #open (FILE, ">$ac_comment_file") || &err("Can not open comment file for japanese");
  182. #while(<TMP>) {
  183. #    print FILE $_;
  184. #}
  185. #close(FILE);
  186. #close(TMP);
  187.  
  188.  
  189. #
  190. # ┐╖├σÑ│ÑßÑ≤Ñ╚ñ╬─╠├╬
  191. #
  192. if (open(ML, "| /usr/local/bin/nkf -j | /usr/lib/sendmail theme-staff\@expo96.ad.jp")) {
  193.     print ML "From: sensorium-comment-page\@chat.expo96.ad.jp\n";
  194.     print ML "Subject: New Comment Comes!\n";
  195.     print ML "X-Mailer: theme_add_comment_e.pl\n";
  196.     print ML "\n";
  197.     print ML "Ñ│ÑßÑ≤Ñ╚Ñδí╝Ñα(▒╤╕∞╚╟)ñ╦░╩▓╝ñ╬Ñ│ÑßÑ≤Ñ╚ñ¼╞╧ñ¡ñ▐ñ╖ñ┐íú\n";
  198.     print ML "------------------------------------------------------\n";
  199.     if ($UserName) {
  200.         print ML "From: $UserName\n";
  201.     }
  202.     if ($url = $in{'recommend_url'}) {
  203.         print ML "Recommended URL: http://$url\n";
  204.     }
  205.     $code = &jcode'convert($in{'theme_comment'}, 'jis');
  206.     print ML "$in{'theme_comment'}";
  207. }
  208. close(ML);
  209.  
  210. #
  211. # tmp Ñ╒ÑíÑñÑδ║∩╜ⁿ
  212. #
  213. #unlink "$ac_tmp_e";
  214. #unlink "$ac_tmp";
  215.  
  216. #
  217. # ┼╨╧┐╜¬╬╗▓Φ╠╠
  218. #
  219. print "<html><head>\n";
  220. print "<title>Thank you</title>";
  221. print "</head><body bgcolor=\"#ffffff\">\n";
  222. print "<center><h3>";
  223. print "<p>Thank you!<br>Your message will be added later.";
  224. print "</a></p></h3></center>\n";
  225. print "<hr>";
  226. print "<address><center><font size=\"3\"><i>Theme pavilion \"sensorium\"</i></font><br>";
  227. 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";
  228.  
  229. #
  230. # ╜¬╬╗
  231. #
  232. exit(0);
  233.  
  234. ### sub routines ###
  235. #
  236. # JIS ñ╟printñ╣ñδ
  237. #
  238. sub ac_kprint {
  239.     ($ac_print_line) = @_;
  240.     $code = &jcode'convert(*ac_print_line, 'jis');    
  241.     print "$ac_print_line";
  242. }
  243.  
  244. #
  245. # Ñ¿ÑΘí╝ñ╬╛∞╣τ
  246. #
  247. sub err{
  248.     print "<html><head>\n";
  249.     print "<title>result</title>";
  250.     print "</head><body bgcolor=\"#ffffff\">\n";
  251.     local($msg) = @_;
  252.     print "<p>$msg</p>\n";
  253.     close FILE;
  254.     close TMP;
  255.     unlink "$ac_tmp_e";
  256.     unlink "$ac_tmp";
  257.     print "</BODY></HTML>\n";
  258.     exit;
  259. }
  260.  
  261. sub err_no_unlink{
  262.     print "<html><head>\n";
  263.     print "<title>result</title>";
  264.     print "</head><body bgcolor=\"#ffffff\">\n";
  265.     local($msg) = @_;
  266.     print "<p>$msg</p>\n";
  267.     print "</BODY></HTML>\n";
  268.     exit;
  269. }
  270.  
  271. #
  272. # Ñ┴ѺÑ├Ñ»ÑñÑ≤ñ╖ñ╞ñññδ┐═ñ╬╠╛┴░ñ≥╞└ñδ
  273. # Copyright 1995 Jonathan Haggan
  274. #
  275. sub get_cookie {
  276.   $CookieEnv = $ENV{'HTTP_COOKIE'};
  277.   @Cookies = split(/\;/,$CookieEnv);
  278.   foreach $Cookie (@Cookies) {
  279.     @CurrentCookie = split(/=/,$Cookie);
  280.     $CurrentCookie[0] =~ s/ //;
  281.     if ($CurrentCookie[0] eq 'NAME') {
  282.       $UserName = $CurrentCookie[1];
  283.     }
  284.     if ($CurrentCookie[0] eq 'LOCATION') {
  285.       $Location = $CurrentCookie[1];
  286.     }
  287.   }
  288. }
  289.  
  290.