#!/usr/bin/perl
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#+++ [ 目指せ世界制覇!! Ver0.53]
#+++
#+++ ・・・・・>>> All Created by Tacky
#+++
#+++ ・・・・・>>> Copyright (c) 2000.12 Tacky's Room. All rights reserved....
#+++
#+++ Email >>> tacky2@ops.dti.ne.jp
#+++ Homepage >>> http://tackysroom.com
#+++
#+++ 設置方法構成(具体例)
#+++ public_html(ホームページディレクトリ)
#+++ |
#+++ |-- cgi-bin(任意のディレクトリ)
#+++ |-- jcode.pl (755)…(日本語ライブラリ)
#+++ |-- mezase2.cgi (755)…(スクリプト本体)
#+++ |-- mezase2.txt (666)…(ログファイル)…空のままアップロード
#+++
#+++ ■( )内はパーミッッションの値です。
#+++ ■gif以外はアスキーモード、gifはバイナリーモードでアップロードして下さい。
#+++ ■mezase2.lockは自動作成&削除しますので、各自でご用意する必要はありません。
#+++ ■ログファイル・ロックファイルの指定はフルパス(http://〜)で指定するとサーバーエラーになりますのでご注意下さい。
#+++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
require './jcode.pl'; #日本語コード変換
$url = "http://okamuu.com"; #<<<戻り先URL
$script = "./mezase2.cgi"; #<<<このCGIの名前を指定
$method = 'POST'; #<</>/g;
$value =~ s/&/&/g;
$value =~ s/\,/,/g;
foreach ( @errword ) {
if ( $_ && $value =~ /$_/) {
&error("投稿禁止単語が入力されていますので投稿出来ません");
}
}
if ( $urllink && ($name eq 'name' || $name eq 'hp' || $name eq $name_comment )) {
if ( $urllink == 1 ) {
if ( $value =~ /tp:\/\//i && $name ne 'hp' ) {
&error("セキュリティ対策の為、URLは入力出来ません。");
}
} else {
foreach $buf ( @urlerrnm ) {
if ( $value =~ /([^=^\"]|^)(http|ftp)([\w|\!\#\&\=\-\%\@\~\;\+\:\.\?\/]+)/i ) {
if ( $3 =~ /$buf/ ) {
&error("文字「$buf」は、セキュリティ対策の為、入力出来ません。");
}
}
}
}
}
&jcode'convert(*value,'sjis');
$FORM{$name} = $value;
}
if ( $FORM{'action'} eq 'regist' || $FORM{'action'} eq 'maintenance' ||
$FORM{'action'} eq 'update' ) {
if ( $postchk && !$post ) { &error("不正な投稿です。"); }
if ( $urlchk && $ENV{HTTP_REFERER} !~ /$urlchk/i ) { exit; }
}
$FORM{$name_comment} =~ s/\r\n/
/g; $FORM{$name_comment} =~ s/\r|\n/
/g;
$FORM{'hp'} =~ s/^http\:\/\///;
}
###<--------------------------------------------------------------
###<--- 初期メニュー
###<--------------------------------------------------------------
sub menu {
&dataread ;
&header ;
$total = 0 ;
for ( @LOG ) {
($address,$no,$name,$email,$sex,$hp,$yobi,$comment,$regdate,$p) = split(/,/,$_);
$area = sprintf("%02d",$address) ;
$touroku{$address}++ ; $total++ ;
}
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 "
\n";
print "\n";
if ( $FORM{'action'} ne 'maintenance' ) {
print "";
}
print "
";
print "\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 "[BACK]\n";
print "\n";
print "\n";
print "
\n";
}
###<--------------------------------------------------------------
###<--- 地域情報設定
###<--------------------------------------------------------------
sub areaset {
print " \n";
}
###<--------------------------------------------------------------
###<--- HTMLヘッダー書き出し
###<--------------------------------------------------------------
sub header {
print "Content-type: text/html; charset=Shift_JIS\n\n";
print "\n\n";
print "\n";
print "$title\n";
#<<>>
print "\n";
#<<>>
print "\n";
if ($backpicture) { $set = "background=\"$backpicture\""; if ( $bgcolor ) { $set .= " bgcolor=\"$bgcolor\"" ; } }
elsif ($bgcolor ) { $set = "bgcolor=\"$bgcolor\""; }
print "\n";
}
###<--------------------------------------------------------------
###<--- HTMLフッダー書き出し
###<--------------------------------------------------------------
sub footer {
#<<< ↓消さないでネ♪
print "mezase-sekaiseiha Ver0.57 Created by Tacky
\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,$yobi,$comment,$regdate,$p,$hst,$yb1,$yb2,$yb3,$yb4,$yb5) = split(/,/,$_);
$p =~ s/\n//;$hst =~ s/\n//;$yb5 =~ s/\n//;
$area = sprintf("%02d",$address) ;
$touroku{$address}++ ; $total++ ;
}
print "[BACK] \n";
print "\n";
if ( $titlelogo ) {
print "
\n";
} else {
print "$title
\n";
}
@new = ();
foreach $buf ( @LOG ) {
($address,$no,$name,$email,$sex,$hp,$yobi,$comment,$regdate,$p,$hst,$yb1,$yb2,$yb3,$yb4,$yb5) = split(/,/,$buf);
if (($FORM{'findname'} eq '' && (($FORM{'area'} ne '' && $FORM{'area'} == $address) || $FORM{'area'} == 99) ) || #u010122
($FORM{'findname'} && (index($name,$FORM{'findname'}) >= 0 || index($comment,$FORM{'findname'}) >= 0) )) {
push(@new,$buf);
}
}
print "\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 " |
\n";
print "
";
print "\n";
print "";
print "| No | \n";
if ( $FORM{'area'} == 99 ) {
print "地域 | \n";
}
print "お名前 | \n";
print "性別 | \n";
print "HP | \n" if ( $urlerr == 0 ) ;
print "$lbl_yobi1 | \n" if ( $YOBITBL1[0] ne '' ) ;
print "$lbl_yobi2 | \n" if ( $YOBITBL2[0] ne '' ) ;
print "$lbl_yobi3 | \n" if ( $YOBITBL3[0] ne '' ) ;
print "$lbl_yobi4 | \n" if ( $YOBITBL4[0] ne '' ) ;
print "$lbl_yobi5 | \n" if ( $YOBITBL5[0] ne '' ) ;
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,$yobi,$comment,$regdate,$p,$hst,$yb1,$yb2,$yb3,$yb4,$yb5) = split(/,/,$new[$i]);
$p =~ s/\n//;$hst =~ s/\n//;$yb5 =~ s/\n//;
if ( $bg eq $cellbgcolor1 ) {
$bg = $cellbgcolor2;
$tx = $celltxcolor2;
} else {
$bg = $cellbgcolor1;
$tx = $celltxcolor1;
}
print "\n";
print "| $no | \n";
if ( $FORM{'area'} == 99 ) {
print "$AREATBL[$address] | \n";
}
if ( $email ne '' ) {
print "\n";
print "$name | \n";
} else {
print "$name | \n";
}
print "$SEXTBL[$sex] | \n";
if ( $urlerr == 0 ) {
if ( $hp ne '' ) {
print "";
print " " if ( $sex != 2 ) ;
print " " if ( $sex == 2 ) ;
print " | \n";
} else {
print " | \n";
}
}
print "$YOBITBL1[$yb1] | \n" if ( $YOBITBL1[0] ne '' ) ;
print "$YOBITBL2[$yb2] | \n" if ( $YOBITBL2[0] ne '' ) ;
print "$YOBITBL3[$yb3] | \n" if ( $YOBITBL3[0] ne '' ) ;
print "$YOBITBL4[$yb4] | \n" if ( $YOBITBL4[0] ne '' ) ;
print "$YOBITBL5[$yb5] | \n" if ( $YOBITBL5[0] ne '' ) ;
if ( $comment ne '' ) {
$comment =~ s/&/&/g;
print "$comment | \n";
} else {
print " | \n";
}
print "$regdate |
\n";
$z++;
}
print "
\n";
$dm = @new;
if ( $dm % $pagemax == 0) { $p = $dm / $pagemax ;} else { $p = $dm / $pagemax + 1;}
$p = sprintf("%3d",$p);
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";
}
###<--------------------------------------------------------------
###<--- ログ出力
###<--------------------------------------------------------------
sub regist {
&comchk;
&filelock ; #ファイルロック
&dataread ;
foreach $BUF ( @LOG ) {
($address,$n,$name,$email,$sex,$hp,$yobi,$comment,$regdate,$p,$hst,$hst,$yb1,$yb2,$yb3,$yb4,$yb5) = split(/,/,$BUF);
$p =~ s/\n//;$hst =~ s/\n//;$yb5 =~ s/\n//;
if ( $hst ne $host ) { $chk=1; }
if ( $renchan != 0 && $hst eq $host && $chk != 1 ) {
$write_cnt++ ;
if ( $write_cnt + 1 >= $renchan ) { &fileunlock ; &error("$renchan回以上の連続投稿は禁止しています"); }
}
}
$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{$name_comment},$today,$pass,$host,$FORM{'yb1'},$FORM{'yb2'},$FORM{'yb3'},$FORM{'yb4'},$FORM{'yb5'}\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 comchk {
if ( $FORM{'name'} eq "") { &error("お名前を入力して下さい。") ; }
# URLと同じものが本文にあったら宣伝
if ($FORM{'hp'}){
if ( $FORM{$name_comment} =~ /$FORM{'hp'}/) {
&error("宣伝投稿と見なされますので投稿出来ません");
}
}
if ( $urlcnt ) {
$urlnum = ($FORM{$name_comment} =~ s/(h?ttp)/$1/ig);
if ( $urlnum > $urlcnt ) { &error("URLは" . ($urlcnt + 1) . "個以上は記入出来ません"); }
}
if ( $japan ) {
$str = $FORM{$name_comment};
jcode::convert(\$str, 'euc','sjis');
if($str =~ /[\xA1-\xFE][\xA1-\xFE]/ || $str =~ /\x8E/ || $str =~ /[\x8E\xA1-\xFE]/){
} else {
&error("半角英数字のみの投稿は出来ません。");
}
}
if ( $mailerr == 1 && $FORM{'email'} ) { &error("セキュリティ対策の為、メールアドレスは入力出来ません。"); }
if ( $urlerr == 1 && $FORM{'hp'} ) { &error("セキュリティ対策の為、URLは入力出来ません。"); }
if ( $chk_yobi1 == 1 && $YOBITBL1[0] ne '' && $FORM{'yb1'} eq '') { &error($lbl_yobi1 . "は省略出来ません。"); }
if ( $chk_yobi2 == 1 && $YOBITBL2[0] ne '' && $FORM{'yb2'} eq '') { &error($lbl_yobi2 . "は省略出来ません。"); }
if ( $chk_yobi3 == 1 && $YOBITBL3[0] ne '' && $FORM{'yb3'} eq '') { &error($lbl_yobi3 . "は省略出来ません。"); }
if ( $chk_yobi4 == 1 && $YOBITBL4[0] ne '' && $FORM{'yb4'} eq '') { &error($lbl_yobi4 . "は省略出来ません。"); }
if ( $chk_yobi5 == 1 && $YOBITBL5[0] ne '' && $FORM{'yb5'} eq '') { &error($lbl_yobi5 . "は省略出来ません。"); }
# ホスト名を取得
$host = $ENV{'REMOTE_HOST'};
$addr = $ENV{'REMOTE_ADDR'};
if ($host eq "" || $host eq "$addr") {
($p1,$p2,$p3,$p4) = split(/\./,$addr);
$temp = pack("C4",$p1,$p2,$p3,$p4);
$host = gethostbyaddr("$temp", 2);
if ($host eq "") { $host = $addr; }
}
#掲示板荒らし対策
foreach $buf(@DANGER_LIST){
if ( $buf ) {
# パターンマッチを変換
$buf=~ s/\./\\./g; $buf=~ s/\?/\./g; $buf=~ s/\*/\.\*/g;
if($host =~ /$buf/gi){ exit; }
}
}
if ( $maxword ne '' && (length($FORM{$name_comment}) > $maxword)) { &error("メッセージは$maxword文字までしか登録出来ません。"); }
}
###<--------------------------------------------------------------
###<--- メンテナンスモード
###<--------------------------------------------------------------
sub Maintenance {
if ( $FORM{'no'} eq "") { &error("メンテナンスする記事Noを入力して下さい。") ; }
if ( $FORM{'pass'} eq "") { &error("パスワードを入力して下さい") ; }
$found = 0 ;
&dataread ;
foreach ( @LOG ) {
($c_address,$n,$c_name,$c_email,$c_sex,$c_hp,$yobi,$c_comment,$regdate,$p,$hst,$c_yb1,$c_yb2,$c_yb3,$c_yb4,$c_yb5) = split(/,/,$_);
$p =~ s/\n//;$hst =~ s/\n//;$yb5 =~ 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_comment =~ s/\
/\n/g; $c_pass = $FORM{'pass'} ;
&forminput ;
last;
}
}
if ( $found == 0 ) {
&error("該当する記事Noのデータは存在していません。");
}
&footer ;
exit;
}
###<--------------------------------------------------------------
###<--- ログファイル更新
###<--------------------------------------------------------------
sub update {
if ( $FORM{'proc'} eq "edit" ) { &comchk; }
&filelock ; #ファイルロック
# ホスト名を取得
$host = $ENV{'REMOTE_HOST'};
$addr = $ENV{'REMOTE_ADDR'};
if ($host eq "" || $host eq "$addr") {
($p1,$p2,$p3,$p4) = split(/\./,$addr);
$temp = pack("C4",$p1,$p2,$p3,$p4);
$host = gethostbyaddr("$temp", 2);
if ($host eq "") { $host = $addr; }
}
&dataread ;
foreach (@LOG) {
($address,$no,$name,$email,$sex,$hp,$yobi,$comment,$regdate,$p,$hst,$yb1,$yb2,$yb3,$yb4,$yb5) = split(/,/,$_);
$p =~ s/\n//;$hst =~ s/\n//;$yb5 =~ s/\n//;
if ( $FORM{'no'} eq $no) { #<<<メンテ対象者の場合
if ($FORM{'pass'} ne $master_password && (&pass_dec($p))) {
&fileunlock ; #ファイルロック解除
&error("パスワードが違います。");
}
if ( $FORM{'proc'} eq "edit" ) {
push(@new,"$FORM{'area'},$no,$FORM{'name'},$FORM{'email'},$FORM{'sex'},$FORM{'hp'},$FORM{'ans'},$FORM{$name_comment},$today,$p,$host,$FORM{'yb1'},$FORM{'yb2'},$FORM{'yb3'},$FORM{'yb4'},$FORM{'yb5'}\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,$yobi,$comment,$regdate,$p,$hst,$yb1,$yb2,$yb3,$yb4,$yb5) = split(/,/,$_);
$p =~ s/\n//;$hst =~ s/\n//;$yb5 =~ s/\n//;
$area = sprintf("%02d",$address) ;
$touroku{$address}++ ;
$sum_yobi1{$yb1}++ ;
$sum_yobi2{$yb2}++ ;
$sum_yobi3{$yb3}++ ;
$sum_yobi4{$yb4}++ ;
$sum_yobi5{$yb5}++ ;
}
print "[BACK]\n";
print "
*-- 登録状況 --*\n";
print "
()内の数字はその地域の登録者数です。\n";
print "
\n";
print "\n";
print "\n";
$j = 1 ;
for ( $i = 0 ; $i <= $#AREATBL ; $i++ ) {
$i = sprintf("%02d",$i) ;
print "| $AREATBL[$i] | \n";
if ( $touroku{$i} ) {
print "制覇!!! ($touroku{$i}人) | \n";
} else {
print " | \n";
}
$j++ ;
if ( $j > 3 ) {
print " \n";
print "\n" if ( $i != $#AREATBL ) ;
$j = 1 ;
}
}
print " |
\n";
if ( $YOBITBL1[0] ne '' && $sum_yobi1 == 1 ) {
print "
▼$lbl_yobi1▼
\n";
print "\n";
print "\n";
$j = 1 ;
for ( $i = 0 ; $i <= $#YOBITBL1 ; $i++ ) {
$i = sprintf("%02d",$i) ;
print "| $YOBITBL1[$i] | \n";
if ( $sum_yobi1{$i} ) {
print "$sum_yobi1{$i}人 | \n";
} else {
print " | \n";
}
$j++ ;
if ( $j > 3 ) {
print " \n";
print "\n" if ( $i != $#YOBITBL1 ) ;
$j = 1 ;
}
}
if ( $j != 1 ) {
for ( ; $j <= 3; $j++ ) {
print "| | \n";
print " | \n";
}
}
print " |
\n";
}
if ( $YOBITBL2[0] ne '' && $sum_yobi2 == 1 ) {
print "
▼$lbl_yobi2▼
\n";
print "\n";
print "\n";
$j = 1 ;
for ( $i = 0 ; $i <= $#YOBITBL2 ; $i++ ) {
$i = sprintf("%02d",$i) ;
print "| $YOBITBL2[$i] | \n";
if ( $sum_yobi2{$i} ) {
print "$sum_yobi2{$i}人 | \n";
} else {
print " | \n";
}
$j++ ;
if ( $j > 3 ) {
print " \n";
print "\n" if ( $i != $#YOBITBL2 ) ;
$j = 1 ;
}
}
if ( $j != 1 ) {
for ( ; $j <= 3; $j++ ) {
print "| | \n";
print " | \n";
}
}
print " |
\n";
}
if ( $YOBITBL3[0] ne '' && $sum_yobi3 == 1 ) {
print "
▼$lbl_yobi3▼
\n";
print "\n";
print "\n";
$j = 1 ;
for ( $i = 0 ; $i <= $#YOBITBL3 ; $i++ ) {
$i = sprintf("%02d",$i) ;
print "| $YOBITBL3[$i] | \n";
if ( $sum_yobi3{$i} ) {
print "$sum_yobi3{$i}人 | \n";
} else {
print " | \n";
}
$j++ ;
if ( $j > 3 ) {
print " \n";
print "\n" if ( $i != $#YOBITBL3 ) ;
$j = 1 ;
}
}
if ( $j != 1 ) {
for ( ; $j <= 3; $j++ ) {
print "| | \n";
print " | \n";
}
}
print " |
\n";
}
if ( $YOBITBL4[0] ne '' && $sum_yobi4 == 1 ) {
print "
▼$lbl_yobi4▼
\n";
print "\n";
print "\n";
$j = 1 ;
for ( $i = 0 ; $i <= $#YOBITBL4 ; $i++ ) {
$i = sprintf("%02d",$i) ;
print "| $YOBITBL4[$i] | \n";
if ( $sum_yobi4{$i} ) {
print "$sum_yobi4{$i}人 | \n";
} else {
print " | \n";
}
$j++ ;
if ( $j > 3 ) {
print " \n";
print "\n" if ( $i != $#YOBITBL4 ) ;
$j = 1 ;
}
}
if ( $j != 1 ) {
for ( ; $j <= 3; $j++ ) {
print "| | \n";
print " | \n";
}
}
print " |
\n";
}
if ( $YOBITBL5[0] ne '' && $sum_yobi5 == 1 ) {
print "
▼$lbl_yobi5▼
\n";
print "\n";
print "\n";
$j = 1 ;
for ( $i = 0 ; $i <= $#YOBITBL5 ; $i++ ) {
$i = sprintf("%02d",$i) ;
print "| $YOBITBL5[$i] | \n";
if ( $sum_yobi5{$i} ) {
print "$sum_yobi5{$i}人 | \n";
} else {
print " | \n";
}
$j++ ;
if ( $j > 3 ) {
print " \n";
print "\n" if ( $i != $#YOBITBL5 ) ;
$j = 1 ;
}
}
if ( $j != 1 ) {
for ( ; $j <= 3; $j++ ) {
print "| | \n";
print " | \n";
}
}
print " |
\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 " | \n";
} else {
print "
△地域をクリックすると記事が表\示されます
\n";
print "現在の登録者$total人を最新から表\示";
if ( $colorflg == 1 ) {
print "
\n";
foreach ( 0..$#COLOR_NUM ) {
print "| ■ | $COLOR_NUM[$_]人以上 |
";
}
print "
\n";
}
}
}
###<--------------------------------------------------------------
###<--- SendMail
###<--------------------------------------------------------------
sub SMail {
$ttl = $title;
$wkcomment = $FORM{$name_comment} ;
$wkcomment =~ s/<//g;
$wkcomment =~ s/
/\n/g;
if ($FORM{'hp'} ne "") { $wk = "http://$FORM{'hp'}"; }
$DETAIL1 = <<"EOM";
-------------------------------------------------------------
投稿された内容は下記の通りです。
-------------------------------------------------------------
▼投稿日
$today
▼記事No
$no
▼お名前
$FORM{'name'}
▼メールアドレス
$FORM{'email'}
▼地域
$AREATBL[$FORM{'area'}]
▼性別
$SEXTBL[$FORM{'sex'}]
▼ホームページ
$wk
EOM
$DETAIL2 = <<"EOM";
▼メッセージ
$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 .= $DETAIL1 ;
$mailbuf .= "▼$lbl_yobi1\n$YOBITBL1[$FORM{'yb1'}]\n\n" if ( $YOBITBL1[0] ne '' && $FORM{'yb1'} ne '' ) ;
$mailbuf .= "▼$lbl_yobi2\n$YOBITBL2[$FORM{'yb2'}]\n\n" if ( $YOBITBL2[0] ne '' && $FORM{'yb2'} ne '' ) ;
$mailbuf .= "▼$lbl_yobi3\n$YOBITBL3[$FORM{'yb3'}]\n\n" if ( $YOBITBL3[0] ne '' && $FORM{'yb3'} ne '' ) ;
$mailbuf .= "▼$lbl_yobi4\n$YOBITBL4[$FORM{'yb4'}]\n\n" if ( $YOBITBL4[0] ne '' && $FORM{'yb4'} ne '' ) ;
$mailbuf .= "▼$lbl_yobi5\n$YOBITBL5[$FORM{'yb5'}]\n\n" if ( $YOBITBL5[0] ne '' && $FORM{'yb5'} ne '' ) ;
$mailbuf .= $DETAIL2 ;
#漢字コードJIS変換
$mailbuf =~ s/&/&/g; $mailbuf =~ s/"/"/g;
$mailbuf =~ s/<//g;
&jcode'convert(*mailbuf,'jis');
print MAIL $mailbuf ;
close(MAIL);
}