#!/usr/bin/perl #================# # プログラム情報 # #================#------------------------------------------# # # # TreeBBS ver.1.10 # # Produced by [GROOWEB] Takahiro Aoki # # # # URL:http://www.tsubaki.sakura.ne.jp/~campus/grooweb/ # # E-Mail:campus@tsubaki.sakura.ne.jp # # # #-----------------------------------------------------------# #===初期設定ここから========================================# #--ファイル名やアドレスなどの設定--# # ファイルの場所を変更した場合は相対パスも含める # このスクリプトのファイル名 $cgifile = './tree.cgi'; # Assistanceファイルの名前 $assistancefile = './assist.cgi'; # データファイルの名前 $datafile = './data/tree.dat'; # カウンタ保存ファイルの名前 $countfile = './data/count.log'; # 戻り先のURL(ホームページなど) $home = 'http://www.ouzan.net/toto.html'; #--表示に関する設定--# # 掲示板のタイトル $bbs_title = 'toto BBS'; # タイトルの書体(フォント名を書く) $title_f = 'Comic Sans MS'; # タイトルのサイズ $title_s = '5'; # タイトルのカラー $title_c = '#000000'; # タイトルに画像を使う場合はパスと名前を指定 $title_image = ''; # 画像ファイルのパス指定 # 名前を変更した場合は名前も変更すること $newgif = './images/new.gif'; # 新着用のイメージ画像 $clipgif = './images/clip.gif'; # クリップ用のイメージ画像 # 全体の区切り線(ボーダー)の太さ $border_b = '1'; # 全体的なバーの色(デフォルトはなし) $bar_color = '#EEEEEE'; # フォントの基本サイズ(スタイルシートで) $base_size = '10pt'; # フォントの基本カラー(デフォルトはグレイ) $base_color = '#666666'; # 背景色(全体に適用されます) $base_bgcolor = '#FFCC00'; # 背景に画像を使う場合は背景画像までのパス $background = ''; # 表示していないリンクのカラー $alinkcolor = '#3A75E2'; # 既に表示したリンクのカラー $avisitedcolor = '#1F96C9'; # マウスが上にある時のカラー $ahovercolor = '#F127BF'; # それぞれのリンクに下線をつけるかつけないか # (つける='underline' つけない='none') $al_decoration = 'none'; # 表示していないリンク $av_decoration = 'none'; # 既に表示したリンク $ah_decoration = 'underline'; # マウスが上にある時のリンク # 親記事のヘッド部分のサイン(☆や◇など好みでどうぞ) $base_head = '◆'; # 表示部分の親記事のセル背景色(デフォルトはグレイ) $main_cellbg = '#DDDDDD'; # ページトップのモード表示部分のセル色 $top_cellbar = '#DDDDDD'; # メインページ上部に表示させたい説明を編集できます(タグ可) $mini_manual = ' □ 24時間以内に投稿された記事には が表示されます。
をクリックすると 関連記事の一覧を見ることが出来ます。
'; # 新記事投稿ページ上部に表示させたい説明を編集できます(タグ可) $in_minimanual = " □ プレビューすると実際の投稿イメージを確認出来ます。
□ タグは使用できません。ご注意ください。
"; #--処理に関する設定--# # ホストを表示する(yes='1' no='0') $host_flag = '0'; # 上が1の場合はホストのカラーを指定(16進数) $host_color = '#666666'; # カウンターを表示する(yes='1' no='0') $countflag = '1'; # カウンターの桁数 $count_width = '6'; # メソッドのタイプ('post' or 'get') $method = 'post'; # 1ページに表示する件数(あまり大きくすると処理がおそくなります) # また、返信記事はカウントされません $p_log = '15'; # 全記事の最大保存件数(100程度が目安) $maxmessage = '100'; # クッキーの名前(必要であればお好みで変更してください) $cookie_name = 'GWsupportbbs'; # クッキーの有効期限 $holds = '20'; # 次の時間以内に投稿された記事を新着扱いする $new_time = '24'; # マスターキーの設定(半角英数8文字以内で指定) $MASTERKEY = '1954'; # ロック処理を行う?(Yes='1' No='0') $lockkey = '1'; # ロックファイルの名前(CGIが自動生成) # ファイル名の競合が起きる場合のみ変更してください $lockfile = './data/lock.file'; # ライブラリへのパス require './jcode.pl'; #===初期設定ここまで========================================# #============# # メイン処理 # #============# &get_Host; &form_decode; if ($countflag) { &countup; } if ($in{'action'} eq 'view') { &view; } elsif ($in{'action'} eq 'manual') { &manual; } elsif ($in{'action'} eq 'clip') { &clip; } elsif ($in{'action'} eq 'indata') { &indata; } elsif ($in{'action'} eq 'usr_kill') { &usr_kill; } elsif ($in{'action'} eq 'management') { &management; } elsif ($in{'action'} eq 'check_in') { &check_in; } elsif ($in{'action'} eq 'management_action') { &management_view("$in{'mode'}"); } else { &basic; } #===S/記事表示処理===================================================# sub basic { &cookie_in; &html_head; if ($countflag) { $countview = sprintf ("%0${count_width}d", $count); print "$countview\n"; } if ($title_image eq "") { print "
\n"; print "$bbs_title
\n"; } else { print "
\n"; } print <<"HERE";

[HOME] // [使い方] // [新規投稿] // [新着記事] // [最新の状態] // [ワード検索] // [管理用]
$mini_manual

HERE open(FILE, "$datafile"); @allbody = ; close(FILE); if ($page eq "") { $page = '1'; } $start = $page; $end = $page + $p_log - 1; $nowtime = time; open(FILE, "$datafile"); $i = 0; $allno = 0; while () { ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$H_A,$PWD) = split(/\,/,); $allno++; if ($res eq '0') { $i++; if ($i < $start) { next; } if ($i > $end) { next; } if (($nowtime - $time) > $new_time*3600) { $newsign = ""; } else { $newsign = ""; } if ($mail ne "") { $name = "$name"; } print <<"HERE";

. $base_head $title - 【$name】$date NO:$no $newsign
HERE $xmode = 0; $xxx = '.........'; foreach $res (@allbody) { ($rno,$rres,$rname,$rmail,$rtitle,$rcomment,$rdate,$rtime,$rhp,$rH_A,$rPWD) = split(/\,/, $res); if ($no eq "$rres") { $xmode++; if ($rmail ne "") { $rname = "$rname"; } if (($nowtime - $rtime) > $new_time*3600) { $rnewsign = ""; } else { $rnewsign = ""; } print "\n"; print "$xxx" x $xmode; print "\n"; print <<"HERE";  Re: $rtitle - 【$rname】 $rdate NO:$rno $rnewsign
HERE } } print "
\n"; } } close(FILE); if (@allbody == "") { print "

\表\示する記事はありません...

\n"; } #--ページフッター部分の表示--# print <<"HERE";


現在$allno件の書き込みがあります。
全ページ数 / HERE $p = 0; $p_start = 0; $i += 1; while($p_start <= "$i") { $p++; if ($p eq '1') { $p_start = '1'; } else { $p_start += $p_log; } if ($in{'page'} eq '') { $in{'page'} = '1'; } if ($p_start ne "$in{'page'}") { $p_no = "$p"; } else { $p_no = "$p"; } if ($p_start < $i) { print "[$p_no]\n"; } } if (@allbody == "") { print "[1]\n"; } print <<"HERE";
 
【記事削除フォーム】
記事No/
パスワード/

HERE &html_footer; exit; } #===S/記事の展開=====================================================# sub view { &cookie_in; &html_head; if ($title_image eq '') { print "
\n"; print "\n"; print "$bbs_title\n"; print "
\n"; } else { print "
\n"; } print <<"HERE";

[HOME] // [使い方] // [新規投稿] // [新着記事] // [リスト\表\示] // [ワード検索] // [管理用]

HERE open(FILE, "$datafile"); @allbody = ; close(FILE); foreach $line (@allbody) { ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$H_A,$PWD) = split(/\,/, $line); if ($in{'no'} eq "$no") { $flagno = "$no"; $main_rescom = "$comment"; if ($mail eq "") { $mail = "未記入"; } else { $mail = "$mail"; } if ($hp eq "") { $hp = "未記入"; } else { $hp = "$hp"; } if ($in{'res'} eq "") { $title = "$base_head $title"; $position = "(親記事)"; } else { $title = "Re: $title"; $position = "(記事No$in{'res'}への返信記事)"; } $main_rescom =~ s/([^=^\"]|^)(http\:[\w\.\~\-\/\?\&\+\=\:\@\%\;\#]+)/$1$2<\/a>/g; print <<"HERE";
$title
記事No/ $no $position
投稿者/ $name HERE if ($host_flag) { print "Host:$H_A"; } print <<"HERE";
投稿日/ $date
E-Mail/ $mail
URL/ $hp
$main_rescom
HERE } } if ($in{'res'} eq "") { $moveno = "$in{'no'}"; } else { $moveno = "$in{'res'}"; } print <<"HERE";

 以下は関連する記事の一覧です。 [
一括\表\示]

HERE if ($in{'res'} eq "") { foreach $line (@allbody) { ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$H_A,$PWD) = split(/\,/, $line); if ($in{'no'} eq "$no") { if ($mail ne "") { $name = "$name"; } $flagtitle = "$title"; print<<"HERE"; $base_head $title - 【$name】 $date NO:$no
HERE } } $xmode = 0; $xxx = '.........'; foreach $line (@allbody) { ($rno,$rres,$rname,$rmail,$rtitle,$rcomment,$rdate,$rtime,$rhp,$rH_A,$rPWD) = split(/\,/, $line); if ($in{'no'} eq "$rres") { $xmode++; if ($rmail ne "") { $rname = "$rname"; } print "\n"; print "$xxx" x $xmode; print "\n"; print<<"HERE"; Re: $rtitle - 【$rname】 $rdate NO:$rno
HERE } } } else { foreach $line (@allbody) { ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$H_A,$PWD) = split(/\,/, $line); if ($in{'res'} eq "$no") { if ($mail ne "") { $name = "$name"; } $flagtitle = "$title"; print<<"HERE"; $base_head $title - 【$name】 $date NO:$no
HERE } } $xmode = 0; $xxx = '.........'; foreach $line (@allbody) { ($rno,$rres,$rname,$rmail,$rtitle,$rcomment,$rdate,$rtime,$rhp,$rH_A,$rPWD) = split(/\,/, $line); if ($in{'res'} eq "$rres") { $xmode++; if ($rmail ne "") { $rname = "$rname"; } print "\n"; print "$xxx" x $xmode; print "\n"; print<<"HERE"; Re: $rtitle - 【$rname】 $rdate NO:$rno
HERE } } } if ($in{'res'} eq "") { $flagno = "$in{'no'}"; } else { $flagno = "$in{'res'}"; } $main_rescom = "> $main_rescom"; $main_rescom =~ s/
/> /g; print <<"HERE";

このツリーへの返信はこちらのフォームより投稿できます。


お名前/
E-Mail/
タイトル/
コメント/
URL/
オプション/ 個人情報をクッキーに保存。 投稿前にプレビューする。
パスワード/ *記事削除の際に使用。(半角英数字で8文字以内)

HERE &html_footer; exit; } #===S/関連記事の一括表示=============================================# sub clip { &html_head; if ($title_image eq '') { print "
\n"; print "\n"; print "$bbs_title\n"; print "
\n"; } else { print "
\n"; } print <<"HERE";

[HOME] // [使い方] // [新規投稿] // [新着記事] // [リスト\表\示] // [ワード検索] // [管理用]

このツリーに関連するすべての記事を一括\表\示しています。


HERE open(FILE, "$datafile"); @allbody = ; close(FILE); foreach $line (@allbody) { ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$H_A,$PWD) = split(/\,/, $line); if ($in{'no'} eq "$no") { if ($mail ne "") { $name = "$name"; } $mainline = "$line"; $flagno = "$no"; $flagtitle = "$title"; print<<"HERE"; $base_head $flagtitle - 【$name】 $date NO:$no
HERE } } $xmode = 0; $xxx = '.........'; foreach $line (@allbody) { ($rno,$rres,$rname,$rmail,$rtitle,$rcomment,$rdate,$rtime,$rhp,$rH_A,$rPWD) = split(/\,/, $line); if ($in{'no'} eq "$rres") { $xmode++; if ($rmail ne "") { $rname = "$rname"; } print "\n"; print "$xxx" x $xmode; print ""; print<<"HERE"; Re: $rtitle - 【$rname】 $rdate NO:$rno
HERE } } ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$H_A,$PWD) = split(/\,/, $mainline); if ($mail eq "") { $mail = "未記入"; } else { $mail = "$mail"; } if ($hp eq "") { $hp = "未記入"; } else { $hp = "$hp"; } $position = "(親記事)"; $main_rescom = "$comment"; $comment =~ s/([^=^\"]|^)(http\:[\w\.\~\-\/\?\&\+\=\:\@\%\;\#]+)/$1$2<\/a>/g; print <<"HERE";


$base_head $flagtitle
記事No/ $no $position
投稿者/ $name HERE if ($host_flag) { print "Host:$H_A"; } print <<"HERE";
投稿日/ $date
E-Mail/ $mail
URL/ $hp
$comment
HERE foreach $line (@allbody) { ($rno,$rres,$rname,$rmail,$rtitle,$rcomment,$rdate,$rtime,$rhp,$rH_A,$rPWD) = split(/\,/, $line); if ($in{'no'} eq "$rres") { if ($rmail ne "") { $rname = "
$rname"; } if ($rmail eq "") { $rmail = "未記入"; } else { $rmail = "$rmail"; } if ($rhp eq "") { $rhp = "未記入"; } else { $rhp = "$rhp"; } $position = "(記事No$in{'no'}への返信記事)"; $rcomment =~ s/([^=^\"]|^)(http\:[\w\.\~\-\/\?\&\+\=\:\@\%\;\#]+)/$1$2<\/a>/g; print<<"HERE";


Re: $rtitle
記事No/ $rno $position
投稿者/ $rname HERE if ($host_flag) { print "Host:$rH_A"; } print <<"HERE";
投稿日/ $rdate
E-Mail/ $rmail
URL/ $rhp
$rcomment
HERE } } &cookie_in; $main_rescom = "> $main_rescom"; $main_rescom =~ s/
/> /g; print <<"HERE";
このツリーへの返信はこちらのフォームより投稿できます。


お名前/
E-Mail/
タイトル/
コメント/
URL/
オプション/ 個人情報をクッキーに保存。 投稿前にプレビューする。
パスワード/ *記事削除の際に使用。(半角英数字で8文字以内)

HERE &html_footer; exit; } #===S/記事投稿処理===================================================# sub indata { if ($in{'in_flagkey'} eq 'on') { $res = $in{'res'}; $name = $in{'name'}; $title = $in{'title'}; $comment = $in{'comment'}; $mail = $in{'mail'}; $hp = $in{'hp'}; $pass = $in{'pass'}; if ($name eq "") { &error("お名前が未記入です"); } elsif ($title eq "") { &error("タイトルが未記入です"); } elsif ($comment eq "") { &error("コメントが未記入です"); } #--取得データを整形する--# chomp $comment; $name =~ tr/,/./; $mail =~ tr/,/./; $title =~ tr/,/./; $comment =~ tr/,/./; $hp =~ tr/,/./; $comment =~ s/\r\n/
/g; $comment =~ s/\n/
/g; $comment =~ s/

/

/g; if ($in{'p_key'} eq 'on') { $in{'comment'} =~ s/\n//g; } $PWD = crypt($pass, "xx"); if ($hp eq "http://") { $hp = ''; } &lock1; open(FILE, "$datafile"); $master = ; close(FILE); ($l_0,$l_1,$l_2,$l_3,$l_4,$l_5,$l_6,$l_7,$l_8,$l_9,$l_10) = split(/\,/, $master); #--二重投稿を禁止する--# if ($name eq "$l_2" && $title eq "$l_4" && $comment eq "$l_5") { &lock2; &error("二重投稿は禁止です!"); } $no = "$l_0"; if ($no eq "") { $no = '0'; } $no++; if ($in{'p_key'} eq 'on') { &lock2; &html_head; if ($title_image eq "") { print "
\n"; print "$bbs_title
\n"; } else { print "
\n"; } if ($mail eq "") { $mail = "未記入"; } else { $mail = "$mail"; } if ($hp eq "") { $hp = "未記入"; } else { $hp = "$hp"; } if ($in{'res'} eq "" || $in{'res'} eq "0") { $title = "$base_head $title"; $position = "(親記事)"; } else { $title = "Re: $title"; $position = "(記事No$in{'res'}への返信記事)"; } &gettime; $comment =~ s/([^=^\"]|^)(http\:[\w\.\~\-\/\?\&\+\=\:\@\%\;\#]+)/$1$2<\/a>/g; print <<"HERE";


以下の内容でメッセージを投稿します。

$title
記事No/ $no $position
投稿者/ $name
投稿日/ $gettime
E-Mail/ $mail
URL/ $hp
$comment

HERE &html_footer; } else { &gettime; $nowtime = time; $tmp = "$no,$res,$name,$mail,$title,$comment,$gettime,$nowtime,$hp,$Host,$PWD\n"; if (!open(FILE, "$datafile")) { &lock2; &error("ファイルオープンエラー"); } @allbody = ; close(FILE); $num = unshift (@allbody, $tmp); if ($num > $maxmessage) { pop @allbody; } if (!open(FILE, ">$datafile")) { &lock2; &error("ファイルオープンエラー"); } print FILE @allbody; close(FILE); &lock2; #--チェックが入っていればクッキーを発行する--# if ($in{'cookie_key'} eq 'on') { ($secg, $ming, $hourg, $dayg, $mong, $yearg, $wdyg, $ydayg, $isdstg) = localtime(time + $holds*24*60*60); @c_youbi = ("Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat"); $yearg += 1900; $mong++; $forCookie = "@c_youbi[$wdyg], $dayg-$mong-$yearg $hourg:$ming:$secg GMT"; print "Set-Cookie: $cookie_name = $name,$mail,$hp; expires=$forCookie\n"; } &basic; exit; } } else { &cookie_in; &html_head; if ($title_image eq "") { print "
\n"; print "$bbs_title
\n"; } else { print "
\n"; } print <<"HERE";

[
HOME] // [使い方] // [新規投稿] // [新着記事] // [リスト\表\示] // [ワード検索] // [管理用]
$in_minimanual

お名前/
E-Mail/
タイトル/
コメント/
URL/
オプション/ 個人情報をクッキーに保存。 投稿前にプレビューする。
パスワード/ *記事削除の際に使用。(半角英数字で8文字以内)

HERE &html_footer; } } #===Sユーザー記事削除サブルーチン====================================# sub usr_kill { if ($in{'number'} eq "") { &error("記事ナンバーを入力してください"); } elsif ($in{'pass'} eq "") { &error("パスワードを入力してください"); } $crypted = crypt($in{'pass'}, "xx"); chomp $crypted; &lock1; if (!open(FILE, "$datafile")) { &lock2; &error("ファイルオープンエラー"); } @killbody = ; close(FILE); $next_flag = 0; $exit_flag = 0; foreach $k_line (@killbody) { ($no,$res,$name,$mail,$title,$date,$comment,$color,$hp,$H_A,$m_pass) = split(/\,/, $k_line); if ($in{'number'} eq "$no") { $exit_flag = "1"; chomp $m_pass; if ($crypted eq "$m_pass" || $in{'pass'} eq "$MASTERKEY") { $next_flag = "1"; $k_line =~ s/.*\n//; } else { &lock2; &error("パスワードが違います!"); } } } #--続いて元記事への返信がないかチェック--# if ($exit_flag eq '0') { &lock2; &error("該当する記事Noがありません"); } if ($next_flag eq '1') { foreach $k_line (@killbody) { ($r_0,$r_1,$r_2,$r_3,$r_4,$r_5,$r_6,$r_7,$r_8,$r_9,$r_10) = split(/\,/, $k_line); if ($in{'number'} eq "$r_1") { $k_line =~ s/.*\n//; } } } open(FILE, ">$datafile"); print FILE @killbody; close(FILE); &lock2; &basic; exit; } #===S/HTMLヘッダー&フッター処理=====================================# sub html_head { if ($background) { $backgroundx = "background: url($background)\n"; } $small_size = $base_size-2; $big_size = $base_size+1; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "$bbs_title\n"; print "\n"; print "\n"; print "\n"; } #--著作権表示(削除不可)--# sub html_footer { $grooweb = "http://www.tsubaki.sakura.ne.jp/~campus/grooweb/"; print "
\n"; print "Produced by \n"; print "- GROOWEB -
\n"; print "\n"; } #===S/管理モードサブルーチン=========================================# sub management { &html_head; &management_head; sub management_head { if ($title_image eq "") { print "
\n"; print "$bbs_title
\n"; } else { print "
\n"; } print <<"HERE";

終了 管理モード
HERE } print <<"HERE";


記事削除
カウンター値編集


HERE exit; } sub check_in { if ($in{'master_check'} ne "") { if ($in{'master_check'} eq "$MASTERKEY") { &management_view("$in{'mode'}"); } else { &error("マスターキーが違います!"); } } else { &management; } } sub management_view { if ($_[0] eq 'mode_kill') { &bbs_kill; } elsif ($_[0] eq 'mode_count') { &bbs_count; } sub bbs_kill { &html_head; &management_head; unless (@DEL == "") { &lock1; if (!open(FILE, "$datafile")) { &lock2; &error("ファイルオープンエラー"); } @lines = ; close(FILE); foreach $D_line (@lines) { ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$H_A,$PWD) = split(/\,/, $D_line); foreach $del (@DEL) { if ($no eq "$del") { $D_line =~ s/.*\n//; } } } foreach $D_line (@lines) { ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$H_A,$PWD) = split(/\,/, $D_line); foreach $del (@DEL) { if ($res eq "$del") { $D_line =~ s/.*\n//; } } } if (!open(FILE, ">$datafile")) { &lock2; &error("ファイルオープンエラー"); } print FILE @lines; close(FILE); &lock2; } print <<"HERE";


削除したい記事にチェックを入れて削除ボタンを押してください。
HERE open(FILE, "$datafile"); @allbody = ; close(FILE); foreach $line (@allbody) { ($no,$res,$name,$mail,$title,$comment,$date,$time,$hp,$Host,$PWD) = split(/\,/, $line); ($date2,$time2) = split(/\)/, $date); $comment =~ s/
//g; if (length($comment) > 41) { $comment = substr($comment,0,39); $comment = "$comment" . "..."; } print <<"HERE";
HERE } print <<"HERE";
削除 No 投稿者 タイトル コメント 投稿日 リモートホスト
$no$name $title$comment $date2)$Host


*元記事を削除した場合、レス記事も自動的に削除されます。
HERE exit; } sub bbs_count { if ($in{'c_value'} ne "") { if ($in{'c_value'} =~ /\D/) { &error("カウンター値には半角数字のみ使用してください"); } &lock1; if (!open(FILE, ">$countfile")) { &lock2; &error("ファイルオープンエラー"); } print FILE "$in{'c_value'}"; close(FILE); &lock2; &basic; exit; } &html_head; &management_head; print <<"HERE";



カウンターの開始値を入力して送信ボタンを押してください。
HERE exit; } } #===S/使い方表示=====================================================# sub manual { &html_head; if ($title_image eq "") { print "
\n"; print "$bbs_title
\n"; } else { print "
\n"; } print <<"HERE";

Back $bbs_titleの使い方

はじめに
・この掲示板はツリー\表\示型の掲示板です。
・記事は最大で$maxmessage件保存でき、それ以上は古いものから削除されます。
・1ページには最大$p_log件\表\示出来ます。
・各ページへはページ下部のリンクから移動できます。
・管理者が不適切であると判断した記事は、\予\告無く削除する場合があります。
記事の投稿の仕方
・記事の投稿は、「新規投稿」から行います。
・お名前・タイトル・コメントは必修項目です。
・他人を中傷する内容や、電話番号/住所などは書き込まないよう注意しましょう。
・「クッキーに保存」にチェックを入れておくと、次回から入力の手間が省けます。
タグは使用できません。ご注意ください。
記事の削除
・ユーザー自身が自分の記事を削除する場合はページ下部のフォームより行います。
・記事を投稿した際にパスワードを入力していない場合は削除できません。ご注意ください。

HERE &html_footer; exit; } #===S/リモートホストを取得===========================================# sub get_Host { $Host = $ENV{'REMOTE_HOST'}; $Addr = $ENV{'REMOTE_ADDR'}; if ($Host eq '') { $Host = $Addr; } if ($Host eq $Addr) { $Host = gethostbyaddr(pack('C4',split(/\./,$Host)),2) || $Addr; } } #===S/カウントアップ処理=============================================# sub countup { &lock1; if (!open(FILE, "$countfile")) { &lock2; &error("ファイルオープンエラー"); } $count = ; close(FILE); if ($count eq "") { $count = 0; } if ($in{'action'} eq "" || $in{'action'} eq 'basic') { $count++; } if (!open(FILE, ">$countfile")) { &lock2; &error("ファイルオープンエラー"); } print FILE "$count"; close(FILE); &lock2; } #===S/ローカルタイムを取得===========================================# sub gettime { ($sec, $min, $hour, $day, $mon, $year, $wdy, $yday, $isdst) = localtime(time); @youbi = ("Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat"); $year += 1900; $mon++; $timexx = sprintf("%02d:%02d",$hour,$min); $gettime = "$year年$mon月$day日(@youbi[$wdy])$timexx"; } #===S/クッキーを取得=================================================# sub cookie_in { $cookie = $ENV{'HTTP_COOKIE'}; @array = split(/; /,$cookie); foreach $tmp (@array) { ($key, $value) = split(/=/, $tmp); if ($key eq "$cookie_name") { $c_data = $value; } } ($c_name,$c_mail,$c_hp) = split(/\,/, $c_data); if ($c_hp eq "") { $c_hp = "http://"; } } #===S/デコード処理===================================================# sub form_decode { if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } @parameters = split(/&/,$buffer); foreach $element (@parameters) { ($parameter, $value) = split(/=/, $element); $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; $value =~ s//>/g; if ($parameter eq 'kill') { push(@DEL,$value); } $in{$parameter} = $value; } $page = $in{'page'}; } #===S/ロック処理=====================================================# sub lock1 { if ($lockkey eq "1") { $symlink_check = (eval { symlink("",""); }, $@ eq ""); if (!$symlink_check) { $c = 0; while(-e "$lockfile") { $c++; if ($c >= 3) { &error("リトライエラー"); } sleep(2); } open(LOCK, ">$lockfile"); close(LOCK); } else { local($retry) = 3; while (!symlink(".", $lockfile)) { if (--$retry <= 0) { &error("リトライエラー"); } sleep(2); } } } } sub lock2 { if (-e $lockfile) { unlink $lockfile; } } #===S/エラー処理=====================================================# sub error { &html_head; print "



"; print "\n"; print "
\n"; print "Error : \n"; print "$_[0]\n\n"; print "
\n\n"; print "\n"; exit; }