#!/usr/local/bin/perl #↑あなたのブロバイダのCGIパスを記述してください。 #==================================================================# # Anthologys v2.5e # # Script by YASUU!! 2005/3/13 # # Ver.Bright Arrange by ZERO 2007/8/5 # #==================================================================# #======================あなたが設定する項目========================# $body = ''; #最初に表示されるページの設定 $reload = './bright.cgi'; #このCGI ScriptのURL指定 $home = ''; #HomepageのURL指定 $title = 'Anthologys 詩歌集'; #タイトル $title_img = ''; #タイトルにイメージを使用する場合、画像のURLを指定 $t_bg = '#B8B8DC'; #投稿作品一覧枠の全体背景 $tbg = '#aaaaaa'; #投稿作品一覧の表題の背景 $tbg2 = '#eeeeee'; #投稿作品一覧リストの背景 $textbg = './textbg.gif'; #textareaの背景(CSSを有効にした場合) $cnts = '1'; #閲覧数カウント (1=IP解析をする 2=IP解析しない 空白=表示しない) $cntdir = './cnt/'; #カウント数のログを保存するディレクトリ $hos = '1'; #ホスト表示 (1=ID化する 2=ID化しない 空白=表示しない) $sel = '1'; #作品修正時に、記事を最上欄に上げるかどうかの設定 (1=投稿者選択 2=上げる 空白=そのまま) $byte = '1'; #作品のバイト数をカウントしない場合は 1 を削除 $iplim = ''; #作品の作者からの感想投稿を制限する場合は 1 を入れる $iplim2 = ''; #同じ人の感想の連続投稿を制限する場合は 1 を入れる $frlim = '1'; #海外の自動投稿プログラム対策 (1=拒否する 空白=チェックしない) $del_dir = './del/'; #作品削除ログを保存するディレクトリ(管理モード時のみ閲覧可) $del_max = '100'; #削除ログ最大記録数設定 $wait = '00'.'00'.'05'.'00'; #作品の連続投稿の禁止期間 (左から順に'日','時','分','秒'。標準は5分) $trips = '1'; #トリップ機能を使用する場合は 1 を入れる @tag = ("table","meta","!--","form","embed","script","frame"); #禁止タグ設定( , で区切って追加) @tab = ("Title","Name","投稿日","閲覧数","Byte","Res","Point"); #一覧の表題の記述設定(※閲覧数や文字数などを表示しない設定でも","は削除しないこと) @sort = ("日付順","作品名順","作者名順","閲覧数順","文字数順","返信数順","点数順"); #並び替えフォームの記述設定(※上と同様","は残しておく) #-------------------------投稿者背景の設定---------------------------# #投稿FORMに32×32サイズでアイコンが表示されるので、正方形の画像を使用 #---'',で区切って画像URLを指定することにより、何個も追加できます。--# @IMG = ( './bg_a.gif', './bg_b.gif', './bg_c.gif', './bg_d.gif', './bg_e.gif', './bg_f.gif', './bg_g.gif', './bg_h.gif', '', '', '', ''); #-----------------------投稿者文字色の設定--------------------------# @FONT = ( '#000000', '#0000A0', '#800040', '#E10000', '#005100', '#4F4F4F', '#575700', '#B500B5', '#5400A8', '', ''); #---------投稿作品表示ページのタイトル表示、ベース背景、テキスト、リンク色設定---# $sakutit = '1'; #作品閲覧時のタイトルバーの表示文字(1=作品の前書き,空白=作品の題名[前書き機能OFF]) $bg_c = '#ffffff'; #背景色 $txt_c = '#333333'; #テキスト色 $link_c = '#0000ff'; #リンク色 $pass = 'abc123'; #管理者passwordの設定 $list = '30'; #TOPpage 1pageに表示する記事数一覧のリスト数設定 $list2 = '5'; #感想記事管理page 1pageに表示する記事数一覧のリスト数設定 $max = '100'; #最大記録保持数設定 この件数に達すると、ログのbackupを作成します。。(backupを設定した場合。) $max2 = '100'; #感想ログ最大記録数設定 $n_view = '3'; #NEW,UPの表示期間 (日) ( 0 を指定すると表示しなくなる) $n_img = './new.gif'; #NEWを画像にする場合(./new.gifを削除するとNEW!!という文字が表示されます。) $u_img = './up.gif'; #編集投稿した場合にupdate画像を表示する場合 $rom = ''; #一般投稿を募集しない場合は 1 を入れる(あなただけが投稿できるようになる) #------------------------sendmailの設定-----------------------------# $mailsend = ''; #mailを受け取る場合は 1 を入れる $mailto = ''; #管理人のメールアドレス $sendmail = '/usr/lib/sendmail'; #sendmailのパス プロバイダに確認すること $webmaster = ''; #管理人の名前 #---------------ログの消失を防ぐためロックを設定する--------------# $lockdir = './lock/'; #ロックファイルを生成するディレクトリ(パーミッション777) $lock = '1'; #ロック方法(1=symlink方式,2=open式,0=設定なし) #-------------------------感想記事の設定----------------------------# $resdir = './res/'; #感想記事を保存するディレクトリ $point = '1'; #採点機能設定(1=選択式,2=点数入力式,空白=採点なし) $plus_c = 'blue'; #得点が+のときの得点色(標準は青。#0000ffなどと色番号で指定しても良い) $minus_c = 'red'; #得点が−のときの得点色(標準は赤。上に同じ) #--- 採点機能で 1 を選択した場合の評価と点数一覧(評価のタイトル=点数) ---# @POINT = ( '普通=10', 'とても良い=50', '良い=30', '良くない=-20', '最悪=-30'); #--- 採点機能で 2 を選択した場合の点数の上限,下限設定 ---# $maxp = '100'; #最高点設定 $minp = '0'; #最低点設定 #-------イタズラ対策---# $kyohi = ''; #する場合は 1 を入れる #--入室を拒否するIPまたはブロバイダ名を '127.0.0.1', というように''内に記述---# @kyohi = ( 'proxy', '', '', '', ''); #------------------------ログの設定-------------------------------# $backup = '1'; #バックアップをしない場合は1を削除 $backname = '作品集その'; #backupファイルへのリンク見出し #ログ、バックアップログを保存するディレクトリ(Anthology.cgiと同じディレクトリ内 同じディレクトリに設置できない場合は../log/というようにcgi-bin横に設定 パーミッション777 $dir = './log/'; #----------------------STYLE SHEETの設定---------------------------------# $css = '1'; #style sheetの設定をしない場合は1を削除 sub style { if ($styleflag) { return: } print < HTML $styleflag = 1; #STYLE SHEETの二重呼び出し防止 } #================設定項目はここまで(以下はプログラム)===============# $cookiename = 'anthology'; #=以下のファイルはこの掲示板のScriptと同じディレクトリに設置========# require './jcode.pl'; if ($kyohi eq '1') { &kyohi; } if ($ENV{'REQUEST_METHOD'} eq "POST") { $post=1; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $post=0; $buffer = $ENV{'QUERY_STRING'}; } @pairs = split(/&/,$buffer); foreach (@pairs) { ($name, $value) = split(/=/, $_); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; &jcode'convert(*value,'sjis'); $value =~ s/&/&/g; $value =~ s/"/"/g; if ($name eq "come") { $value =~ s/
/\r/g; } if ($name ne "value") { $value =~ s//>/g; } else { foreach (@tag){ if ($value =~ /<$_(.|\n)*>/i) { &error("使用禁止タグが記述されています。"); } } } if ($value =~ /\,/i) { &error("半角コンマ「,」は使用できません。全角コンマ「,」に置き換えてください。"); } $value =~ s/\0//g; $value =~ s/\r\n/
/g; $value =~ s/\r/
/g; $value =~ s/\n/
/g; if ($name eq 'target') { push(@CK,$value); } else { $FORM{$name} = $value; } } if ($FORM{'log'} eq '') { $file = "$dir" . 'anthology.txt'; } else { $file = "$dir" . "$FORM{'log'}" . '.txt'; if (!-e $file) { &error("指定されたログは存在しません。"); } } &link; #=========ボタンもしくはアンカーをクリックしたときの処理の流れを制御=====# if ($FORM{'action'} eq 'form') { &form; } elsif ($FORM{'action'} eq 'dele') { &dele; &deleview; exit; } elsif ($FORM{'action'} eq 'dele2') { &dele2; &deleview2; exit; } elsif ($FORM{'action'} eq 'dele3') { &dele3; } elsif ($FORM{'action'} eq 'regist') { ®ist; } elsif ($FORM{'action'} eq 'regist2') { ®ist2; } elsif ($FORM{'action'} eq 'html2') { &html2; } elsif ($FORM{'action'} eq 'html3') { &html3; } elsif ($FORM{'action'} eq 'html4') { &html4; } elsif ($FORM{'action'} eq 'html5') { &html5; } elsif ($FORM{'action'} eq 'sentaku') { if ($FORM{'pwd'} eq $pass) { &deleview; } &error("PASSWORDが一致しません。"); } elsif ($FORM{'action'} eq 'sentaku2') { if ($FORM{'pwd'} eq $pass) { &deleview2; } &error("PASSWORDが一致しません。"); } elsif ($FORM{'action'} eq 'home') { &home; } elsif ($FORM{'action'} eq 'in') { ∈ } elsif ($FORM{'action'} eq 'pv') { &pv; } &html; sub top { #HTMLヘッダ if ($headflag) { return: } print "Content-type: text/html; charset=Shift_JIS\n\n"; print "\n"; print "\n"; if ($css eq '1') { &style; } print "$title\n"; print "\n"; $headflag = 1; } sub html { #トップページ local(%names,@nline,$nname,$nno); local($count); &file; &date; ⊤ print "$body\n"; &title; print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; if ($backup eq '1') { &dir; } print "
\n"; print "\n"; if ($FORM{'log'} eq '') { print "投稿LIST [ 現在 $cnt 作品公開中 ]\n"; } else { print "投稿LIST [ $cnt 作品 ]\n"; } print "\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "作者を限定して抽出
\n"; print "\n"; print "\n"; print "
\n"; print "語句を指定して抽出
\n"; print "\n"; print "
\n"; print "\n"; print "条件を指定して整頓
\n"; print "
\n"; &load; if ($FORM{'page'} eq '') { $page = 0; } else { $page = $FORM{'page'}; } $end_data = @lines - 1; $page_end = $page + ($list - 1); if ($page_end >= $end_data) { $page_end = $end_data; } if ($FORM{'sort'}) { &sort; if ($FORM{'sort'} eq "saku1" ) { foreach ($page .. $page_end) { ($tit,$date,$num,$b_num,$pwd,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki,$count,$rescnt,$points) = split(/\,/,$vline[$_]); chop($points); &rep; } } elsif ($FORM{'sort'} eq "saku2" ) { foreach ($page .. $page_end) { ($name,$date,$num,$b_num,$pwd,$tit,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki,$count,$rescnt,$points) = split(/\,/,$vline[$_]); chop($points); &rep; } } elsif ($FORM{'sort'} eq "visit") { foreach ($page .. $page_end) { ($count,$date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki,$rescnt,$points) = split(/\,/,$vline[$_]); chop($points); &rep; } } elsif ($FORM{'sort'} eq "leng" ) { foreach ($page .. $page_end) { ($leng,$date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki,$count,$rescnt,$points) = split(/\,/,$vline[$_]); chop($points); &rep; } } elsif ($FORM{'sort'} eq "rescnt" ) { foreach ($page .. $page_end) { ($rescnt,$date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki,$count,$points) = split(/\,/,$vline[$_]); chop($points); &rep; } } elsif ($FORM{'sort'} eq "points" ) { foreach ($page .. $page_end) { ($points,$date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki,$count,$rescnt) = split(/\,/,$vline[$_]); chop($rescnt); &rep; } } else { foreach ($page .. $page_end) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki,$count,$rescnt,$points) = split(/\,/,$lines[$_]); chop($points); &rep; } } } else { foreach ($page .. $page_end) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki,$count,$rescnt,$points) = split(/\,/,$lines[$_]); chop($points); &rep; } } print "
\n"; &list; print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($FORM{'log'} eq "" && $rom eq "") { if ($cnt <= $max) { print "\n"; print "\n"; print "\n"; print "\n"; } } print "
\n"; print "\n"; print "
\n"; print "\n"; print "

\n"; print "


\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "PASSWORD \n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "Anthologys v2.5e Script by YASUU!!\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "Ver.Bright arrange by ZERO\n"; print "\n"; print "\n"; print "
\n"; print "\n"; exit; } sub html2 { #1件の作品のみ表示するView &file2; &cook2; if ($cnts) { &count2; } print "Content-type: text/html; charset=Shift_JIS\n\n"; print "\n"; print "\n"; if ($css eq '1') { &style; } if ($sakutit eq "1") { if ($mgki eq "") { print "$tit\n"; } else { print "$mgki\n"; } } else { print "$tit\n"; } print "\n"; $tit =~ s/\0/\,/g; $value =~ s/\0/\,/g; if($value !~ /
/) { $value =~ s/\r/
/g; } $come =~ s/\0/\,/g; $come =~ s/\r/
/g; $come =~ s/(http:[!#-9A-~]+)/$1<\/a><\/b>/g; print "\n"; print "
\n"; print "\n"; if ($css ne '1') { print "\n"; } else { print "\n"; } print "\n"; print "\n"; if ($css ne '1') { print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "$tit\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "$tit\n"; print "\n"; print "
\n"; print "\n"; print "$value\n"; print "\n"; } else { print "\n"; print "\n"; print "$value\n"; print "\n"; } print "
\n"; print "
\n"; if ($mail ne "") { print "$name\n"; } else { print "$name\n"; } print "
\n"; if ($url ne "") { print "http://$url
\n"; } print "$date 公開
\n"; print "■この作品の著作権は$nameさんにあります。無断転載は禁止です。
\n"; print "
\n"; print "
\n"; print "
■作者からのメッセージ\n"; print "
\n"; if ($come ne "") { print "$come\n"; } else { print "作者からのメッセージはありません。\n"; } print "
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; $file2 = $resdir . $num . '.txt'; if (-e $file2) { open(MD,"$file2"); @blines = ; $rescnt = @blines; close(MD); if ($rescnt != 0) { foreach (@blines) { ($date_r,$renum,$name_r,$mail_r,$url_r,$come_r,$poi,$host_r) = split(/\,/,$_); chop($host_r); $come_r =~ s/\0/\,/g; $come_r =~ s/\r/
/g; $come_r =~ s/(http:[!#-9A-~]+)/$1<\/a><\/b>/g; print "
\n"; print "\n"; if ($point ne "") { $points += $poi; if ($poi > 0) { $poi = "$poi"; } elsif ($poi < 0) { $poi = "$poi"; } print "\n"; } if ($mail_r ne "") { print "\n"; } else { print "\n"; } print "\n"; if ($hos ne "") { if ($hos eq "1") { $host_r = crypt ($host_r," "); } print "\n"; } print "
\n"; print "\n"; } if ($point ne "") { if ($points > 0) { $points = "$points"; } elsif ($points < 0) { $points = "$points"; } print "\n"; if ($hos ne "") { print "\n"; } print "\n"; } } else { print "\n"; } } else { print "\n"; } print "
\n"; print "この作品の感想をお寄せください。\n"; print "
$come_r$poi点$name_r$name_r■$date_rID :$host_rPASS\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
合計\n"; print "$points点\n"; print "
\n"; print "感想記事の投稿は現在ありません。\n"; print "
\n"; print "感想記事の投稿は現在ありません。\n"; print "
\n"; print <
お名前(必須) E-Mail(任意)
メッセージ
HTML if ($point eq '1') { print "評価(必須)\n"; } elsif ($point eq '2') { print "評価(必須)点\n"; } print <  HTML if ($iplim) { $chost = crypt ($host," "); print "\n"; } print "
\n"; print "
\n"; print "

\n"; print "
\n"; print "<<戻る\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "感想管理PASSWORD\n"; print "\n"; print "\n"; print "
\n"; print "作品編集PASSWORD\n"; print "\n"; print "編集\n"; print "削除\n"; print "\n"; print "
\n"; print "\n"; print "\n"; exit; } sub html4 { #作者検索一覧 if (!$FORM{'sakusha'}) { &html; } if (!open(FD,"$file")) { print "ERROR!! ログファイル$fileがみつかりません。\n"; } @lines = ; close(FD); foreach (@lines) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki) = split(/\,/,$_); chop($mgki); if ($FORM{'sakusha'} eq $name) { push(@bassline,$_); } } @lines = @bassline; $cnt = @bassline; if ($cnt==0) { &error("指定した作者は存在しません。"); } &date; ⊤ print "$body\n"; print "
\n"; print "\n"; print "$FORM{'sakusha'} 作品集\n"; print "\n"; print "

\n"; print "\n"; print "\n"; &load; if ($FORM{'page'} eq '') { $page = 0; } else { $page = $FORM{'page'}; } $end_data = @lines - 1; $page_end = $page + ($list - 1); if ($page_end >= $end_data) { $page_end = $end_data; } foreach ($page .. $page_end) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki) = split(/\,/,$lines[$_]); chop($mgki); &rep; } print "
[ 現在 $cnt 作品公開中 ]
\n"; &list; print "

\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "
\n"; print "\n"; exit; } sub html5 { #語句検索一覧 $serch = $FORM{'serch'}; if ($serch eq "") { &error("検索語句を指定してください。"); } $serch =~ s/\x81\x40/ /g; @serch = split(/\s+/,$serch); if (!open(FD,"$file")) { print "ERROR!! ログファイル$fileがみつかりません。\n"; } @lines = ; close(FD); foreach (@lines) { $tmp = $_; foreach (@serch) { if (index($tmp,$_) >= 0) { $flag=1; } else { $flag=0; last; } } if ($flag) { push(@bassline,$_); } } @lines = @bassline; $cnt = @bassline; &date; ⊤ print "$body\n"; print "

\n"; print "\n"; print "「$FORM{'serch'}」が含まれる作品\n"; print "\n"; print "

\n"; if ($cnt > 0) { print "\n"; print "\n"; &load; if ($FORM{'page'} eq '') { $page = 0; } else { $page = $FORM{'page'}; } $end_data = @lines - 1; $page_end = $page + ($list - 1); if ($page_end >= $end_data) { $page_end = $end_data; } foreach ($page .. $page_end) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki) = split(/\,/,$lines[$_]); chop($mgki); &rep; } print "
[ $cnt 作品が見つかりました。 ]
\n"; &list; print "

\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "
\n"; } else { print "\n"; print "$serchを含む作品は見つかりませんでした。\n"; print "\n"; print "

\n"; print "戻る\n"; } print "\n"; exit; } sub regist { #記事書き込み if (!$post) { &error("不正アクセスです。") } if ($frlim) { &access($FORM{'value'},$FORM{'access'},10); } $FORM{'url'} =~ s/http\:\/\///g; if ($trips) { $names = &trip($FORM{'name'}); } else { $names = $FORM{'name'}; } $host = $ENV{'REMOTE_ADDR'}; &date; &encopass($FORM{'pwd'}); &lock; if (!open(FD,"$file")) { &error("ファイル読込みに失敗しました。"); } @lines = ; close(FD); if ($FORM{'edit'} ne '') { $retry = 0; foreach (@lines) { ($date,$num,$b_num,$pwds,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$hosts,$re,$mgki) = split(/\,/,$_); chop($mgki); if ($FORM{'num'} eq $num) { if ($FORM{'edit'} ne $pass && crypt($FORM{'edit'},substr($pwds,$salt,2)) ne $pwds) { &error("PASSWORDが一致しません。"); } $retry = 1; if ($FORM{'check'}) { $_ = "$date_now\,$line_num\,$bass_num\,$encpwd\,$FORM{'tit'}\,$names\,$FORM{'mail'}\,$FORM{'url'}\,$FORM{'value'}\,$FORM{'come'}\,$FORM{'fcol'}\,$FORM{'img'}\,$host\,$retry\,$FORM{'mgki'}\n"; } else { $_ = "$date\,$num\,$b_num\,$encpwd\,$FORM{'tit'}\,$names\,$FORM{'mail'}\,$FORM{'url'}\,$FORM{'value'}\,$FORM{'come'}\,$FORM{'fcol'}\,$FORM{'img'}\,$host\,$retry\,$FORM{'mgki'}\n"; } } push(@new,$_); } if (!$retry) { &error("該当記事が見当たりません。"); } } else { if ($FORM{'log'} ne "") { &error("この作品集への新規投稿は締め切っています。"); } $i = 0; foreach (@lines) { ($date,$num,$b_num,$pwds,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$hosts,$re,$mgki) = split(/\,/,$_); chop($mgki); if ($host eq $hosts) { if ($value eq $FORM{'value'}) { &error("二重投稿です。同じ内容がすでに登録されています。"); } if ($wait > $line_num - $num) { &error("前回の投稿からあまり時間が経っていません。もう少し待ってください。"); } } $i++; if ($i == $max) { if ($backup eq '1') { &backfile; } else { last; } } if (!$skip) { push(@new,$_); } } $retry = 0; $value = "$date_now\,$line_num\,$bass_num\,$encpwd\,$FORM{'tit'}\,$names\,$FORM{'mail'}\,$FORM{'url'}\,$FORM{'value'}\,$FORM{'come'}\,$FORM{'fcol'}\,$FORM{'img'}\,$host\,$retry\,$FORM{'mgki'}\n"; unshift(@new,$value); } if (!open(FD,">$file")) { &error("ファイル読込みに失敗しました。"); } print FD @new; close(FD); if ($cnts) { &count; } if ($FORM{'check'}) { $rfile = "$resdir" . "$FORM{'num'}" . '.txt'; $new_rfile = "$resdir" . "$line_num" . '.txt'; rename $rfile => $new_rfile; } &unlock; &cook1("name\:$FORM{'name'}","mail\:$FORM{'mail'}","url\:$FORM{'url'}","pwd\:$FORM{'pwd'}"); &mail; print "Location: $reload" . '?' . "log=$FORM{'log'}" . "\n\n"; } sub regist2 { #感想記事書き込み if (!$post) { &error("不正アクセスです。") } if ($FORM{'name_r'} eq "" || $FORM{'come_r'} eq "") { &error("名前か内容が記入されていません。"); } if ($FORM{'mail_r'} && $FORM{'mail_r'} !~ /(.*)\@(.*)\.(.*)/) { &error("E-MAILの形式が間違っています。正しく登録してください。"); } if (length $FORM{'pwd2'} > 8 || $FORM{'pwd2'} eq "" || $FORM{'pwd2'} =~ /\W/) { &error("投稿者用PASSWORDを半角英数8文字で登録してください。"); } if ($point eq "1") { foreach (@POINT) { if ($_ ne '') { ($pt1,$pts) = split(/=/,$_); if ($pts eq $FORM{'point'}) { $p_flag=1; last; } } } if (!$p_flag) { &error("点数の設定が不正です。"); } } elsif ($point eq "2") { if ($FORM{'point'} > $maxp || $FORM{'point'} < $minp || $FORM{'point'} eq "" || $FORM{'point'} =~ /\D/ ) { &error("$minp点から$maxp点の間で点数をつけてください。"); } } if ($frlim) { &access($FORM{'come_r'},$FORM{'access'},4); } if ($trips) { $names = &trip($FORM{'name_r'}); } else { $names = $FORM{'name_r'}; } $FORM{'url_r'} =~ s/http\:\/\///g; $host = $ENV{'REMOTE_ADDR'}; if ($iplim && crypt ($host," ") eq $FORM{'lim'}) { &error("作者は感想を投稿できません。読者からの感想を待ちましょう。"); } &date; &encopass($FORM{'pwd2'}); &lock; $file2 = "$resdir" . $FORM{'res'} . '.txt'; if (!-e $file2) { if (!open(FD,">$file2")) { &error("ファイル読込みに失敗しました。"); } @lines = ; close(FD); chmod (0666,"$file2"); } else { if (!open(FD,"$file2")) { &error("ファイル読込みに失敗しました。"); } @lines = ; close(FD); } #記事保持件数処理 $i = 0; foreach (@lines) { ($date,$renum,$name,$mail,$url,$come,$poi,$hosts,$pwds2) = split(/\,/,$_); chop($pwds2); if ($host eq $hosts) { if ($iplim2) { &error("感想の投稿は1度までです。"); } if ($FORM{'name_r'} eq $name && $FORM{'come_r'} eq $come) { &error("二重投稿です。同じ内容がすでに投稿されています。"); } } $i++; if ($i == $max2) { last; } push(@new,$_); } $value = "$date_now2\,$line_num\,$names\,$FORM{'mail_r'}\,$FORM{'url_r'}\,$FORM{'come_r'}\,$FORM{'point'}\,$host\,$encpwd\n"; unshift(@new,$value); if (!open(FD,">$file2")) { &error("ファイル読込みに失敗しました。"); } print FD @new; close(FD); &unlock; &cook1("name\:$FORM{'name_r'}","mail\:$FORM{'mail_r'}","url\:$FORM{'url_r'}","pwd\:$FORM{'pwd2'}"); print "Location: $link2&action=html2\n\n"; } sub form { #作品投稿フォーム local($checkflag); if ($in_flag) { if (!open(FD,"$file")) { &error("ファイル読込みに失敗しました。"); } @lines = ; close(FD); if ($FORM{'pwd'} eq $pass) { $admin = 1; } foreach (@lines) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$val,$come,$fcol,$imgs,$host,$re,$mgki) = split(/\,/,$_); chop($mgki); if ($FORM{'num'} eq $num) { if ($admin || crypt($FORM{'pwd'},substr($pwd,$salt,2)) eq $pwd) { $checkflag=1; last; } else { &error("PASSWORDが一致しません。"); } } } if (!$checkflag) { &error("該当作品が見つかりません。"); } } else { if ($FORM{'log'} ne "") { &error("この作品集への新規投稿は締め切っています。"); } } if ($rom eq '1' && !$check_flag && $FORM{'pwd'} ne $pass) { &admin; } $tit =~ s/\0/\,/g; $val =~ s/\0/\,/g; $val =~ s/
/\r/g; $come =~ s/\0/\,/g; $come =~ s/
/\r/g; &cook2; ⊤ print "$body\n"; &title; print "

\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($sakutit eq "1") { print "\n"; print "\n"; print "\n"; print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($checkflag) { if ($sel eq "1") { print "\n"; print "\n"; print "\n"; print "\n"; } elsif ($sel eq "2") { print "\n"; } } if ($FORM{'log'} ne '') { $reload = "$reload?log=$FORM{'log'}"; } print "\n"; print "\n"; print "\n"; print "
\n"; print "お名前(必須)\n"; print "\n"; if ($FORM{'num'} ne '') { print "\n"; } else { print "\n"; } print "
\n"; print "E-Mail(任意)\n"; print "\n"; if ($FORM{'num'} ne '') { print "\n"; } else { print "\n"; } print "
\n"; print "Homepage url\n"; print "\n"; print "http\:\/\/\n"; if ($FORM{'num'} ne '') { print "\n"; } else { print "\n"; } print "
\n"; print "投稿作品(必須)\n"; print "
\n"; print "TITLE\n"; print "\n"; print "\n"; print "
\n"; print "前書き\n"; print "\n"; print "\n"; print "
\n"; print "左詰め\n"; print "\n"; print "中央\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; print "この作品についてのコメント\n"; print "\n"; print "\n"; print "
\n"; print "背景と文字色の選択\n"; print "(指定しない場合、背景色はになります。)\n"; print "
\n"; print "\n"; print "\n"; print "\n"; $i = 0; foreach (@IMG) { if ($_ ne '') { $i++; if ($imgs eq $_) { $usr_img = '1'; print "\n"; $s = $i % 10; if ($s == 0) { print "\n"; } } else { print "\n"; $s = $i % 10; if ($s == 0) { print "\n"; } } } } print "\n"; print "
\n"; print "背景画像\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; print "
\n"; print "背景画像urlをhttp\:\/\/から記述\n"; if ($imgs ne '' && $usr_img ne '1') { print "\n"; } else { print "\n"; } print "
\n"; print "文字色\n"; $i = 0; foreach (@FONT) { if ($_ ne '') { $i++; if ($fcol ne '') { if ($fcol eq $_) { print "\n"; print "\n" } else { print "\n"; print "\n"; } print " \n"; $s = $i % 10; if ($s == 0) { print "
\n"; } } else { if ($i == 1) { print "\n"; print "\n"; } else { print "\n"; print "\n"; } print " \n"; $s = $i % 10; if ($s == 0) { print "
\n"; } } } } print "
\n"; print "修正方法\n"; print "\n"; print "記事を上げる(日付更新)\n"; print "記事はそのまま\n"; print "
\n"; print "PASSWORD\n"; if ($admin) { print "\n"; } else { print "\n"; } if ($checkflag) { print "\n"; print "\n"; } print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "

[一覧へ戻る]

\n"; print "
\n"; print "\n"; print "\n"; exit; } sub html3 { #作品投稿の確認画面 if (!$post) { &error("不正アクセスです。"); } if ($FORM{'name'} eq "" || $FORM{'value'} eq "") { &error("名前か内容が記入されていません。"); } if (length $FORM{'pwd'} > 8 || $FORM{'pwd'} eq "" || $FORM{'pwd'} =~ /\W/) { &error("投稿者用PASSWORDを半角英数8文字で登録してください。"); } if ($FORM{'mail'} && $FORM{'mail'} !~ /(.*)\@(.*)\.(.*)/) { &error("E-MAILの形式が間違っています。正しく登録してください。"); } if ($FORM{'tit'} eq "") { $FORM{'tit'} = '無題'; } if ($trips) { $names = &trip($FORM{'name'}); } else { $names = $FORM{'name'}; } $FORM{'url'} =~ s/http\:\/\///g; if ($FORM{'mode'} eq '2') { $FORM{'value'} = "
$FORM{'value'}"; } if ($FORM{'bg2'} eq "") { $img = $FORM{'bg'}; } else { $img = $FORM{'bg2'}; } ⊤ print "\n"; print "

あなたの投稿作品はこのイメージで表\示されます

\n"; print "\n"; if ($css ne '1') { print "\n"; } else { print "\n"; } print "\n"; print "\n"; if ($css ne '1') { print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "$FORM{'tit'}\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "\n"; print "$FORM{'tit'}\n"; print "\n"; print "
\n"; print "\n"; print "$FORM{'value'}\n"; print "

\n"; } else { print "

\n"; print "\n"; print "$FORM{'value'}\n"; print "\n"; print "

\n"; } print "

\n"; print "
\n"; if ($FORM{'mail'} ne "") { print "$names\n"; } else { print "$names\n"; } print "
\n"; if ($FORM{'url'} ne "") { print "http://$FORM{'url'}
\n"; } print "****年**月**日(week) **時**分**秒 公開\n"; print "
\n"; print "
\n"; print "
■作者からのメッセージ\n"; print "
\n"; $FORM{'come'} =~ s/\r/
/g; if ($FORM{'come'} ne "") { print "$FORM{'come'}\n"; } else { print "作者からのメッセージはありません。\n"; } print "
\n"; print "
\n"; print "

\n"; print <

間違いがなければOKボタンをクリックしてください。

書き直したい場合はブラウザの「戻る」ボタンで戻ってください。

投稿後もPASSWORD [ $FORM{'pwd'} ] を使って編集、削除が可\能\です。

HTML print "\n"; print "\n"; exit; } sub error { #エラー処理 if ($lockon) { &unlock; } print "Content-type: text/html\n\n"; print "エラーです\n"; print "$body\n"; print "

ERROR!!

\n"; print "

$_[0]

\n"; print "\n"; exit; } sub deleview { #作品の削除選択画面 if (!open(FD,"$file")) { &error("ファイル読込みに失敗しました。"); } @lines = ;$cnt = @lines; close(FD); ⊤ print "$body\n"; print "[表\紙へ戻る]\n"; if ($rom eq "1") { print "[新規作品公開]\n"; } &del_log_show; print "
\n"; print "

削除項目を選択してください。

\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "

削除リスト

\n"; print "\n"; print "\n"; if ($FORM{'page'} eq '') { $page = 0; } else { $page = $FORM{'page'}; } $end_data = @lines - 1; $page_end = $page + ($list - 1); if ($page_end >= $end_data) { $page_end = $end_data; } foreach ($page .. $page_end) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki) = split(/\,/,$lines[$_]); chop($mgki); print "\n"; print "\n"; } print "
記事NO\.登録日$tab[0]$tab[1]HOST
$num$date$tit$name$host

\n"; print "

\n"; &list; print "
\n"; print "\n"; exit; } sub deleview2 { #感想の削除選択画面 $file2 = "$resdir" . "$FORM{'key'}" . '.txt'; if (!open(FD,"$file2")) { &error("ファイル読込みに失敗しました。"); } @blines = ; $rescnt = @blines; close(FD); ⊤ print "$body\n"; print "[戻る]\n"; print "
\n"; print "

削除項目を選択してください。

\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "

削除リスト

\n"; print "\n"; print "\n"; if ($FORM{'page2'} eq '') { $page2 = 0; } else { $page2 = $FORM{'page2'}; } $end_data2 = @blines - 1; $page_end2 = $page2 + ($list2 - 1); if ($page_end2 >= $end_data2) { $page_end2 = $end_data2; } foreach ($page2 .. $page_end2) { ($date_r,$renum,$name_r,$mail_r,$url_r,$come_r,$poi,$host_r) = split(/\,/,$blines[$_]); chop($host_r); print "\n"; print "\n"; } print "
記事NO\.登録日感想$tab[1]host
$renum$date_r$come_r$name_r$host_r

\n"; print "\n"; print "

\n"; &list2; print "
\n"; print "\n"; exit; } sub dele { #作品記事削除 local($del,$del2); if (!$post) { &error("不正アクセスです。"); } if (!$in_flag && (!$FORM{'pwd'} || $FORM{'pwd'} ne $pass)) { &error("PASSWORDが一致しません。"); } if (!@CK) { &error("削除する記事にチェックが入っていません。"); } &lock; if (!open(FD,"$file")) { &error("ファイル読込みに失敗しました。"); } @lines = ; close(FD); if ($FORM{'pwd'} eq $pass) { $admin = 1; } foreach (@lines) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki) = split(/\,/,$_); $del = 0; foreach (@CK) { if ($_ eq $num) { $del = 1; $del2 = 1; if (!$admin && crypt($FORM{'pwd'},substr($pwd,$salt,2)) ne $pwd) { &error("PASSWORDが一致しません。"); } $ressfile = $resdir . $_ . '.txt'; unlink($ressfile); if ($cnts) { &count4; } &del_log; } } if(!$del) { push(@new,$_); } } if (!$del2) { &error("該当記事が見当たりません。"); } if (!open(FD,">$file")) { &error("ファイル読込みに失敗しました。"); } print FD @new; close(FD); &unlock; } sub dele2 { #管理者感想記事削除 local($del,$del2); if (!$post) { &error("不正アクセスです。"); } if (!$FORM{'pwd'} || $FORM{'pwd'} ne $pass) { &error("PASSWORDが一致しません。"); } if (!@CK) { &error("削除する記事にチェックが入っていません。"); } &lock; $file2 = "$resdir" . "$FORM{'key'}" . '.txt'; if (!open(FD,"$file2")) { &error("ファイル読込みに失敗しました。"); } @lines = ; close(FD); foreach (@lines) { ($date_r,$renum,$num_r,$name_r,$mail_r,$url_r,$come_r,$host_r,$pwd2) = split(/\,/,$_); $del = 0; foreach (@CK) { if ($_ eq $renum) { $del=1; $del2=1; } } if (!$del) { push(@new,$_); } } if (!$del2) { &error("該当記事が見当たりません。"); } if (!open(FD,">$file2")) { &error("ファイル読込みに失敗しました。"); } print FD @new; close(FD); &unlock; } sub dele3 { #投稿者感想記事削除 local($del) = 0; if (!$post) { &error("不正アクセスです。"); } &lock; $file2 = "$resdir" . "$FORM{'key'}" . '.txt'; if (!open(FD,"$file2")) { &error("ファイル読込みに失敗しました。"); } @lines = ; close(FD); foreach (@lines) { ($date_r,$renum,$num_r,$name_r,$mail_r,$url_r,$come_r,$host_r,$pwd2) = split(/\,/,$_); chop($pwd2); if ($FORM{'gai'} eq $renum) { if ($pwd2 ne "" && crypt($FORM{'pwd2'},substr($pwd2,0,2)) eq $pwd2) { $del=1; next; } &error("PASSWORDが一致しません。"); } push(@new,$_); } if (!$del) { &error("該当記事が見当たりません。"); } if (!open(FD,">$file2")) { &error("ファイル読込みに失敗しました。"); } print FD @new; close(FD); &unlock; print "Location: $link2&action=html2\n\n"; } sub pv { #背景・文字色確認プレビュー ⊤ print "背景と文字色はこのように表\示されます\n"; print "\n"; print "\n"; foreach (@FONT) { if ($_ ne '') { print "Anthologys\n"; print "  \n"; print "Anthologys\n"; print "  \n"; print "($_)\n"; print "

\n"; } } print "

\n"; print "\n"; print "【閉じる】\n"; print "\n"; &foot; exit; } sub cook1 { #クッキー発行(KENTさん[http://www.kent-web.com/]のクッキー処理を引用) local(@cook) = @_; local($gmt, $cook, @t, @m, @w); @t = gmtime(time + 60*24*60*60); @m = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); @w = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); $gmt = sprintf("%s, %02d-%s-%04d %02d:%02d:%02d GMT",$w[$t[6]], $t[3], $m[$t[4]], $t[5]+1900, $t[2], $t[1], $t[0]); $cook=""; foreach (@cook) { $cook .= "$_\,"; } print "Set-Cookie: $cookiename=$cook; expires=$gmt\n"; } sub cook2 { #クッキー取得 local($cookies,$n,$v,$n2,$v2,@pairs,@pairs2); $cookies = $ENV{'HTTP_COOKIE'}; @pairs = split(/;/,$cookies); foreach (@pairs) { ($n, $v) = split(/=/, $_); $n =~ s/ //g; $DUMMY{$n} = $v; } @pairs2 = split(/,/,$DUMMY{$cookiename}); foreach (@pairs2) { ($n2, $v2) = split(/:/, $_); $COOKIE{$n2} = $v2; } } sub backfile { #過去ログ生成 local($backfilename) = "$dir" . "$t_back" . '.txt'; if (!open(BD,">$backfilename")) { last; } print BD @lines; close(BD); @new = ''; $skip = 1; &del_log; } sub dir { #過去ログ表示 local($b_files,$b_name,@dirfile); opendir(DIR,$dir); @dirfile = readdir(DIR); closedir DIR; print "\n"; print "\n"; print "\n"; $i = 1; foreach (@dirfile) { if ($_ =~ /.txt/ && $_ !~ /anthology.txt/) { $i++; $b_files = "$dir" . "$_"; if ($b_files ne '') { $_ =~ s/.txt//; print "\n"; $s = $i % 8; if ($s == 0) { print "\n"; } } } } print "\n"; print "
\n"; if ($FORM{'log'} ne "") { print "\n"; print "最新作品集\n"; print "\n"; } else { print "最新作品集\n"; } print "\n"; $b_name = $backname . $i; if ($FORM{'log'} ne $_) { print "$b_name\n"; } else { print "$b_name\n"; } print "
\n"; } sub home { #HOMEボタンを押した場合のページ切替制御 print "Location: $home\n\n"; } sub encopass { #パスワード暗号化処理(KENTさん[http://www.kent-web.com/]のパスエンコードを引用) local($p1) = @_; local(@saltset, $salt); @saltset = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/'); srand; $salt = $saltset[int(rand(@saltset))] . $saltset[int(rand(@saltset))]; $encpwd = crypt($p1, $salt) || crypt ($p1, '$1$' . $salt); $encpwd; } sub in { #作品の編集・削除の分岐 local($in_flag) = 1; if (!$post) { &error("不正アクセスです。"); } if ($FORM{'type'} eq 'form') { $num = $FORM{'num'}; $pwd = $FORM{'pwd'}; $log = $FORM{'log'}; &form; } elsif ($FORM{'type'} eq 'dele') { push (@CK,$FORM{'num'}); $pwd = $FORM{'pwd'}; $log = $FORM{'log'}; &dele; } } sub lock { #ロック開始 local($lockfile) = $lockdir . 'listlock'; local($try) = 3; if (!$lock) { return; } if (-e $lockfile) { local($mtime) = (stat($lockfile))[9]; if ($mtime < time - 60) { &unlock; } } if ($lock eq '1') { while (!symlink(".", $lockfile)) { if (--$try <= 0) { &error("ビジー状態です。もう少し後に再度投稿してください。"); } sleep(2); } } elsif ($lock eq '2') { while(-f "$lockfile") { if (--$try <= 0) { &error("ビジー状態です。もう少し後に再度投稿してください。"); } sleep(1); } open(LOCK,">$lockfile"); close(LOCK); } $lockon = 1; } sub unlock { #ロック解除 local($lockfile) = $lockdir . 'listlock'; if (-e $lockfile) { unlink($lockfile); } $lockon = 0; } sub date { #現在日時取得 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime(time); @week = ("日","月","火","水","木","金","土"); $date_now = sprintf("%04d年%02d月%02d日(%s) %02d時%02d分%02d秒", $year+1900,$mon+1,$mday,$week[$wday],$hour,$min,$sec); $date_now2 = sprintf("%04d-%02d-%02d %02d:%02d", $year+1900,$mon+1,$mday,$hour,$min); $line_num = sprintf("%04d%02d%02d%02d%02d%02d", $year+1900,$mon+1,$mday,$hour,$min,$sec); $bass_num = sprintf("Unused_BASS_No"); $t_back = sprintf("%04d%02d%02d%02d", $year+1900,$mon+1,$mday,$hour); } sub kyohi { #拒否ユーザの表示ページ $host = $ENV{'REMOTE_HOST'}; $addr = $ENV{'REMOTE_ADDR'}; if ($host eq $addr) { $host = gethostbyaddr(pack("C4",split(/\./,$host)),2) || $addr; } if ($host eq '') { $host = $addr; } foreach (@kyohi) { if (/^$/) { next; } if ($host =~ /$_/i || $addr =~ /$_/i) { &error("アクセス許可がありません。"); } } } sub link { #リンク先の条件分岐 if ($FORM{'sakusha'}) { $link = "$reload?log=$FORM{'log'}&sakusha=$FORM{'sakusha'}&action=html4"; $link2 = "$link&key=$FORM{'key'}&page=$FORM{'page'}"; } elsif ($FORM{'serch'}) { $link = "$reload?log=$FORM{'log'}&serch=$FORM{'serch'}&action=html5"; $link2 = "$link&key=$FORM{'key'}&page=$FORM{'page'}"; } elsif ($FORM{'sort'}) { $link = "$reload?log=$FORM{'log'}&sort=$FORM{'sort'}"; $link2 = "$link&key=$FORM{'key'}&page=$FORM{'page'}"; } else { $link = "$reload?log=$FORM{'log'}"; $link2 = "$link&key=$FORM{'key'}&page=$FORM{'page'}"; } } sub file { #作品ログ読み込み処理 if (!-e $file) { if (!open(FD,">$file")) { &error("$dirが設定されていないか、パーミッションが書込みOKに設定されていません。"); } @lines = ; close(FD); chmod (0666,"$file"); } else { if (!open(FD,"$file")) { &error("ファイル読込みに失敗しました。"); } @lines = ; close(FD); } $cnt = @lines; @lines = sort { $b cmp $a } @lines; } sub file2 { #作品閲覧時の作品ログ読み込み処理 local($find)=0; if (!open(FD,"$file")) { &error("ファイル読込みに失敗しました。"); } while () { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki) = split(/\,/,$_); chop($mgki); if($num == $FORM{'key'}) { $find=1; last; } } close(FD); if (!$find) { &error("指定した作品が見つかりません。"); } } sub title { #TITLEの表示処理 print "
\n"; if ($title_img eq "") { print "\n"; print "$title\n"; print "\n"; } else { print "\n"; } print "
\n"; } sub newup { #NEW,UPの表示 if ($n_view && $n_view*1000000 >= $line_num - $num) { if ($re eq '1') { if ($u_img eq "") { print "UP!!\n"; } else { print "\n"; } } else { if ($n_img eq "") { print "NEW!!\n"; } else { print "\n"; } } } } sub sort { #並び替え処理 local($count,$vlen); foreach (@lines) { ($date,$num,$b_num,$pwd,$tit,$name,$mail,$url,$value,$come,$fcol,$img,$host,$re,$mgki) = split(/\,/,$_); chomp($mgki); $points = 0; $files = $resdir . $num . '.txt'; if (-e $files) { open(MD,"$files"); @blines = ; $rescnt = @blines; close(MD); if ($rescnt != 0) { foreach (@blines) { ($date_r,$renum,$name_r,$mail_r,$url_r,$come_r,$poi,$host_r) = split(/\,/,$_); chop($host_r); $points += $poi; } } else { $points = ''; } } else { $rescnt = 0; $points = ''; } if ($cnts) { $count = &count3; } if ($FORM{'sort'} eq "saku1") { $line = "$tit\,$date\,$num\,$b_num\,$pwd\,$name\,$mail\,$url\,$value\,$come\,$fcol\,$img\,$host\,$re\,$mgki\,$count\,$rescnt\,$points\n"; } elsif ($FORM{'sort'} eq "saku2") { $line = "$name\,$date\,$num\,$b_num\,$pwd\,$tit\,$mail\,$url\,$value\,$come\,$fcol\,$img\,$host\,$re\,$mgki\,$count\,$rescnt\,$points\n"; } elsif ($FORM{'sort'} eq "visit") { $line = "$count\,$date\,$num\,$b_num\,$pwd\,$tit\,$name\,$mail\,$url\,$value\,$come\,$fcol\,$img\,$host\,$re\,$mgki\,$rescnt\,$points\n"; } elsif ($FORM{'sort'} eq "leng") { $vlen = $value; $vlen =~ s/<[^>]*(>|$)//g; $leng = length($vlen); $line = "$leng,$date\,$num\,$b_num\,$pwd\,$tit\,$name\,$mail\,$url\,$value\,$come\,$fcol\,$img\,$host\,$re\,$mgki\,$count\,$rescnt\,$points\n"; } elsif ($FORM{'sort'} eq "rescnt") { $line = "$rescnt\,$date\,$num\,$b_num\,$pwd\,$tit\,$name\,$mail\,$url\,$value\,$come\,$fcol\,$img\,$host\,$re\,$mgki\,$count\,$points\n"; } elsif ($FORM{'sort'} eq "points") { $line = "$points\,$date\,$num\,$b_num\,$pwd\,$tit\,$name\,$mail\,$url\,$value\,$come\,$fcol\,$img\,$host\,$re\,$mgki\,$count\,$rescnt\n"; } else { return; } push(@vline,$line); } if ($FORM{'sort'} eq "saku1" || $FORM{'sort'} eq "saku2") { @vline = sort @vline; } else { @vline = sort { $b <=> $a } @vline; } } sub load { #一覧表題の生成処理 print "\n"; print "$tab[0]\n"; print "$tab[1]\n"; print "$tab[2]\n"; print "$tab[3]\n" if ($cnts); print "$tab[4]\n" if ($byte); print "$tab[5]\n"; print "$tab[6]\n" if ($point ne ""); print "\n"; } sub rep { #一覧の生成処理 local($points,%ress,@reses,$rname,$rno,$rfin,%sp,@sps,$spk,$spno,$spfin,$count,$len,$vlen); print "\n"; chomp($mgki); print "\n"; &newup; print "\n"; print "\n"; print "$tit\n"; print "\n"; print "\n"; print "\n"; if ($mail eq "") { print "$name\n"; } else { print "$name\n"; } print "\n"; print "$date\n"; $files = $resdir . $num . '.txt'; if (-e $files) { open(MD,"$files"); @blines = ; $rescnt = @blines; close(MD); if ($rescnt != 0) { foreach (@blines) { ($date_r,$renum,$name_r,$mail_r,$url_r,$come_r,$poi,$host_r,$pwd2) = split(/\,/,$_); chop($pwd2); if ($name_r ne '') { $ress{$name_r}++; } if ($point ne "") { if ($poi eq '') { $poi = 0; } $sp{$poi}++; $points += $poi; } } } else { $points = ''; } } else { $rescnt = 0; $points = ''; } if ($cnts) { $count = &count3; print "\n"; print "$count\n"; print "\n"; } if ($byte) { $vlen = $value; $vlen =~ s/<[^>]*(>|$)//g; $len = length($vlen); if ($len > 10240) { $len >>= 10; $len .= "k"; $len = "$len"; } print "\n"; print "$len\n"; print "\n"; } if ($rescnt) { while ( ($rname,$rno) = each(%ress) ) { if ($rno <= 1) { push(@reses,"〔$rname〕 \n"); } else { push(@reses,"〔$rname($rno)〕 \n"); } } $reses[0] = " $reses[0]"; $rfin = pop(@reses); chomp($rfin); push(@reses,$rfin); } print "\n"; print "$rescnt\n"; print "\n"; if ($point ne "") { if ($rescnt) { while ( ($spk,$spno) = each(%sp) ) { push(@sps,"〔$spk点×$spno〕 \n"); } $sps[0] = " $sps[0]"; $spfin = pop(@sps); chomp($spfin); push(@sps,$spfin); } if ($points eq "") { $points = '0'; } if ($points > 0) { $points = "$points"; } elsif ($points < 0) { $points = "$points"; } print "\n"; print "$points\n"; print "\n"; } print "\n"; } sub list { #一覧の改page処理(作品リスト) local($pag,$no,$start,$final,$rlink); $pag = 0; $no = 1; $start = $page + 1; $final = $page + $list; if ($FORM{'action'} eq 'sentaku' || $FORM{'action'} eq 'dele') { $rlink = "$reload?log=$FORM{'log'}&action=sentaku&pwd=$FORM{'pwd'}"; } else { $rlink = $link; } if (@lines > $list) { print "

\n"; print "【 作品 LIST 】 \n"; while ($pag < @lines ) { if($page ne $pag) { print "[$no]\n"; } else { print "[$no]\n"; } $pag = $pag + $list; $no++; } if ($final >= $cnt) { print "作品はここまでです。\n"; $final = $cnt; } print " ( $start - $final / $cnt )
\n"; } } sub list2 { #感想記事の改page処理(管理pageの感想リスト) local($pag,$no,$start,$final,$rlink); $pag = 0; $no = 1; $start = $page2 + 1; $final = $page2 + $list2; $rlink = "$link2&action=sentaku2&pwd=$FORM{'pwd'}"; if (@blines > $list2) { print "PAGE\n"; while ($pag < @blines ){ if($page2 ne $pag) { print "[$no]\n"; } else { print "[$no]\n"; } $pag = $pag + $list2; $no++; } if ($final >= $rescnt) { $final = $rescnt; } print " ( $start - $final / $rescnt )\n"; } } sub count { #カウントファイル生成 local($cfile,$data,$ct); if ($FORM{'num'} ne '') { $cfile = "$cntdir" . "$FORM{'num'}" . '.txt'; $new_cfile = "$cntdir" . "$line_num" . '.txt'; rename $cfile => $new_cfile; } else { $cfile = "$cntdir" . "$line_num" . '.txt'; open(NO,">$cfile"); print NO "0:"; close(NO); } } sub count2 { #カウント数書き込み local($cfile2,$data,$ct,$ip,$addr); $cfile2 = "$cntdir" . "$num" . '.txt'; $addr = $ENV{'REMOTE_ADDR'}; open(IN,"$cfile2"); $data = ; close(IN); ($ct,$ip) = split(/:/, $data); $ct++; if ($cnts eq "2" || $addr ne $ip) { open(OUT,">$cfile2"); print OUT "$ct\:$addr"; close(OUT); } } sub count3 { #カウント数読み込み local($cfile3,$ct,$data); $cfile3 = "$cntdir" . "$num" . '.txt'; if (-e $cfile3) { open(NO,"$cfile3"); $data = ; close(NO); ($ct) = split(/:/, $data); } else { $ct = 0; } $ct; } sub count4 { #カウントファイル削除 local($cfile4); $cfile4 = "$cntdir" . "$num" . '.txt'; unlink($cfile4); } sub del_log { #削除ログ書き込み local($dfile,$del_cnt,$del_line,@del_lines); if ($FORM{'log'} eq "") { $dfile = "$del_dir" . 'del_' . 'anthology' . '.txt'; } else { $dfile = "$del_dir" . 'del_' . "$FORM{'log'}" . '.txt'; } open(FD,"$dfile"); @del_lines = ; $del_cnt = @del_lines; close(FD); &date; if (!$skip) { if ($del_cnt >= $del_max) { pop(@del_lines); } if ($admin) { $del_line .= "$date_now:『$tit』:$name:<<管理者削除>>\n"; } else { $del_line .= "$date_now:『$tit』:$name\n"; } unshift(@del_lines,$del_line); } else { unlink($dfile); $dfile = "$del_dir" . 'del_' . "$t_back" . '.txt'; } open(FD,">$dfile"); print FD @del_lines; close(FD); } sub del_log_show { #削除ログ表示(管理者モード時のみ) local($dfile); if ($FORM{'log'} eq "") { $dfile = "$del_dir" . 'del_' . 'anthology' . '.txt'; } else { $dfile = "$del_dir" . 'del_' . "$FORM{'log'}" . '.txt'; } if (-e $dfile) { print "[削除LOG]\n"; } } sub mail { #メール送信処理 if ($mailsend ne "1" || $mailto eq $FORM{'mail'}) { return; } local($subject) = "[$title] 新着情報"; local($subject2) = "[$title] 投稿ありがとうございました"; local($subj) = "$FORM{'tit'}"; local($subj2) = "$FORM{'mgki'}"; local($name) = "$FORM{'name'}"; local($email) = "$FORM{'mail'}"; local($url) = "$FORM{'url'}"; local($ps) = "$FORM{'pwd'}"; local($reloads) = "$reload?action=html2&key=$line_num"; local($reloades) = "$reload?action=html2&key=$num"; &jcode'convert(*subject,'jis'); &jcode'convert(*subject2,'jis'); &jcode'convert(*subj,'jis'); &jcode'convert(*subj2,'jis'); &jcode'convert(*name,'jis'); &jcode'convert(*email,'jis'); &jcode'convert(*url,'jis'); &jcode'convert(*ps,'jis'); if (open(OUT,"| $sendmail $mailto")) { print OUT "To: $mailto\n"; print OUT "From: $email\n"; print OUT "Subject: $subject\n"; print OUT "Content-Transfer-Encoding: 7bit\n"; print OUT "Content-Type: text/plain\n"; print OUT "\n\n"; if ($retry eq '1') { print OUT "$name" . "さんより以下の作品の修正投稿がありました\n"; } else { print OUT "$name" . "さんより以下の作品の投稿がありました\n"; } print OUT "TITLE:$subj\n"; print OUT "前書き:$subj2\n"; if ($email ne "") { print OUT "mailto:$email\n"; } else { print OUT "E-Mailの登録はありません。\n"; } if ($url ne "") { print OUT "homepage:http://$url\n"; } else { print OUT "URLの登録はありません。\n"; } if ($retry eq '1') { print OUT "$reloades\n"; } else { print OUT "$reloads\n"; } close(OUT); } if ($email ne '') { if (open(OUT,"| $email")) { print OUT "To: $email\n"; print OUT "From: $mailto\n"; print OUT "Subject: $subject2\n"; print OUT "Content-Transfer-Encoding: 7bit\n"; print OUT "Content-Type: text/plain\n"; print OUT "\n\n"; if ($retry eq '1') { print OUT "$name" . "さんが修正投稿した作品\n"; } else { print OUT "$name" . "さんが投稿した作品\n"; } print OUT "TITLE:$subj\n"; print OUT "前書き:$subj2\n"; if ($url ne "") { print OUT "homepage:http://$url\n"; } else { print OUT "URLの登録はありません。\n"; } print OUT "編集削除用PASSWORD [ $ps ]\n"; print OUT "$name" . "さんの作品は以下のURLで確認できます。\n"; if ($retry eq '1') { print OUT "$reloades\n"; } else { print OUT "$reloads\n"; } print OUT "\n\n"; print OUT "またの投稿をお待ちしています。\n"; print OUT "$webmaster\n"; print OUT "mailto:$mailto\n"; close(OUT); } } } sub access { #海外ボット対策 local(@axs) = @_; local(@urls); if ($axs[0] !~ /[\x80-\xff]/) { &error("投稿は日本語でお願いします。"); } if ($axs[1] ne "あ") { &error("海外ブラウザからの投稿はお断りです。"); } @urls = ($axs[0] =~ m|https?://|ig); if ($#urls + 1 >= $axs[2]) { &error("内容に記述されたURLが多すぎます。"); } } sub trip { #トリップ処理(KENTさん[http://www.kent-web.com/]のトリップ機能を引用) local($name) = @_; $name =~ s/◆/◇/g; if ($name =~ /#/) { local($handle,$trip) = split(/#/, $name, 2); local($enc) = crypt($trip, ' ') || crypt ($trip, '$1$' . ' '); $enc =~ s/^..//; return "$handle◆$enc"; } else { return $name; } } #Script_END