#!/usr/bin/perl # =================================================================== # EASY 掲示板(EASY BBS Ver1.05) # File name: ecd.cgi # Copyright; Hiroshi Ishikawa(e-mail; laut@tky.3web.ne.jp) # (URL; http://www.net-easy.com) # EASY BBS Ver1.05は個人使用に限りフリーウェアです。 # 課金の発生する商用利用などはお問い合わせ下さい。 # また、改造は自由ですが、この欄は削除しないで下さい。 # =================================================================== # This file is remodeled by ANOS(e-mail; anos@octv.ne.jp) # Standard Ver. # Last Updated:6/12,2000 # 留意事項 # このecd.cgiに直接リンクした場合は画像表示機能がOFFになり、 # リンク先名の「ecd.cgi」の代わりに「ecd.cgi?gazou=on」と書くと画像表示機能がONになります。 require 'cgi-lib.pl'; #他の場所にあるときは相対パスで指定 require 'jcode.pl'; #他の場所にあるときは相対パスで指定 &ReadParse; # この掲示板のタイトル # タイトル名に『'』及び『\』を用いたい場合は、その文字の直前に『\』を挿入してください $title0 = 'ECD掲示板'; # 画像表示機能をONにしたときのタイトル(変更する必要がない場合は空欄でも良い) $title1 = ''; # タイトルの文字色 $titlecolor = 'blue'; # 保存する投稿総数(これを超えたら自動削除される) $max = 9999; # 1ページに表示する件数 $pmax = 25; # 記録保存ファイル $file = 'ecd.txt'; # 管理者用パスワード(投稿記事の削除の際必要) $password = '9646'; # メールアドレスの未記入を許可するか $use_mail = '0'; #未記入可は0、未記入不可は1 # 記事タイトルの未記入を許可するか $use_title = '0'; #未記入可は0、未記入不可は1 # 自分のホームページのURL $home = 'http://kuroppe.tagen.tohoku.ac.jp/~ecd/ecd.htm'; # cookieを使用するかしないか # 1を選ぶと、名前、メールアドレス、Homepage URLをブラウザに記憶させる $cook = '1'; #使用は1、使用しないは0 # cookieの初期設定(上で「1」を選んだ場合のみ必要) $cookie = 'ecd'; #変更してもしなくても可 $cookieExpires = &expires(90); #かっこの中の数字はcookieの有効日数 # 上の2つは変更しなくても、問題ありません # 背景色($bgcolor)、テキスト色($textcolor)、リンク部色($linkcolor)、クリック中リンク部色($alinkcolor)、 # 訪問済リンク部色($vlinkcolor)、記事タイトル文字色($kijicolor)、記事番号文字色($numbercolor)の指定 $bgcolor = 'white'; $textcolor = 'darkslategray'; $linkcolor = 'blue'; $alinkcolor = 'red'; $vlinkcolor = 'purple'; $kijicolor = 'green'; $numbercolor = 'blue'; # 画像表示機能に関する設定(この機能を一切働かせない場合は変更しないでください) # 画像ファイルのあるディレクトリ $imagedir = 'image/'; #相対パスでも可、最後に必ず「/」をつける # 画像のファイル名と名前(画像ファイルのあるフォルダを指定せずに、下の『画像ファイル名』にパスを記入しても良い) # 『$imagefile[番号] = "画像ファイル名"; $imagename[番号] = '画像に付ける名前';』のように順次書いてください # 番号は1から順に書き、番号0の文のみ削除変更しないでください # 画像に付ける名前に『'』及び『\』を用いたい場合は、その文字の直前に『\』を挿入してください $imagefile[0] = ""; $imagename[0] = '表示しない'; $imagefile[1] = "taro.gif"; $imagename[1] = '太郎'; $imagefile[2] = "hanako.gif"; $imagename[2] = '花子'; # 画像プレビュー画面のウィンドウサイズ # 下の$viewsizeで『width=ウィンドウの幅,height=ウィンドウの高さ』のように記入してください $viewsize = "width=500,height=350"; # 画像表示機能OFF時でも画像を選択できるようにするか $imageselect = '0'; #選択不可は0、選択可は1 # アクセスカウンターの設置 # EASYアクセスカウンター以外でも、IMGタグを用いて起動させるカウンターなら何でも設置できます # 以下のカッコ内にIMGタグを挿入してください $counter = ''; #設置しない場合は空欄 # ===================================================================== # 初期設定が必要なのはここまでです # --------------------------------------------------------------------- # これ以下は変更の必要はありませんが、BODYタグなどを変更するだけなら # 変更可能です。ただし、$xxxxのように変数を使っているところを変更すると # エラーの原因となるので注意して下さい。 # ===================================================================== # cookieの有無を調べ、あれば取得サブルーチンへ if ($ENV{'HTTP_COOKIE'} =~ /$cookie/){ &CookieCutter; } # 条件により処理を分岐 if($in{'gazou'} eq "on"){ $function = "?gazou=on"; $use_image = '1'; if($title1 ne ""){ $title = $title1; }else{ $title = $title0; } }else{ $use_image = '0'; $title = $title0; } if($in{'action'} eq "next_page"){ &go_next; }elsif($in{'action'} eq "go_pass"){ if($in{'password'} eq $password){ &delete_html; }else{ &error(pass_er); } }elsif($in{'action'} eq "henko"){ if($in{'password'} eq $password){ if($in{'kanri_mode'} eq "henko"){ &henko; exit; }elsif($in{'kanri_mode'} eq "sakujo"){ &delete; } &delete_html; }else{ &error(pass_er); } }elsif(($in{'action'} eq "henko_kakikomi") && ($in{'password'} eq $password)){ &henko_kakikomi; &delete_html; }elsif($in{'action'} eq "kakikomi"){ &kakikomi; }elsif($in{'action'} eq "delete_one"){ &delete_one; }elsif($in{'action'} eq "kojin_henko"){ &kojin_henko; }elsif($in{'action'} eq "kojin_henko_kakikomi"){ &kojin_henko_kakikomi; }elsif($in{'action'} eq "reskiji"){ &reskiji; }elsif($in{'action'} eq "preview"){ &preview; }elsif($in{'action'} eq "search"){ &search; }else{ &html; } # 最初に呼び出されたときのサブルーチン sub html { print "Content-type: text/html\n"; if($cook eq '1'){ &SetCookie; } print "\n"; if($use_mail eq '1'){ $need_mail = '☆'; } if($use_title eq '1'){ $need_title = '☆'; } print < $title

$title


$counter
ホームへ
「☆」の項目は必ず記入してください。
EOM if(($use_image eq '1') || ($imageselect eq '1')){ print "\n
お名前:
$need_mailメールアドレス: (半角文字使用)
ホームページ URL: EOM if($cookie_url ne ""){ print ""; }else{ print ""; } print < (半角文字使用)
$need_titleタイトル:
<\/TD>表\示する画像:<\/B><\/TD>"; if(($use_image eq '1') && ($imageselect eq '1')){ print " "; }elsif(($use_image eq '0') && ($imageselect eq '1')){ print " "; } print "<\/TD>\n<\/TR>\n"; } print < コメント:
削除パスワード: 投稿後に変更や削除する際必要です。(半角英数字3文字以上)


 
 

新着順に表\示されます。新着順に最大$max件まで保存されます。
EOM $i = 0; &read_file; $okuri = $i; #次のページの最初に読み出す行になる print "
\n"; print "全$count件が記録されています。\n"; print "1ページに$pmax件ずつ表\示されます。\n"; if($count > $pmax){ print <
EOM } print <
変更/削除する番号 パスワード
EOM # ここから20行は変更しないで下さい(Copyright) print <
EasyBBS Ver1.05
(改造版 Standard Ver.)
EOM } # 2ページ目以降を出力するサブルーチン sub go_next{ if($in{'modori'} eq '0'){ &html; }else{ print "Content-type: text/html\n\n"; print < $title

$title


EOM if($in{'okuri'} ne ''){ $i = $in{'okuri'}; $ini = $i; #このページの最初の行 }elsif($in{'modori'} ne ''){ $i = $in{'modori'}; $ini = $i; } &read_file; $okuri = $i; #次のページの最初に読み出す行になる $modori = ($ini - $pmax); #前のページの最初に読み出す行 $ini_end = $i; #次のページの最初の行 $ini_view = $ini + 1; print < 全$count件中、このページには$ini_view件目〜$ini_end件目を表\示しています
EOM if($i eq $count){ print "このページが最後です\n<\/TD>\n"; }else{ print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "<\/TD><\/FORM>\n"; } print <
変更/削除する番号 パスワード
EOM } } # 画像プレビューサブルーチン sub preview{ print "Content-type: text/html\n\n"; print < 画像プレビュー EOM for($i = 1; $imagename[$i] ne ""; ++$i){ print "


\n$imagename[$i]<\/TD>\n"; } print <

EOM } # 指定された行数だけファイルを読み出すサブルーチン sub read_file{ if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); $count = @DATA; if($count < $pmax){ $pmax_new = $count; }elsif(($count - $i) < $pmax){ $pmax_new = ($count - $i); }else{ $pmax_new = $pmax; } while($pmax_new > 0){ ($cnt,$date,$name,$mail,$url,$dai,$comment,$remt_h,$remt_ad,$del_pas,$image) = split(/\,/,$DATA[$i]); if($url eq ''){ $url = ''; }elsif($url ne 'http://'){ $url = "<$url>"; }else{ $url = ''; } $dai = "タイトル[$dai]"; if($mail ne ''){ $name = "$name"; } $comment =~ s/(https?|ftp|gopher|telnet|whois|news)\:([\w|\:\!\#\$\%\=\&\-\^\`\\\|\@\~\[\{\]\}\;\+\*\,\.\?\/]+)/$1\:$2<\/A>/ig; if(($use_image ne '0') && ($image ne '')){ $hyoji = "\n\n
\n$comment\n
"; }else{ $hyoji = "$comment"; } print "\n"; print "\n\n
$date 投稿者[$name] $url
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n
\【No\.$cnt\】 $dai 記事の変更・削除\n"; print "
$hyoji\n
\n"; print "
\n"; $i ++; $pmax_new --; } } # 検索サブルーチン sub search { if($in{'letter'} ne ''){ if($in{'item'} eq 'or'){ $or = ' CHECKED'; $itemview = " または <\/FONT>"; }elsif($in{'item'} eq 'and'){ $and = ' CHECKED'; $itemview = " かつ <\/FONT>"; } $keys = $in{'letter'}; $keys =~ s/ / /g; $keys =~ s/ +/ /g; $keys =~ s/^ //; $keys =~ s/&/&/g; $keys =~ s//>/g; $keys =~ s/,/,/g; $keys =~ s/\t//g; $target = $keys; $target =~ s/(\W)/\\$1/g; @keys = split(/\\\s/,$target); unless($keys =~ /. ./){ $itemview = ''; } $keysview = $keys; $keysview =~ s/ /$itemview/g; if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); $hit = 0; foreach $line (@DATA){ ($cnt,$date,$name,$mail,$url,$dai,$comment) = split(/\,/,$line); $string = "$name\t$dai\t$comment"; $string =~ s/
//g; if($in{'item'} eq 'or'){ $match = 'off'; foreach $term (@keys){if($string =~ /$term/i){$match = 'on';}} }else{ $match = 'on'; foreach $term (@keys){unless($string =~ /$term/i){$match = 'off';}} } if($match eq 'off'){next;} push(@SEARCHDATA,$line); $hit ++; } }else{ $and = ' CHECKED'; } print "Content-type: text/html\n\n"; print < 記事検索

記事検索


EOM if($in{'letter'} eq ''){ print "検索キーワードを入力してください<\/B><\/FONT>
\n"; }else{ print "検索結果<\/B><\/FONT> (検索キーワード:$keysview) "; if(!@SEARCHDATA){ print "ヒットしませんでした
\n"; }else{ print "$hit件がヒットしました。
\n"; if(($in{'okuri'} eq '') && ($in{'modori'} eq '')){ $i = 0; }elsif($in{'okuri'} ne ''){ $i = $in{'okuri'}; $ini = $i; }elsif($in{'modori'} ne ''){ $i = $in{'modori'}; $ini = $i; } if($hit < $pmax){ $pmax_new = $hit; }elsif(($hit - $i) < $pmax){ $pmax_new = ($hit - $i); }else{ $pmax_new = $pmax; } while($pmax_new > 0){ ($cnt,$date,$name,$mail,$url,$dai,$comment) = split(/\,/,$SEARCHDATA[$i]); $hitnumber = $i+1; if($url eq ''){ $url = ''; }elsif($url ne 'http://'){ $url = "<$url>"; }else{ $url = ''; } $dai = "タイトル[$dai]"; if($mail ne ''){ $name = "$name"; } $comment =~ s/(https?|ftp|gopher|telnet|whois|news)\:([\w|\:\!\#\$\%\=\&\-\^\`\\\|\@\~\[\{\]\}\;\+\*\,\.\?\/]+)/$1\:$2<\/A>/ig; print "$hitnumber. $date 投稿者[$name] $url
\n"; print "
\n
\【No\.$cnt\】 $dai\n"; print "
$comment\n
\n"; print "
\n"; $i ++; $pmax_new --; } $okuri = $i; $modori = ($ini - $pmax); $ini_end = $i; $ini_view = $ini + 1; print < 全$hit件中、このページには$ini_view件目〜$ini_end件目を表\示しています
EOM if($modori >= 0){ print <
EOM } print "
EOM } print "<\/TR>\n<\/TABLE>
\n"; } } print <

EOM } # 返信投稿サブルーチン sub reskiji { if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); $i = 0; foreach $line (@DATA){ ($cnto,$date,$name,$mail,$url,$daio,$commento,$remt_h,$remt_ad) = split(/\,/,$line); if ($in{'res'} eq $cnto){ $resnumber = "yes"; last; } $i ++; } if($resnumber eq "yes"){ $res_check = substr($daio,0,3); if($res_check eq "RE\:"){ $daio =~ s/\(Res\#[0-9]+\)//g; $dai = "$daio\(Res\#$cnto\)"; }else{ $dai = "RE\:$daio\(Res\#$cnto\)"; } } print "Content-type: text/html\n\n"; print < 返信投稿画面

記事No.$cnto「$daio」に対する返信

戻る
\n"; if($i eq $hit){ print "次のページはありません\n<\/TD>\n"; }else{ print <
複数指定する場合はスペースで区切ってください
名前、タイトル、コメントが検索の対象となります

 
全ての語を含む いずれかの語を含む
\n
お名前:
メールアドレス:
ホームページ URL: EOM if($cookie_url ne ""){ print ""; }else{ print ""; } print "<\/TD>\n<\/TR>\n"; if(($use_image eq '1') || ($imageselect eq '1')){ print "
表\示する画像:<\/B><\/TD>"; print "<\/TD>\n<\/TR>\n"; } $commento =~ s/
/\n>/g; $comment = ">$commento"; print <
コメント:
削除パスワード:


 
EOM } # 書き込みサブルーチン sub kakikomi { &check_in; # 時間の取得 ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime; $mon++; @week = ('日','月','火','水','木','金','土'); $wday = $week[$wday]; $mon = sprintf("%.2d",$mon); $mday = sprintf("%.2d",$mday); $hour = sprintf("%.2d",$hour); $min = sprintf("%.2d",$min); $sec = sprintf("%.2d",$sec); $year = substr($year,-2); if($in_name eq ""){ &error(name_er); } if($in_comment eq ''){ &error(comment_er); }else{ if(($in{'mail'} eq '') && ($use_mail eq '1')){ &error(mail_er); } if(($in{'mail'} ne '') && ($in{'mail'} !~ /^[a-zA-Z0-9\-_]+\@([a-z0-9\-_]+\.)+[a-z0-9\-_]+$/)){ &error(mail_er); } if($in{'delete_psw'} ne ""){ if($in{'delete_psw'} !~ /^[a-zA-Z0-9]{3,}$/){ &error(delete_psw_er); } }else{ &error(delete_psw_er); } if($in_dai eq ''){ if($use_title ne '0'){ &error(err_dai); }else{ $in_dai = 'No-Title'; } } if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); $line1 = ; flock(OUT,8); close(OUT); ($cnt1,$date,$name,$mail,$url,$dai,$comment,$remt_h,$remt_ad) = split(/\,/,$line1); $cnt1 ++; $host = $ENV{'REMOTE_HOST'}; $addr = $ENV{'REMOTE_ADDR'}; if(($host eq '') || ($host eq $addr)){ $host = gethostbyaddr(pack('C4',split(/\./,$addr)),2); } if($host eq ''){ $host = $addr; } $new_comment = "$cnt1,$year/$mon/$mday($wday)$hour:$min:$sec,$in_name,$in{'mail'},$in_url,$in_dai,$in_comment,$host,$addr,$in{'delete_psw'},$in{'image'},\n"; if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); unshift(@DATA,$new_comment); $i = 0; foreach $line(@DATA){ $i ++; if($i > $max){last;} push(@NEWDATA,$line); } if(!open(IN,">$file")){&error(err_fail);} flock(IN,2); print IN @NEWDATA; flock(IN,8); close(IN); &html; } } # 削除する行を選ぶHTML画面を出力するサブルーチン sub delete_html{ print "Content-type: text/html\n\n"; print < 管理者画面

変更/削除 選択画面


変更または削除のどちらかにチェックしてください。
変更 削除

下のチェックボックスから記事を選択してください。
削除の場合は複数選択できますが、記事の変更の時は1つだけを選択してください。

記事を選択したら[Submit]ボタンを押してください



EOM if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); $count = @DATA; $i = 0; while($count > 0){ ($cnt,$date,$name,$mail,$url,$dai,$comment,$remt_h,$remt_ad,$del_pas,$image) = split(/\,/,$DATA[$i]); $comment =~ s/
/ /g; $comment_length = length($comment); if($comment_length > 200){ $comment = substr($comment,0,200); $comment = "$comment ..."; } print < 記事番号【$cnt】 $date
EOM if(($use_image ne '0') || ($imageselect ne '0')){ print "\n
お名前:$name
メールアドレス:$mail
ホームページ URL:$url
タイトル:$dai
表\示する画像:<\/TD>$image<\/TD>\n<\/TR>\n"; } print < コメント:$comment
削除パスワード:$del_pas
リモートホスト:$remt_h
IPアドレス:$remt_ad

EOM $i ++; $count --; } print <

-ここまで-

EOM } # 削除サブルーチン sub delete{ if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); $count = @DATA; @code = split(/\0/,$in{'delete'}); $countcode = @code; $i = 0; $j = 0; while(($count > 0) || ($countcode > $j)){ ($cnt,$date,$name,$mail,$url,$dai,$comment,$remt_h,$remt_ad) = split(/\,/,$DATA[$i]); if($cnt eq $code[$j]){ $DATA[$i] = ''; $j ++; } $i ++; $count --; } if(!open(TXT,">$file")){&error(err_fail);} flock(TXT,2); print TXT @DATA; flock(TXT,8); close(TXT); } # cookieの取得サブルーチン sub CookieCutter { foreach(split(/; /,$ENV{'HTTP_COOKIE'})){ ($key,$value) = split(/=/); if ($key eq $cookie){ $cookieJar{$cookie} = $value; } } @LOG = $cookieJar{$cookie}; foreach $line (@LOG){ ($cookie_name,$cookie_mail,$cookie_url) = split(/\,/,$line); } } # cookieセットサブルーチン sub SetCookie{ if ($in{'action'} eq 'kakikomi'){ $in{'name'} =~ s/&/&/g; $in{'name'} =~ s/,/,/g; $in{'name'} =~ s/;/;/g; $in{'url'} =~ s/&/&/g; $in{'url'} =~ s/,/,/g; $in{'url'} =~ s/;/;/g; @new_cookie = ($in{'name'},$in{'mail'},$in{'url'}); ($cookie_name,$cookie_mail,$cookie_url) = @new_cookie; } print "Set-Cookie: "; print "$cookie=$cookie_name,$cookie_mail,$cookie_url; "; print "expires=$cookieExpires;\n"; } # cookieの有効期限を設定するサブルーチン sub expires { local($day) = @_; local(@date); local(@week) = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); local(@month) = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); @date = gmtime(time + $day * 60 * 60 * 24); $date[5] = $date[5] + 1900; foreach (0..3) { $date[$_] = sprintf("%.2d",$date[$_]); } "$week[$date[6]], $date[3]-$month[$date[4]]-$date[5] $date[2]:$date[1]:$date[0] GMT"; } # エラーサブルーチン sub error{ $error = $_[0]; if ($error eq "name_er"){ $msge = '名前が正しく記入されていません'; }elsif($error eq "comment_er"){ $msge = 'コメントが正しく記入されていません'; }elsif($error eq "mail_er"){ $msge = 'メールアドレスが正しく記入されていません'; }elsif($error eq "err_dai"){ $msge = 'タイトルを記入して下さい'; }elsif($error eq "err_fail"){ $msge = 'ファイルオープンできません'; }elsif($error eq "bad_henko"){ $msge = '変更する記事を1件だけ指定してください'; }elsif($error eq "delete_psw_er"){ $msge = '削除用パスワードを正しく御記入ください
(半角英数字3文字以上で指定)'; }else{ $msge = 'パスワードが違います'; } print "Content-type: text/html\n\n"; print "ERROR\n"; print "\n"; print "

$msge


\n"; print "BACK\n"; exit; } # 投稿者削除サブルーチン sub delete_one{ if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); $del_pw = $in{'del_pw'}; $delete_no = $in{'delete_no'}; $count = @DATA; $i = 0; while($count > 0){ @one_line = split(/\,/,$DATA[$i]); if($one_line[0] == $delete_no){ if(($one_line[9] eq "$del_pw") && ($one_line[9] ne "")){ $DATA[$i] = ''; } } $i++; $count--; } if(!open(OUT,">$file")){&error(err_fail);} flock(OUT,2); print OUT @DATA; flock(OUT,8); close(OUT); &html; } #******************************************************************* #変更サブルーチン sub henko{ @code = split(/\0/,$in{'delete'}); $countcode = @code; if($countcode != 1){ &error(bad_henko); } $henko_kiji = shift(@code); ($cnt,$date,$name,$mail,$url,$dai,$comment,$remt_h,$remt_ad,$del_pas,$image) = split(/\,/,$henko_kiji); if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); foreach $line(@DATA){ @line_data = split(/\,/,$line); if($cnt == $line_data[0]){ last; } } print "Content-type: text/html\n\n"; print < 管理者用変更画面

管理者用変更画面

変更/削除 選択画面に戻る

EOM if(($use_image ne '0') || ($imageselect ne '0')){ print "\n
記事番号【$line_data[0]】 $line_data[1]
お名前:
メールアドレス:
ホームページ URL:
タイトル:
表\示する画像:<\/B><\/TD>コメント:
$line_data[7]:$line_data[8] 削除パスワード:
  EOM } #************************************************************************* #変更書き込みサブルーチン sub henko_kakikomi{ &check_in; if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); if($in_name eq ""){ &error(name_er); } if($in_comment eq ''){ &error(comment_er); } if(($in{'mail'} eq '') && ($use_mail eq '1')){ &error(mail_er); } if(($in{'mail'} ne '') && ($in{'mail'} !~ /^[a-zA-Z0-9\-_]+\@([a-z0-9\-_]+\.)+[a-z0-9\-_]+$/)){ &error(mail_er); } if($in{'del_pas'} ne ""){ if($in{'del_pas'} !~ /^[a-zA-Z0-9]{3,}$/){ &error(delete_psw_er); } }else{ &error(delete_psw_er); } if($in_dai eq ''){ if($use_title ne '0'){ &error(err_dai); }else{ $in_dai = 'No-Title'; } } foreach $line(@DATA){ @line_data = split(/\,/,$line); if($in{'cnt'} == $line_data[0]){ $new_line = "$in{'cnt'},$in{'date'},$in_name,$in{'mail'},$in_url,$in_dai,$in_comment,$in{'rem_h'},$in{'rem_ad'},$in{'del_pas'},$in{'image'},\n"; @new_data = (@new_data,$new_line); }else{ @new_data = (@new_data,$line); } } if(!open(OUT,">$file")){&error(err_fail);} flock(OUT,2); print OUT @new_data; flock(OUT,8); close(OUT); } #****************************************************** #投稿者変更画面 #****************************************************** sub kojin_henko{ if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); $del_pw = $in{'del_pw'}; $delete_no = $in{'delete_no'}; $count = @DATA; $i = 0; while($count > 0){ @one_line = split(/\,/,$DATA[$i]); if($one_line[0] == $delete_no){ if(($one_line[9] eq "$del_pw") && ($one_line[9] ne "")){ $henkou_data = $DATA[$i]; $flag = 'yes'; last; } } $i++; $count--; } if($flag eq 'yes'){ ($cnt,$date,$name,$mail,$url,$dai,$comment,$remt_h,$remt_ad,$del_pas,$image) = split(/\,/,$henkou_data); }else{ &error; } print "Content-type: text/html\n\n"; print < 投稿者用変更画面

投稿者用変更画面

戻る
EOM $comment =~ s/
/\n/g; print <
記事番号【$cnt】 $date
お名前:
メールアドレス:
ホームページ URL:
タイトル:
コメント:
 

投稿記事をすべて削除する場合は、下のボタンを押してください。
←上記の投稿が(名前やアドレス等も)すべて削除されます
EOM } #************************************************************************* #投稿者変更書き込みサブルーチン sub kojin_henko_kakikomi{ &check_in; if(!open(OUT,"$file")){&error(err_fail);} flock(OUT,2); @DATA = ; flock(OUT,8); close(OUT); if($in_name eq ""){ &error(name_er); } if($in_comment eq ''){ &error(comment_er); } if(($in{'mail'} eq '') && ($use_mail eq '1')){ &error(mail_er); } if(($in{'mail'} ne '') && ($in{'mail'} !~ /^[a-zA-Z0-9\-_]+\@([a-z0-9\-_]+\.)+[a-z0-9\-_]+$/)){ &error(mail_er); } if($in_dai eq ''){ if($use_title ne '0'){ &error(err_dai); }else{ $in_dai = 'No-Title'; } } foreach $line(@DATA){ @line_data = split(/\,/,$line); if(($in{'cnt'} == $line_data[0]) && ($in{'del_pw'} eq $line_data[9])){ $new_line = "$in{'cnt'},$in{'date'},$in_name,$in{'mail'},$in_url,$in_dai,$in_comment,$in{'rem_h'},$in{'rem_ad'},$in{'del_pw'},$in{'image'},\n"; @new_data = (@new_data,$new_line); }else{ @new_data = (@new_data,$line); } } if(!open(OUT,">$file")){&error(err_fail);} flock(OUT,2); print OUT @new_data; flock(OUT,8); close(OUT); &html; } #******************************************************** # HTMLタグの書き込み禁止するサブルーチン sub check_in{ $in_name = $in{'name'}; $in_comment = $in{'comment'}; $in_dai = $in{'dai'}; $in_url = $in{'url'}; $in_name =~ s/&/&/g; $in_name =~ s//>/g; $in_name =~ s/,/,/g; $in_name =~ s/\t/ /g; $in_comment =~ s/&/&/g; $in_comment =~ s//>/g; $in_comment =~ s/\n/
/g; $in_comment =~ s/\r//g; $in_comment =~ s/,/,/g; $in_comment =~ s/\t/ /g; $in_url =~ s/&/&/g; $in_url =~ s//>/g; $in_url =~ s/,/,/g; $in_dai =~ s/&/&/g; $in_dai =~ s//>/g; $in_dai =~ s/,/,/g; $in_dai =~ s/\t/ /g; &jcode'convert(*in_name,"sjis"); &jcode'convert(*in_comment,"sjis"); &jcode'convert(*in_dai,"sjis"); }