#!/usr/local/bin/perl # WeB dorama Editor version 1.11 # # Script written by Shigeto Nakazawa.(1996/11/27) # This script is free. # Arranged by Ninjinju-su CGI require './jcode.pl'; # --------------------------------- # 各種設定 # --------------------------------- $pass = 'password'; # 必ず半角英数8文字以内で書き換えて下さい。 $mojicode = 'sjis'; # Windows なら 'sjis' UNIX なら 'euc' を推奨。 $logfile = 'dorama.log'; # 記録用ファイル $lockfile = 'dorama.lock'; # 鍵ファイル $lockcheck = 1; # 鍵ファイルの使用(通常は 1 にしてください) $pluscheck = 1; # 登場人物設定(1:自由登録モード 0:管理者限定登録モード) $kyaralogfile = 'kyara.log'; # 登場人物記録用ファイル @plus_colors = ('#000000=くろ', '#FF0000=あか', '#008000=みどり', '#0000FF=あお', '#00FFFF=みずいろ', '#FF8000=みかん', '#804000=ちゃ', '#00C0C0=まりんぶるー', '#FF8080=もも', '#808080=ねずみ'); # 登場人物につける色 $type = '<>'; #ログ形式設定 # --------------------------------- # フォームからデータをもらう # --------------------------------- if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } $typec = $type; $typec =~ s/\\//; @pairs = split(/&/,$buffer); foreach $pair (@pairs) { ($name,$value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; &jcode'convert(*value,$mojicode); $value =~ s/\n//; if ($type ne '<>') { $value =~ s/$typec//; } if ($value ne 'on') { $FORM{$name} = $value; } else { $FORM{$name} = 1; } } $rq_dorama = &change0($FORM{'dorama'}); $rq_actor = &change0($FORM{'actor'}); $pw = $FORM{'pass'}; $typec = $type; $typec =~ s/\\//; # --------------------------------- # HTML出力 # --------------------------------- print <<"_HTML_header_"; Content-type: text/html\n\n
★使い方★
[もどる] _HTML_ exit; } # --------------------------------- # 登場人物名登録 # --------------------------------- sub pluss { $color = $FORM{'color'}; $name = $FORM{'name'}; $name_c = &change0($name); if ($name eq '') { &error("何も書かれていないか、または使用禁止の文字が使われているようです。<は使用しないでください。"); } if (length($name) >= 40) { &error("名前が長すぎます。文字数は全角20字を超えてはいけません。"); } # --------------------------------- # 登場人物専用記録ファイルに登録する # --------------------------------- if ($lockcheck) { $wt = 0; while (-f $lockfile) { $wt++; if ($wt > 19) { &error('強制終了されました。処理は中断されました。'); } sleep 1; } open (LOCK,">$lockfile"); } if (!open(OUT,">>$kyaralogfile")) { unlink ($lockfile); &error("管理者が登場人物記録用ファイルの書き込みを許可していません。現在は使えません。"); } print OUT "$name_c$typec$color\n"; close(OUT); unlink ($lockfile); print <<"_EOF_";
[もどる] _EOF_ exit; } # --------------------------------- # 登場人物編集フォーム # --------------------------------- sub plusedit { print <<"_EOF_";
★使い方★
[もどる] _HTML_ exit; } sub plusregist { $color = $FORM{'color_p'}; $actor = $FORM{'actor_p'}; $name = $FORM{'name'}; $name_c = &change0($name); if ($color eq 'del') { $name = $mes = "削除"; } else { $mes = "『$name』に変更"; } if ($actor eq '' || $color eq '') { &error("編集人物名または色が選ばれていません"); } if ($name eq '' && $color ne 'no') { &error("何も書かれていないか、または使用禁止の文字が使われているようです。<は使用しないでください。"); } if (length($name) >= 40) { &error("名前が長すぎます。文字数は全角20字を超えてはいけません。"); } $sio = 0; foreach $line (@ptomatos) { if ($sio eq $actor) { $line = "$name_c$typec$color\n"; push (@ptomato,$line); } else { push (@ptomato,$line); } $sio++; } # --------------------------------- # 登場人物記録ファイルに登録する # --------------------------------- if ($lockcheck) { $wt = 0; while (-f $lockfile) { $wt++; if ($wt > 19) { &error('強制終了されました。処理は中断されました。'); } sleep 1; } open (LOCK,">$lockfile"); } if (!open(OUT,">$kyaralogfile")) { unlink ($lockfile); &error("登場人物記録ファイルの書き込みに失敗しました。"); } print OUT @ptomato; close(OUT); unlink ($lockfile); print <<"_EOF_";
[もどる] _EOF_ exit; } # *************************** # 禁止文字コードの変換処理 # *************************** sub change0 { local($text) = $_[0]; $text =~ s/\(/(/g; $text =~ s/\)/)/g; $text =~ s/\*/*/g; $text =~ s/\+/+/g; $text =~ s/\././g; $text =~ s/\?/?/g; $text =~ s/\[/[/g; $text =~ s/\\/\/g; $text =~ s/\]/]/g; $text =~ s/\{/{/g; $text =~ s/\|/|/g; $text =~ s/\}/}/g; return $text; } sub change1 { local($text) = $_[0]; $text =~ s/(/\(/g; $text =~ s/)/\)/g; $text =~ s/*/\*/g; $text =~ s/+/\+/g; $text =~ s/./\./g; $text =~ s/?/\?/g; $text =~ s/[/\[/g; $text =~ s/\/\\/g; $text =~ s/]/\]/g; $text =~ s/{/\{/g; $text =~ s/|/\|/g; $text =~ s/}/\}/g; return $text; } # *************************** # エラー処理 # *************************** sub error { print <<"_HTML_error_";