#!/usr/bin/perl #+++ CGI作成元 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++  [ 目指せ世界制覇!! Ver0.52 ] … 2001.03.17 Update #+++ ・・・・・>>> All Created by Tacky #+++ ・・・・・>>> Copyright (c) 2000.12 Tacky's Room. All rights reserved.... #+++ Email >>> tacky2@ops.dti.ne.jp #+++ Homepage >>> http://www.eva.hi-ho.ne.jp/takeuchi/ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+------------------------------------+## ## ## ## Atlas v1.0525 (01.05.25) ## ## ## ## Edit By *- CGI Cafe. -* ## ## URL: http://saya.kiy.jp/ ## ## ## ##+------------------------------------+## ##----[注意事項]------------------------------------------------## ## ## ## 1. このスクリプトはフリーソフトです。このスクリプトを使用した## ## いかなる損害に対しても作者は一切の責任を負いません。 ## ## 2. 設置に関する質問は掲示板にお願いいたします。 ## ## メールによる質問には一切お答えしません。 ## ## 3. このCGIに対する問い合わせを、スクリプト作成元には ## ## 絶対にしないでくださいね。 ## ## ## ##━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━## ## ## ## ■ 必要なファイルと主なパーミッション設定 ## ## ※各プロバイダによって違いますので必ず確認して下さいね!## ## ## ## ・atlas.cgi-------------------[755] ## ## ・jcode.pl--------------------[755] ## ## ・atlas.dat(ログ保存用)-------[666] ## ## ・count.dat(カウンターログ)---[666] ## ## ・imgディレクトリ[以下変更不要] ## ##  └ ・home.gif等 ## ## ## ##--------------------------------------------------------------## require './jcode.pl'; #日本語コード変換 $url = "../index.html"; #<<<戻り先URL $target = "_top"; #<<<↑戻り先のターゲット指定 $script = "./index.cgi"; #<<<このCGIの名前を指定 $method = 'POST'; #<<の色 $style = <<"HTML"; HTML #<<< ここから下はいじらない方がいいですよ。 utime time(), time(), __FILE__; # スクリプト生成日時の更新 ############################################################################### #### Main Process START ##################################################### ############################################################################### #<<<システム日時・時刻取得 $ENV{'TZ'} = "JST-9"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year = sprintf("%02d",$year + 1900); $month = sprintf("%02d",$mon + 1); $mday = sprintf("%02d",$mday); $hour = sprintf("%02d",$hour); $min = sprintf("%02d",$min); $today = "$year/$month/$mday($hour:$min)"; $iday = time + ( 60 * 60 * ($newtime * -1) ) ; #$newtime時間前 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($iday); $year = sprintf("%02d",$year + 1900); $month = sprintf("%02d",$mon + 1); $mday = sprintf("%02d",$mday); $hour = sprintf("%02d",$hour); $min = sprintf("%02d",$min); $newday = "$year/$month/$mday($hour:$min)"; if ($ENV{'HTTP_USER_AGENT'} !~ /MSIE/i) { $css_style = "" ; } &decode ; if ( $FORM{'action'} eq "maintenance" ) { &Maintenance; } #<<<"処理"がメンテナンスの場合 elsif ( $FORM{'action'} eq "update" ) { &update ; } #<<<ログファイル更新(編集時) elsif ( $FORM{'action'} eq "disp" ) { &seiha ; } #<<<制覇状況を見る elsif ( $FORM{'action'} eq "fdisp" ) { &fan ; } #<<<登録状況1を見る elsif ( $FORM{'action'} eq "ldisp" ) { &love ; } #<<<登録状況2を見る elsif ( $FORM{'action'} eq 'regist' ) { ®ist ; } #<<<ログ出力処理 elsif ( $FORM{'action'} eq 'input' ) { &forminput ; } #<<<入力フォーム表示 elsif ( $FORM{'action'} eq 'view' ) { &view ; } #<<<ログ表示 else { &menu ; } #<<<初期画面表示 &footer ; exit; ############################################################################### #### Main Process END ####################################################### ############################################################################### ###<-------------------------------------------------------------- ###<--- デコード&変数代入 ###<-------------------------------------------------------------- sub decode{ if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } @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; $value =~ s//>/g; $value =~ s/\,/,/g; &jcode'convert(*value,'sjis'); $FORM{$name} = $value; } $FORM{'comment'} =~ s/\r\n/
/g; $FORM{'comment'} =~ s/\r|\n/
/g; $FORM{'hp'} =~ s/^http\:\/\///; } ###<-------------------------------------------------------------- ###<--- 初期メニュー ###<-------------------------------------------------------------- sub menu { &dataread ; &header ; $total = 0 ; for ( @LOG ) { ($address,$no,$name,$email,$sex,$hp,$pillo,$fanreki,$memberlove,$ques1,$ques2,$ques3,$comment,$regdate,$p,$ts) = split(/,/,$_); $area = sprintf("%02d",$address) ; $touroku{$address}++ ; $total++ ; } # カウンタ処理 if ($counter) { &counter; } print "
\n"; if ( $titlelogo ) { $dmy = ""; if ( $titlelogo_w != 0 ) { $dmy = " width=$titlelogo_w "; } if ( $titlelogo_h != 0 ) { $dmy .= " height=$titlelogo_h "; } print "\n"; } else { print "$title\n"; } print "

$title_com\n"; print "\n"; print "\n"; print "
\n"; print "各地の制覇状況 + \n"; print "$con_1t登録状況 + \n"; print "$con_2t登録状況\n"; print "

\n"; if ( $FORM{'action'} ne 'maintenance' ) { print "
\n"; print "\n"; print "\n"; print "  \n"; print "
"; } print "
\n"; print "HOME + \n"; print "新規登録\n"; print "
\n"; print "
▼ 地域をクリックすると記事が表\示されます! ▼
\n"; print <<"EOM";
  EOM &area_link(47) ; #ヨーロッパ print <<"EOM"; EOM &area_link(49) ; #アジア print <<"EOM"; EOM &area_link(0) ; print <<"EOM"; EOM &area_link(50) ; #北アメリカ print <<"EOM"; EOM &area_link(1) ; print <<"EOM"; EOM &area_link(48) ; #アフリカ print <<"EOM"; EOM &area_link(2) ; &area_link(3) ; print <<"EOM"; EOM &area_link(51) ; #南アメリカ print <<"EOM"; EOM &area_link(4) ; &area_link(5) ; print <<"EOM"; EOM &area_link(6) ; &area_link(7) ; print <<"EOM"; EOM &area_link(8) ; &area_link(9) ; &area_link(10) ; &area_link(11) ; &area_link(12) ; print <<"EOM"; EOM &area_link(13) ; &area_link(14) ; &area_link(15) ; &area_link(16) ; &area_link(17) ; print <<"EOM"; EOM &area_link(18) ; &area_link(19) ; &area_link(20) ; &area_link(21) ; &area_link(22) ; &area_link(23) ; &area_link(24) ; &area_link(25) ; &area_link(26) ; print <<"EOM"; EOM &area_link(27) ; &area_link(28) ; print <<"EOM"; EOM &area_link(29) ; &area_link(30) ; &area_link(31) ; print <<"EOM"; EOM &area_link(32) ; &area_link(33) ; &area_link(34) ; &area_link(35) ; &area_link(36) ; print <<"EOM"; EOM &area_link(37) ; &area_link(38) ; &area_link(39) ; print <<"EOM"; EOM &area_link(40) ; &area_link(41) ; print <<"EOM"; EOM &area_link(42) ; &area_link(43) ; print <<"EOM"; EOM &area_link(44) ; &area_link(45) ; print <<"EOM"; EOM &area_link(52) ; #オーストラリア print <<"EOM"; EOM &area_link(53) ; #その他 print <<"EOM"; EOM &area_link(46) ; print <<"EOM";
                             
                                       
                                    
                              
                                  
                                  
                            
                            
                    
                
                                 
                             
                             
                                    
 
EOM &area_link(99) ; print "


"; } ###<-------------------------------------------------------------- ###<--- 入力フォーム ###<-------------------------------------------------------------- sub forminput { &dataread ; &header ; print "
\n"; print "
\n"; if ( $FORM{'action'} ne 'maintenance' ) { print "\n"; } else { print "\n"; print "\n"; print "\n"; } if ( $titlelogo ) { print "\n"; } else { 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"; print "\n"; #------------------------------------------------------------------------------- print "\n"; print ""; print "
NameSex\n"; print "\n"; print "
E-MailArea\n"; &areaset ; print "
URL
$con_1\n"; &fanset ; print "$con_2\n"; &memberset ; print "
\n\n"; if ($con_3u) { print "\n"; print "\n"; print "\n"; } if ($con_4u) { print "\n"; print "\n"; print "\n"; } if ($con_5u) { print "\n"; print "\n"; print "\n"; } print "
$con_3\n"; print "
$con_4\n"; print "
$con_5\n"; print "
Pass"; #アンケート部分の表示 if ( $ans ne '' ) { if ( $c_ans == 1 ) { $dmy = "checked" ; } else { $dmy = ""; } print "$ans  \n"; print "\n"; } else { print " \n"; } print "
\n"; print "\n"; print "
\n"; print "\n"; print "     \n"; print "
\n"; print "
\n"; print "
\n"; print "▲ BACK ▲


\n"; } ###<-------------------------------------------------------------- ###<--- 地域情報設定 ###<-------------------------------------------------------------- sub areaset { print " \n"; } ###<-------------------------------------------------------------- ###<--- 選択肢1情報設定 ###<-------------------------------------------------------------- sub fanset { print " \n"; } ###<-------------------------------------------------------------- ###<--- 選択肢2情報設定 ###<-------------------------------------------------------------- sub memberset { print " \n"; } ###<-------------------------------------------------------------- ###<--- HTMLヘッダー書き出し ###<-------------------------------------------------------------- sub header { print "Content-type: text/html; charset=Shift_JIS\n\n"; print "\n\n"; print "\n"; print "$title\n"; print "$style\n"; print " \n"; if ($backpicture) { $set = "background=\"$backpicture\""; if ( $bgcolor ) { $set .= " bgcolor=\"$bgcolor\"" ; } } elsif ($bgcolor ) { $set = "bgcolor=\"$bgcolor\""; } if ($fixed) { $set2 = "bgproperties=\"fixed\"" } print "\n"; } ###<-------------------------------------------------------------- ###<--- HTMLフッダー書き出し ###<-------------------------------------------------------------- sub footer { #<<< ↓消さないでネ♪ print "

\n"; print "- Tacky's Room -
\n"; print "Edit by *- CGI Cafe. -*

\n"; print "\n"; } ###<-------------------------------------------------------------- ###<--- ログファイル読み込み ###<-------------------------------------------------------------- sub dataread { if ( !(open(IN,"$logfile"))) { &error("ログファイル($logfile)のオープンに失敗しました"); } @LOG = ; close(IN); } ###<-------------------------------------------------------------- ###<--- ログ表示 ###<-------------------------------------------------------------- sub view { &header ; &dataread ; $total = 0 ; for ( @LOG ) { ($address,$no,$name,$email,$sex,$hp,$pillo,$fanreki,$memberlove,$ques1,$ques2,$ques3,$comment,$regdate,$p,$ts) = split(/,/,$_); $area = sprintf("%02d",$address) ; $touroku{$address}++ ; $total++ ; } print "
\n"; if ( $titlelogo ) { print "

\n"; } else { print "$title

\n"; } @new = (); foreach $buf ( @LOG ) { ($address,$no,$name,$email,$sex,$hp,$pillo,$fanreki,$memberlove,$ques1,$ques2,$ques3,$comment,$regdate,$p,$ts) = split(/,/,$buf); if (($FORM{'findname'} eq '' && (($FORM{'area'} ne '' && $FORM{'area'} == $address) || $FORM{'area'} == 99) ) || #u010122 ($FORM{'findname'} && (index($name,$FORM{'findname'}) >= 0 || index($buf,$FORM{'findname'}) >= 0) )) { push(@new,$buf); } } print "▲ BACK ▲

\n"; print "
\n"; if ( $FORM{'findname'} eq '' && $FORM{'area'} ne '' ) { #u010122 $i = sprintf("%02d",$FORM{'area'}) ; if ( $i != 99 ) { print "▼ $AREATBL[$FORM{'area'}]…$touroku{$i}人 ▼"; } else { print "▼ 最新登録者から表\示しています…全$total人 ▼"; } } else { print "検索ワード:『$FORM{'findname'}
" . @new . "件見つかりました!"; } print "

\n"; print "※ $newtime時間以内に更新されたものには  が\表\示されます!\n"; print "
"; print "\n"; print ""; if ( $FORM{'area'} == 99 ) { print "\n"; } print "\n"; print "\n"; print "\n"; if ( $ans ne '' ) { print "\n"; } print "\n"; print "\n"; if ($con_3u) { print "\n"; } if ($con_4u) { print "\n"; } if ($con_5u) { print "\n"; } print "\n"; print "\n"; #表示対象ページの先頭データ件数を算出 $dm = @new; if ( $dm % $pagemax == 0) { $p = $dm / $pagemax ; } else { $p = $dm / $pagemax + 1; } $p = sprintf("%3d",$p); if ( $FORM{'disppage'} ) { $d = $FORM{'disppage'} * $pagemax - $pagemax ; } else { $d = 0 ; $FORM{'disppage'} = 1 ; } $z = 1; for ( $i = $d ; ( $z <= $pagemax ) && ( $i < $dm ); $i++ ) { ($address,$no,$name,$email,$sex,$hp,$pillo,$fanreki,$memberlove,$ques1,$ques2,$ques3,$comment,$regdate,$p,$ts) = split(/,/,$new[$i]); if ( $bg eq $cellbgcolor1 ) { $bg = $cellbgcolor2; $tx = $celltxcolor2; } else { $bg = $cellbgcolor1; $tx = $celltxcolor1; } print "\n"; if ( $FORM{'area'} == 99 ) { print "\n"; } print "\n"; if ( $hp ne '' ) { print "\n"; } else { print "\n"; } if ( $ans ne '' ) { if ( $pillo == 1 ) { print "\n"; } else { print "\n"; } } print "\n"; print "\n"; if ($con_3u) { print "\n"; } if ($con_4u) { print "\n"; } if ($con_5u) { print "\n"; } if ( $comment ne '' ) { print "\n"; } else { print "\n"; } print "\n"; $z++; } print "
地域お名前性別HP$headans$con_1t$con_2t$con_3t$con_4t$con_5tコメント登録日
$AREATBL[$address]\n"; if ( $email ne '' ) { print "$name\n"; } else { print "$name\n"; } print "$SEXTBL[$sex]"; print "" if ( $sex != 2 ) ; print "" if ( $sex == 2 ) ; print " \"$ans_com\" $fantbl[$fanreki]$membertbl[$memberlove]$ques1$ques2$ques3$comment \n"; # NEWアイコンを表示 if ( $regdate ge $newday ) { print ""; } print "No.$no
$regdate

\n"; $dm = @new; if ( $dm % $pagemax == 0) { $p = $dm / $pagemax ;} else { $p = $dm / $pagemax + 1;} $p = sprintf("%3d",$p); print "\n"; if ( $FORM{'disppage'} != 0 && $FORM{'disppage'} !=1) { print "\n"; $pag = $FORM{'disppage'} - 1 ; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } if ( $FORM{'disppage'} + 1 <= $p ) { print "\n"; $pag = $FORM{'disppage'} + 1 ; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
\n"; if ( $p == 0 ) { $p = 1; } if ( $p != 1 ) { for ( $i = 1 ; $i <= $p ; $i++ ) { if ( (!($FORM{'disppage'}) && $i != 1 ) || ( $FORM{'disppage'} && ( $i ne $FORM{'disppage'}) ) ) { print "$i \n"; } else { print "$i \n"; } } } print "

▲ 1ページに$pagemax件表\示されます! ▲
\n"; print "


\n"; print "
\n"; print "
\n"; print "
\n"; print "記事修正・削除フォーム
\n"; print "No\n"; print "Pass\n"; print "\n"; print "\n"; print "\n"; print "
\n
\n"; } ###<-------------------------------------------------------------- ###<--- ログ出力 ###<-------------------------------------------------------------- sub regist { if ( $FORM{'name'} eq "") { &error("お名前を入力して下さい。") ; } &filelock ; #ファイルロック &dataread ; $dcnt = @LOG; if ($dcnt >= $datamax) { pop(@LOG); } if ( $dcnt < 1 ) { $no = 1; #1件目 } else { ($dummy,$no,$dummy) = split(/,/,$LOG[0]); #最新記事No取得 $no++; } # パスワードの暗号化(crypt関数使用)) if ($FORM{'pass'} ne "") { &pass_enc($FORM{'pass'}); } else { $pass = '' ; } unshift(@LOG,"$FORM{'area'},$no,$FORM{'name'},$FORM{'email'},$FORM{'sex'},$FORM{'hp'},$FORM{'ans'},$FORM{'fan'},$FORM{'member'},$FORM{'ques1'},$FORM{'ques2'},$FORM{'ques3'},$FORM{'comment'},$today,$pass,$ts\n"); if ( !(open(OUT,">$logfile"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @LOG; close(OUT); if ( $sendmail ) { &SMail(1) ; } &fileunlock ; #ファイルロック解除 if ( $damedame == 0 ) { print "Location: $script?\n\n"; } else { print "Content-type: text/html\n\n"; print " \n\n"; } exit ; } ###<-------------------------------------------------------------- ###<--- メンテナンスモード ###<-------------------------------------------------------------- sub Maintenance { if ( $FORM{'no'} eq "") { &error("メンテナンスする記事Noを入力して下さい。") ; } if ( $FORM{'pass'} eq "") { &error("パスワードを入力して下さい") ; } $found = 0 ; &dataread ; foreach ( @LOG ) { ($address,$n,$name,$email,$sex,$hp,$pillo,$fanreki,$memberlove,$ques1,$ques2,$ques3,$comment,$regdate,$p,$ts) = split(/,/,$_); $p =~ s/\n//; if ( $FORM{'no'} eq $n ) { $found = 1 ; if ($FORM{'pass'} ne $master_password && (&pass_dec($p))) { &error("パスワードが違います。"); } if ( $FORM{'proc'} eq "delete" ) { &update ; exit; } $c_address = $address ; $c_sex = $sex ; $c_name = $name ; $c_email = $email ; $c_hp = $hp ; $c_ans = $pillo ; $c_fanreki = $fanreki; $c_memberlove = $memberlove ; $c_comment = $comment ; $c_comment =~ s/\/\n/g; $c_pass = $FORM{'pass'} ; &forminput ; last; } } if ( $found == 0 ) { &error("該当する記事Noのデータは存在していません。"); } &footer ; exit; } ###<-------------------------------------------------------------- ###<--- ログファイル更新 ###<-------------------------------------------------------------- sub update { &filelock ; #ファイルロック &dataread ; foreach (@LOG) { ($dummy,$no,$dummy) = split(/,/,$_); if ( $FORM{'no'} eq $no) { #<<<メンテ対象者の場合 if ( $FORM{'proc'} eq "edit" ) { # パスワードの暗号化(crypt関数使用)) if ($FORM{'pass'} ne "") { &pass_enc($FORM{'pass'}); } else { $pass = '' ; } push(@new,"$FORM{'area'},$no,$FORM{'name'},$FORM{'email'},$FORM{'sex'},$FORM{'hp'},$FORM{'ans'},$FORM{'fan'},$FORM{'member'},$FORM{'ques1'},$FORM{'ques2'},$FORM{'ques3'},$FORM{'comment'},$today,$pass,$ts\n"); } } else { push(@new,"$_"); #<<<そのまま出力 } } if ( !(open(OUT,">$logfile"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @new; close(OUT); &fileunlock ; #ファイルロック解除 if ( $damedame == 0 ) { print "Location: $script?\n\n"; } else { print "Content-type: text/html\n\n"; print " \n\n"; } } ###<-------------------------------------------------------------- ###<--- 全国制覇状況表示 ###<-------------------------------------------------------------- sub seiha { &header ; &dataread ; for ( @LOG ) { ($address,$no,$name,$email,$sex,$hp,$pillo,$fanreki,$memberlove,$ques1,$ques2,$ques3,$comment,$regdate,$p,$ts) = split(/,/,$_); $area = sprintf("%02d",$address) ; $touroku{$address}++ ; } print "

*-- 各地の制覇状況 --*

\n"; print "▲ BACK ▲\n"; print "

()内の数字はその地域の登録者数です。\n"; print "

\n"; print "\n"; $j = 1 ; for ( $i = 0 ; $i <= $#AREATBL ; $i++ ) { $i = sprintf("%02d",$i) ; print "\n"; if ( $touroku{$i} ) { print "\n"; } else { print "\n"; } $j++ ; if ( $j > 3 ) { print "\n"; print "\n" if ( $i != $#AREATBL ) ; $j = 1 ; } } print "
$AREATBL[$i]$seiha ($touroku{$i}人) 
\n"; &footer; exit; } ###<-------------------------------------------------------------- ###<--- 選択肢1状況表示 ###<-------------------------------------------------------------- sub fan { &header ; &dataread ; for ( @LOG ) { ($address,$no,$name,$email,$sex,$hp,$pillo,$fanreki,$memberlove,$ques1,$ques2,$ques3,$comment,$regdate,$p,$ts) = split(/,/,$_); $area = sprintf("%02d",$address) ; $touroku1{$fanreki}++ ; } print "

*-- $con_1t登録状況 --*

\n"; print "▲ BACK ▲\n"; print "

()内の数字は登録者数です。\n"; print "

\n"; print "\n"; $j = 1 ; for ( $i = 0 ; $i <= $#fantbl ; $i++ ) { $i = sprintf("%02d",$i) ; print "\n"; if ( $touroku1{$i} ) { print "\n"; } else { print "\n"; } $j++ ; if ( $j > 3 ) { print "\n"; print "\n" if ( $i != $#fantbl ) ; $j = 1 ; } } print "
$fantbl[$i]$fans ($touroku1{$i}人) 
\n"; &footer; exit; } ###<-------------------------------------------------------------- ###<--- 選択肢2状況表示 ###<-------------------------------------------------------------- sub love { &header ; &dataread ; for ( @LOG ) { ($address,$no,$name,$email,$sex,$hp,$pillo,$fanreki,$memberlove,$ques1,$ques2,$ques3,$comment,$regdate,$p,$ts) = split(/,/,$_); $area = sprintf("%02d",$address) ; $touroku2{$memberlove}++ ; } print "

*-- $con_2t登録状況 --*

\n"; print "▲ BACK ▲\n"; print "

()内の数字は登録者数です。\n"; print "

\n"; print "\n"; $j = 1 ; for ( $i = 0 ; $i <= $#membertbl ; $i++ ) { $i = sprintf("%02d",$i) ; print "\n"; if ( $touroku2{$i} ) { print "\n"; } else { print "\n"; } $j++ ; if ( $j > 3 ) { print "\n"; print "\n" if ( $i != $#membertbl ) ; $j = 1 ; } } print "
$membertbl[$i]$love ($touroku2{$i}人) 
\n"; &footer; exit; } ###<-------------------------------------------------------------- ###<--- エラー処理 ###<-------------------------------------------------------------- sub error { &header ; print "

$_[0]\n"; &footer; exit; } ###<-------------------------------------------------------------- ###<--- ファイルロック設定 ###<-------------------------------------------------------------- sub filelock { foreach (1 .. 5) { if (-e $lockfile) { sleep(1); } else { open(LOCK,">$lockfile"); close(LOCK); return; } } &error("只今他の方が書き込み中です。ブラウザの「戻る」で戻って再度登録を行って下さい。"); } ###<-------------------------------------------------------------- ###<--- ファイルロック解除 ###<-------------------------------------------------------------- sub fileunlock { if (-e $lockfile) { unlink($lockfile); } } ###<------------------------------------------------------------- ###<--- パスワード暗号化 ###<-------------------------------------------------------------- sub pass_enc { if ( $ango == 1 ) { $pass = crypt($_[0], $_[0]); } else { $pass = $_[0]; } } ###<------------------------------------------------------------- ###<--- パスワードチェック ###<-------------------------------------------------------------- sub pass_dec { if ( $ango == 1 ) { if ($_[0] ne '' && ( crypt($FORM{'pass'}, $_[0]) eq $_[0]) ) { return 0 ; } } else { if ($FORM{'pass'} eq $_[0]) { return 0 ; } } return 1; } ###<------------------------------------------------------------- ###<--- 都道府県別リンク部分生成 ###<-------------------------------------------------------------- sub area_link { $i = sprintf("%02d",$_[0]) ; if ( $i != 99 ) { if ( $sekaiwamadamada == 1 && $i > 46 && $i != 53 ) { print ""; } else { if ( $colorflg == 0 ) { #初期設定色を使用 print ""; } else { #登録人数によって色変更 $j = 0 ; $k = 0 ; foreach $buf ( @COLOR_NUM ) { if ( $buf <= $touroku{$i} ) { $j = $k ; } $k++ ; } print ""; } if ( $touroku{$i} eq '' ) { $wk = "0人" ; } else { $wk = "$touroku{$i}人登録されています"; } print ""; print "\"$AREATBL[$i]…$wk\""; } print "\n"; } else { print "
▲ 現在の登録者$total人を最新から表\示 ▲\n"; if ( $colorflg == 1 ) { print "

\n\n"; foreach ( 0..$#COLOR_NUM ) { print "\n"; print "\n"; } print "
$COLOR_NUM[$_]人以上
\n"; } } } ###<-------------------------------------------------------------- ###<--- SendMail ###<-------------------------------------------------------------- sub SMail { $ttl = $title; $wkcomment = $FORM{'comment'} ; $wkcomment =~ s/<//g; $wkcomment =~ s/
/\n/g; if ($FORM{'hp'} ne "") { $wk = "http://$FORM{'hp'}"; } $DETAIL = <<"EOM"; ------------------------------------------------------------- 投稿された内容は下記の通りです。 ------------------------------------------------------------- ▼投稿日 $today ▼記事No $no ▼お名前 $FORM{'name'} ▼メールアドレス $FORM{'email'} ▼地域 $AREATBL[$FORM{'area'}] ▼性別 $SEXTBL[$FORM{'sex'}] ▼ホームページ $wk ▼メッセージ $wkcomment ▼パスワード $FORM{'pass'} ------------------------------------------------------------- EOM #管理人用メール送信 if ( $FORM{'email'} ) { $email = $FORM{'email'} ; } else { $email = $smail_address ; } if ( $hiho == 1 ) { &jcode'convert(*ttl,'euc'); open(MAIL,"| $sendmail -s \"$ttl\" -f $email $smail_address ") || &error("Sendmail Error!!"); } else { open(MAIL,"| $sendmail -t") || &error("Sendmail Error!!"); $mailbuf = "To: $smail_address\n"; $mailbuf .= "From: $email\n"; $mailbuf .= "Reply-to: $email\n"; $mailbuf .= "Subject: $ttl\n"; $mailbuf .= "Content-Transfer-Encoding: 7bit\n"; $mailbuf .= "Content-type: text/plain\n"; $mailbuf .= "\n\n"; } $mailbuf .= $DETAIL ; #漢字コードJIS変換&改行コードLF変換。 &jcode'convert(*mailbuf,'jis'); print MAIL $mailbuf ; close(MAIL); } #----------------# # カウンタ処理 # #----------------# sub counter { # 閲覧時のみカウントアップ if ($FORM eq '') { $cntup=1; } else { $cntup=0; } # カウントファイルを読みこみ open(IN,"$cntfile") || &error("Open Error : $cntfile"); eval "flock(IN, 1);"; $data = ; close(IN); # IPチェックとログ破損チェック $addr = $ENV{'REMOTE_ADDR'}; ($cnt, $ip) = split(/:/, $data); if ($addr eq "$ip" || $cnt eq "") { $cntup=0; } # カウントアップ if ($cntup) { $cnt++; open(OUT,"+< $cntfile") || &error("Write Error : $cntfile"); eval "flock(OUT, 2);"; truncate(OUT, 0); seek(OUT, 0, 0); print OUT "$cnt\:$addr"; close(OUT); } # 桁数調整 while(length($cnt) < $mini_fig) { $cnt = '0' . $cnt; } @cnts = split(//, $cnt); # GIFカウンタ表示 print "

\n"; if ($counter == 2) { foreach (0 .. $#cnts) { print "\"$cnts[$_]\""; } } # テキストカウンタ表示 else { print "$cnt
\n"; } print "
\n"; }