#!/usr/bin/perl #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++  [ あいさつ、しちゃ朗!! ] #+++ ・・・・・>>> All Created by Tacky #+++ ・・・・・>>> Copyright (c) 1999.6 Tacky's Room. All rights reserved.... #+++ Homepage >>> http://tackysroom.com/ #+++ #+++ 設置方法構成(具体例) #+++ #+++ public_html(ホームページディレクトリ) #+++ | #+++ |-- cgi-bin(任意のディレクトリ) #+++ | #+++ |-- jcode.pl (755)…(日本語ライブラリ) #+++ |-- sicharou.cgi (755)…(スクリプト本体) #+++ |-- sicharou.txt (666)…(ログファイル)…空のままアップロード #+++ |-- sicharou2.txt (666)…(投稿回数管理ファイル)…空のままアップロード #+++ |-- sicharou3.txt (666)…(常連様用メッセージ格納ファイル)…空のままアップロード #+++ #+++   ■( )内はパーミッッションの値です。 #+++ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ require './jcode.pl'; #日本語コード変換 $script = "./sicharou.cgi"; #<<<このスクリプトの名前 $method = "POST"; #<< おはこんばー!僕「しちゃ朗」は何かと\申\しますと、コミュニケーションを とる為にとっても大切な事、そう!!『挨拶』です!!....挨拶しましょ〜!ただそれだけ。(笑)
僕の使い方は「名前を書いて、ポン♪ 押すだけぇ〜♪」で〜す
※補足:『おはこんば〜♪』は、みなさんがいつ挨拶してくれるか わからないから、「おはよう」、「こんにちは」、「こんばんわ」をミックスしてみました〜♪(笑)
iModeでも見られます EOM #<<"; print $dmy_tok2_cookie; # クッキーの発効 print "\n\n"; } exit; } else { &cookieget; } &dataread ; } &header ; &header2 ; if ( $env == 0 || ($env != 0 && $dsp_new == 0) ) { &inputform; } &disp ; #<<<登録済メッセージの表示 if ( $manual == 2 ) { &setumei; } #<<<「使い方」の表示 print "\n" if ( $acs == 0 ); print "

\n"; print "
" if ( $acs == 0 ) ; print "
\n"; if ( $acs == 0 ) { print "No \n"; } print "\n"; if ( $acs == 1 ) { print "No
\n"; } if ( $acs == 0 ) { print " Pass \n"; } print "\n"; if ( $acs == 1 ) { print "Pass
\n"; } print "\n"; if ( $acs == 1 ) { print "
\n"; } print "\n"; print "\n"; #<<< ↓消さないでネ♪ print "
\n"; if ( $env == 0 ) { print "sicharou(Ver0.995)-Tacky\'s Room\n"; } else { print "\n"; } print "
"; print "
\n" if ( $acs == 0 ); &footer ; #<<< htmlフッターの出力 } ############################################################################### #### Main Process END ####################################################### ############################################################################### ###<-------------------------------------------------------------- ###<--- デコード&変数代入 ###<-------------------------------------------------------------- sub decode{ if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});$post=1; } else { $buffer = $ENV{'QUERY_STRING'};$post=0; } @pairs = split(/&/,$buffer); @msg = (); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($tag eq 'yes') { #危険なタグは禁止!!! foreach ( @errtag ) { if ($value =~ /<$_(.|\n)*>/i) {&error("使用出来ないタグが入力されています");} } } $value =~ s/(\r\n){$kaigyo,}/$1/g if ( $kaigyo ) ; if ( $name ne $name_comment && $name ne 'msg' ) { $value =~ s/\r\n//g; $value =~ s/\r|\n//g; } if ( ($tag ne 'yes' || $name ne $name_comment) && $name ne 'msg' ) { $value =~ s/&/&/g; $value =~ s/"/"/g; $value =~ s//>/g; } $value =~ s/\,/,/g; foreach ( @errword ) { if ( $_ && $value =~ /$_/) { &error("投稿禁止単語が入力されていますので投稿出来ません"); } } if ( $urllink && ($name eq 'name' || $name eq 'hp' || $name eq 'msg' || $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' || $FORM{'action'} eq 'update2' ) { 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\:\/\///; if ( $acs == 1 ) { $FORM{'icon'} = $icon_imode ; } } ###<-------------------------------------------------------------- ###<--- HTMLヘッダー書き出し ###<-------------------------------------------------------------- sub header { print "Content-type: text/html; charset=Shift_JIS\n"; if ( $env != 0 ){ print "Pragma: no-cache\n"; print "Cache-Control: no-cache\n"; print "Expires: Thu, 01 Dec 1994 16:00:00 GMT\n"; } print "\n"; if ( $env == 2 ) { print <<"EOM"; EOM } print "\n\n"; print "\n"; if ( $env != 0 ){ print "\n"; #ezweb対応 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 "\n"; } ###<-------------------------------------------------------------- ###<--- ログファイル読み込み ###<-------------------------------------------------------------- sub dataread { #<<<ログ読み込み if ( !(open(IN,"$logfile"))) { &error("ログファイル($logfile)のオープンに失敗しました"); } @LOG = ; close(IN); } ###<-------------------------------------------------------------- ###<--- ヘッダー2 ###<-------------------------------------------------------------- sub header2 { if ( $acs == 0 ) { print "\n"; print "\n"; if ( $url ) { print "\n"; } else { print "onClick=\"parent.location.href = \'$url\'\" $css_style>\n"; } } if ( $logfile2 && $FORM{'action'} ne 'download') { #i001112 print "\n"; #i000714 print "\n"; } else { print "onClick=\"parent.location.href = \'$script?action=ranking\'\" $css_style>\n"; } } if ( $logfile2 && $FORM{'action'} ne 'download') { print "\n"; print "\n"; } else { print "onClick=\"parent.location.href = \'$script?action=info\'\" $css_style>\n"; } } print "
 
 

\n"; print "
" ; } else { if ( $url ) { print "[HOME]"; } if ( $logfile2 && $FORM{'action'} ne 'download') { #i001112 print " [ランキング]"; } print " [新規投稿]" if ( $dsp_new == 1 ) ; print "

\n"; } if ( $titlelogo ) { print "
\n"; } else { print "$title
\n"; } } ###<-------------------------------------------------------------- ###<--- 入力フォーム ###<-------------------------------------------------------------- sub inputform { print "
\n"; if ( $FORM{'action'} ne 'maintenance' ) { print "\n"; } else { print "\n"; print "\n"; print "\n"; print "\n"; } #================================================================= if ( $acs == 0 ) { if ( $maru == 1 ) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; } if ( $maru == 1 ) { $dmy = "width=100%"; } else { $dmy = ""; } if ( $maru == 0 ) { $dmy2 = 1; } else { $dmy2 = 0; } print "\n"; if ( $maru == 0 ) { $bg = "bgcolor=#000000"; } else { $bg = "bgcolor=$tbgcolor"; } print "\n"; } else { if ( $emailflg == 1 ) { print " Email:\n"; } if ( $hpflg == 1 ) { print " URL:\n"; } print "\n"; } print "
\n"; if ( $maru == 0 ) { print "\n"; print ""; print "\n"; print "\n"; #■アイコン if ( $icon_flg eq 'yes' ) { print "\n"; } if ( $emailflg == 1 ) { #■メールアドレス print "\n"; } if ( $hpflg == 1 ) { #■Homepage print "\n"; } print "
\n"; } $c_cm =~ s/&/&/g; if ( $textflg != 1 ) { #■お名前 print "  Name"; print "  
"; if ( $passsw == 1 ) { print "パスワード  \n"; } print ""; if ( $icon_flg eq 'yes' ) { print "  アイコン一覧"; } print "
\n"; print "  Icon  
\n"; print "  Email  
\n"; print "  URL  
\n"; } else { print "\n"; print ""; if ( $passsw == 1 ) { print "  パスワード  \n"; } if ( $emailflg == 1 || $hpflg == 1 ) { if ( $icon_flg eq 'yes' ) { print "  アイコン一覧  \n"; } } print "
\n"; print "Name:"; print "\n"; if ( $icon_flg eq 'yes' ) { print " Icon:\n"; } if ( $emailflg == 0 && $hpflg == 0 ) { if ( $icon_flg eq 'yes' ) { print "  アイコン一覧\n"; } print "
\n"; } if ( $maru == 0 ) { print "
\n"; } if ( $maru == 1 ) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } } else { #imode時 #■お名前 print "■Name
"; print "
\n"; if ( $emailflg == 1 ) { #■メールアドレス print "■Email

\n"; } if ( $hpflg == 1 ) { #■Homepage print "■URL

\n"; } print "■Message
"; if ( $textflg != 1 ) { print "
"; } else { print "\n"; } print "
"; } print "
"; if ( $manual == 1 ) { &setumei; } #<<<「使い方」の表示 print "
\n" if ( $acs == 0 ) ; if ( $acs == 0 ) { print "\n"; } } ###<-------------------------------------------------------------- ###<--- みなさんからの挨拶を表示 ###<-------------------------------------------------------------- sub disp { if ( $acs == 0 ) { print "
\n"; print "
$title

\n" if ( $FORM{'action'} eq 'download' ) ;; if ( !(open(IN3,"$logfile3"))) { &error("ログファイル3($logfile3)のオープンに失敗しました"); } @message = ; close(IN3); foreach ( @message ) { ($n,$m) = split(/:/,$_); if ( $c_name eq $n ) { print "
$m
\n"; } } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ( $icon_flg eq 'yes' && $FORM{'action'} ne 'download' ) { print "\n"; } if ( $hpflg == 1 ) { print "\n"; } print "\n"; if ( $logfile2 ) { print ""; print ""; } print "\n"; } else { if ( !(open(IN3,"$logfile3"))) { &error("ログファイル3($logfile3)のオープンに失敗しました"); } @message = ; close(IN3); foreach ( @message ) { ($n,$m) = split(/:/,$_); if ( $c_name eq $n ) { print "▼MESSAGE
$m\n"; } } } if ( !(open(IN,"$logfile"))) { &error("ログファイル($logfile)のオープンに失敗しました"); } @data = ; close(IN); #表示対象ページの先頭データ件数を算出 $dm = @data; if ( $dm % $pagemax == 0) { $p = $dm / $pagemax ; } else { $p = $dm / $pagemax + 1; } $p = sprintf("%3d",$p); if ( $FORM{'page'} eq "NEXT" ) { if ( $FORM{'disppage'} == 0 ) { $FORM{'disppage'} = 1 } ; $d = ($FORM{'disppage'} + 1) * $pagemax - $pagemax ; $FORM{'disppage'} = $FORM{'disppage'} + 1 ; } elsif ( $FORM{'page'} eq "BACK" ) { $d = ($FORM{'disppage'} - 1) * $pagemax - $pagemax ; $FORM{'disppage'} = $FORM{'disppage'} - 1 ; } else { $d = 0 ; $FORM{'disppage'} = 1 ; } $z = 1 ; if ( $FORM{'action'} eq 'download' ) { #i001112 $d = 0 ; $pagemax = $dm ; $icon_flg = "no"; } for ( $i = $d ; ( $z <= $pagemax ) && ( $i < $dm ); $i++ ) { ($no,$dt,$nm,$cm,$cnt,$icon,$email,$hp,$hst,$dmy) = split(/,/,$data[$i]); ($svdate,$svtime) = split(/ /,$dt); $raihoucnt = sprintf("%d",$cnt); $edt = substr($svdate,4,2); $edt = sprintf("%02d",$edt)."/"; $edt2 = substr($svdate,6,2); $edt = $edt.sprintf("%02d",$edt2); if ( $acs == 0 ) { if ( $bg eq $cellbgcolor1 ) { $bg = $cellbgcolor2; } else { $bg = $cellbgcolor1; } print "
\n"; if ( $cm ne 'OIWAI' ) { print "\n"; print "\n"; if ( $icon_flg eq 'yes' ) { print "\n"; } if ( $hpflg == 1 ) { print "\n"; } else { print " \n"; } } if ( $cm eq '' ) { $cm = ' '; } $cm =~ s/&/&/g; print "\n"; if ( $logfile2 ) { #i001112 print "\n"; $ranking = &rankget($raihoucnt) ; print "\n"; } print "\n"; } else { $cs = 7 ; if ( $icon_flg ne 'yes' ) { $cs--; } if ( $hpflg != 1 ) { $cs--; } if ( $logfile2 eq '' ) { $cs--; } print ""; } } else { print "
"; print "[$no]..$edt-$svtime
\n"; if ( $email ) { print "$nm\n"; } else { print "$nm"; } if ( $logfile2 ) { #i001112 $ranking = &rankget($raihoucnt) ; print "($raihoucnt回…$rank[$ranking])\n"; } if ( $hpflg == 1 ) { if ( $hp ) { print "-[URL]\n"; } } print "
\n"; if ($cm ne "OIWAI") { $wk = "$cm"; } else { $wk = $oiwaimsg_i; $wk =~ s/NAME/$nm/i; $wk =~ s/CNT/$raihoucnt/i; $wk = "$wk"; } print "$wk\n"; } $z++; } print "
NoDateNameIconURLMessage回数昇進状態
$no$edt-$svtime"; if ( $email ) { print "$nm\n"; } else { print "$nm"; } print "\n"; &icon_set($nm) ; print ""; if ( $hp ) { print "[URL]$cm"; print " ...($hst)" if ( $host_disp == 1 ) ; print "$raihoucnt回\n"; print "\n" if ( $rankicon[$ranking] ) ; print "$rank[$ranking]\n" if ( !($rankicon[$ranking]) ) ; print "
\n"; $wk = $oiwaimsg ; $wk =~ s/NAME/$nm/i; $wk =~ s/CNT/$raihoucnt/i; print "$wk"; print "
\n" if ( $acs == 0 ); if ( $FORM{'action'} ne 'download' ) { #i001112 print "
\n"; print "\n"; if ( $FORM{'disppage'} != 0 && $FORM{'disppage'} !=1) { print "\n"; } if ( $FORM{'disppage'} + 1 <= $p ) { print "\n"; } print "
\n"; } if ( $acs == 0 ) { if ( $logfile2 ) { #i001112 print "
TotalCountは、あなたの過去からの挨拶回数です♪

"; } } else { print "( )の数字は投稿回数です\n"; } if ( $acs == 0 ) { #i001112 print "
\n" ; print "
\n"; print "\n"; print "\n"; print "
拡張子はhtmに変更して下さい"; print "
\n"; } } ###<-------------------------------------------------------------- ###<--- 挨拶ログ出力 ###<-------------------------------------------------------------- sub regist { if ( $FORM{'name'} eq "") { &error("名前は省略出来ません。") ; } if ( $maxword ne '' && (length($FORM{$name_comment}) > $maxword)) { &error("メッセージは$maxword文字までしか登録出来ません。"); } if ( $textflg2 == 1 && $FORM{$name_comment} eq '' ) { &error("メッセージ欄は省略出来ません。") ; } if ( $mailerr == 1 && $FORM{'email'} ) { &error("セキュリティ対策の為、メールアドレスは入力出来ません。"); } if ( $urlerr == 1 && $FORM{'hp'} ) { &error("セキュリティ対策の為、URLは入力出来ません。"); } # 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("半角英数字のみの投稿は出来ません。"); } } # ホスト名を取得 $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){ &error("\申\し\訳ありません。
あなたのプロバイダーからは投稿できませんでした. "); } } } &filelock ; #ファイルロック &dataread ; $dcnt2 = @LOG; if ($dcnt2 >= $datamax) { pop(@LOG); } if ( $dcnt2 < 1 ) { $no = 1; #1件目 } else { ($no,$dt,$nm,$cm,$cnt,$icon,$email,$hp,$hst,$dmy) = split(/,/,$LOG[0]); $no++ ; } if ( $renchan1 != 0 || $renchan2 != 0 ) { $write_cnt = 1 ; foreach $buf ( @LOG ) { ($n,$dt,$nm,$cm,$cnt,$icon,$email,$hp,$hst,$dmy) = split(/,/,$buf); if ( $renchan2 != 0 && $cm ne 'OIWAI' && $hst eq $host ) { $write_cnt++ ; if ( $write_cnt >= $renchan2 ) { &fileunlock ; &error("$renchan2回以上の連続投稿は禁止しています"); } } if ( $renchan2 != 0 && $hst ne $host ) { last ; } #i001220 if ( $renchan1 != 0 && $dt ge $renday ) { if ( $hst eq $host ) { &fileunlock ; &error("$renchan1分以内の連続投稿は禁止しています"); } } } } if ( $logfile2 ) { if ( !(open(IN2,"$logfile2"))) { &fileunlock ; &error("ログファイル2($logfile2)のオープンに失敗しました"); } @sv = (); $flg = 0 ; while ( ) { ($n,$k) = split(/,/,$_); $k =~ s/\n//; if ( $FORM{'name'} eq $n ) { $k++; $dcnt = $k ; $flg = 9; } $k = sprintf("%03d",$k); push(@sv,"$n,$k\n"); } if ( $flg == 0 ) { push(@sv,"$FORM{'name'},001\n"); $dcnt = 1; } close(IN2); if ( !(open(OUT,">$logfile2"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @sv; close(OUT); } # パスワードの暗号化(crypt関数使用)) if ($FORM{'pass'} ne "") { &pass_enc($FORM{'pass'}); } else { $pass = '' ; } unshift(@LOG,"$no,$today,$FORM{'name'},$FORM{$name_comment},$dcnt,$FORM{'icon'},$FORM{'email'},$FORM{'hp'},$host,$pass\n"); foreach $buf ( @OIWAI ) { if ( $dcnt == $buf ) { $dcnt2 = @LOG; if ($dcnt2 >= $datamax) { pop(@LOG); } $no++ ; unshift(@LOG,"$no,$today,$FORM{'name'},OIWAI,$dcnt,,$FORM{'email'},,$host,$pass\n"); last ; } } if ( !(open(OUT,">$logfile"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @LOG; close(OUT); &fileunlock ; #ファイルロック解除 #COOKIE設定 &cookieset ; } ###<-------------------------------------------------------------- ###<--- 使い方の説明部分 ###<-------------------------------------------------------------- sub setumei { print "

\n"; #使い方を表示する if ( $acs == 0 ) { print $manualmsg; } else { print $manualmsg2; } } ###<------------------------------------------------------------- ###<--- クッキー取得 ###<-------------------------------------------------------------- sub cookieget { $cookies = $ENV{'HTTP_COOKIE'}; @pairs = split(/;/,$cookies); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ s/ //g; $DUMMY{$name} = $value; } @pairs = split(/,/,$DUMMY{'sicharou'}); foreach $pair (@pairs) { ($name, $value) = split(/\!/, $pair); $value =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C",hex($1))/eg; $value =~ s/\+/ /g; $COOKIE{$name} = $value; } if ( $env != 0 && $FORM{'action'} eq 'regist') { $c_name = $FORM{'name'}; $c_icon = $FORM{'icon'}; $c_email = $FORM{'email'}; $c_hp = $FORM{'hp'}; } else { $c_name = $COOKIE{'nm'}; $c_icon = $COOKIE{'icon'}; $c_email = $COOKIE{'em'}; $c_hp = $COOKIE{'hp'}; } } ###<------------------------------------------------------------- ###<--- クッキー設定 ###<-------------------------------------------------------------- sub cookieset { ($secg,$ming,$hourg,$mdayg,$mong,$yearg,$wdayg,$ydayg,$isdstg) =gmtime(time + 30*24*60*60); $yearg += 1900 ; if ($secg < 10) { $secg = "0$secg"; } if ($ming < 10) { $ming = "0$ming"; } if ($hourg < 10) { $hourg = "0$hourg"; } if ($mdayg < 10) { $mdayg = "0$mdayg"; } $mong = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mong]; $youbi = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')[$wdayg]; $date_gmt = "$youbi, $mdayg\-$mong\-$yearg $hourg:$ming:$secg GMT"; # $FORM{'name'} =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg; # $FORM{'hp'} =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg; $cook="nm\!$FORM{'name'},icon\!$FORM{'icon'},em\!$FORM{'email'},hp\!$FORM{'hp'},ps\!$FORM{'pass'}"; print "Set-Cookie: sicharou=$cook; expires=$date_gmt\n"; } ###<-------------------------------------------------------------- ###<--- メンテナンスモード ###<-------------------------------------------------------------- sub Maintenance { if ( $FORM{'proc'} ne 'message' && $FORM{'no'} eq "") { &error("メンテナンス対象の記事Noを指定して下さい。"); } if ( $FORM{'pass'} eq "") { &error("パスワードを入力して下さい。"); } #投稿ログのメンテナンス if ( $FORM{'proc'} eq 'edit' ) { &logmtn; } #投稿ログの削除 if ( $FORM{'proc'} eq 'delete' ) { &update; } #訪問者用メッセージのメンテナンス if ( $FORM{'proc'} eq 'message' ) { &msgmtn; } } ###<-------------------------------------------------------------- ###<--- ログファイル・メンテナンス ###<-------------------------------------------------------------- sub logmtn { if ( $FORM{'no'} eq "") { &error("記事Noを入力して下さい。"); } if ( $FORM{'pass'} eq "") { &error("パスワードを入力して下さい。"); } $found = 0 ; &dataread ; #<<<ログ読み込み foreach ( @LOG ) { ($no,$dt,$nm,$cm,$cnt,$icon,$email,$hp,$hst,$ps) = split(/,/,$_); if ( $FORM{'no'} eq $no ) { $ps =~ s/\n//; if ($FORM{'pass'} ne $password && (&pass_dec($ps))) { &error("パスワードが違います。"); } $found = 1 ; if ( $FORM{'proc'} eq "delete" ) { &update ; exit; } if ( $cm eq 'OIWAI' ) {&error("昇進メッセージデータは修正出来ません。"); } &header ; $c_name = $nm ; $c_icon = $icon ; $c_email = $email ; $c_hp = $hp ; $c_ps = $ps; $c_cm = $cm; $c_cm =~ s/
/\n/gi; $c_ps = $FORM{'pass'}; &inputform ; last; } } if ( $found == 0 ) { &error("該当する記事Noのデータは存在していません。"); } &footer ; exit; } ###<-------------------------------------------------------------- ###<--- 来訪者用メッセージファイル・メンテナンス ###<-------------------------------------------------------------- sub msgmtn { if ( !(open(IN,"$logfile3"))) { &error("ログファイル3($logfile3)のオープンに失敗しました"); } @data = ; close(IN); &header ; print "[BACK]\n"; if ( $acs == 0 ) { print "
\n"; print <<"EOM";
■来訪者毎に特定のメッセージを表\示する設定を行います■

来訪者がクッキーを許可している場合、ここで登録した名前の人がアクセスした
際に設定したメッセージが表\示されます

設定方法は、「訪問者の名前」+「:(半角コロン)」+「表\示メッセージ」+「改行」で お一人様のメッセージとなります。 文章の途中で改行した場合はメッセージに<br>を入れて設定して下さい。
 例:   Aさん:いつも来てくれてありがとう   Bさん:しばらく来てないねぇ・・・   Cさん:Cさんへ!<br><b>誕生日おめでとー!!!</b>   ※タグを挿入可能\です。
EOM } else { print <<"EOM";
■来訪者毎のメッセージ設定■

「訪問者の名前」+「:(半角コロン)」+「表\示メッセージ」+「改行」で お一人様のメッセージとなります。 文章の途中で改行した場合はメッセージに<br>を入れて設定して下さい。
EOM } foreach ( @data ) { ($nm,$cm) = split(/:/,$_); $cm =~ s/\n//; if ($nm eq '' || $cm eq '') { next; } #i001215 $BUF .= "$nm:$cm\r"; } print "
\n"; print "\n"; if ( $acs == 0 ) { print "\n"; print "
\n"; print "
\n"; } else { print "\n"; print "
\n"; print "\n"; } &footer ; exit ; } ###<-------------------------------------------------------------- ###<--- ログファイル更新 ###<-------------------------------------------------------------- sub update { @DELWORD = split(/ /,$FORM{'no'}); &filelock ; #ファイルロック &dataread ; foreach (@LOG) { ($no,$dt,$nm,$cm,$cnt,$icon,$email,$hp,$hst,$ps) = split(/,/,$_); if ($FORM{'no'} eq $no ) { #<<<編集対象データの場合 $ps =~ s/\n//; if ($FORM{'pass'} ne $password && (&pass_dec($ps))) { &fileunlock ; #ファイルロック解除 &error("パスワードが違います。"); } if ( $FORM{'proc'} ne 'delete' ) { push(@new,"$no,$dt,$FORM{'name'},$FORM{$name_comment},$cnt,$FORM{'icon'},$FORM{'email'},$FORM{'hp'},$hst,$ps\n"); #編集後の内容で置換 } else { if ( $logfile2 ) { if ( !(open(IN2,"$logfile2"))) { &fileunlock ; &error("ログファイル2($logfile2)のオープンに失敗しました"); } @sv = (); $flg = 0 ; while ( ) { ($n,$k) = split(/,/,$_); $k =~ s/\n//; if ( $nm eq $n ) { $k--; } $k = sprintf("%03d",$k); push(@sv,"$n,$k\n"); } close(IN2); if ( !(open(OUT,">$logfile2"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @sv; close(OUT); } } } else { #<<<編集対象データ以外の場合 $found = 0 ; if ( $FORM{'proc'} eq 'delete' ) { foreach $word ( @DELWORD ) { if ( $word && ( $no == $word ) ) { if ( $logfile2 ) { if ( !(open(IN2,"$logfile2"))) { &fileunlock ; &error("ログファイル2($logfile2)のオープンに失敗しました"); } @sv = (); $flg = 0 ; while ( ) { ($n,$k) = split(/,/,$_); $k =~ s/\n//; if ( $nm eq $n ) { $k--; } $k = sprintf("%03d",$k); push(@sv,"$n,$k\n"); } close(IN2); if ( !(open(OUT,">$logfile2"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @sv; close(OUT); } $found = 1 ; last ; } } } if ( $found == 0 ) { 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 ""; print $dmy_tok2_cookie; # クッキーの発効 print "\n\n"; } } ###<-------------------------------------------------------------- ###<--- 来訪者用メッセージファイル更新 ###<-------------------------------------------------------------- sub update2 { &filelock ; #ファイルロック @MSGTBL = split(/\r/,$FORM{'msg'}); foreach $buf ( @MSGTBL ) { if ( $buf ) { push(@MSGTBL2,$buf) ; } } if ( !(open(OUT,">$logfile3"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @MSGTBL2; close(OUT); &fileunlock ; #ファイルロック解除 if ( $damedame == 0 ) { print "Location: $script?\n\n"; } else { print "Content-type: text/html\n\n"; print ""; print $dmy_tok2_cookie; # クッキーの発効 print "\n\n"; } } ###<-------------------------------------------------------------- ###<--- ランキング表示 ###<-------------------------------------------------------------- sub ranking { if ( !(open(IN,"$logfile2"))) { &error("ログファイル2($logfile2)のオープンに失敗しました"); } @data = ; close(IN); $totalcount = @data ; &header ; print "戻る
\n"; @Lank = (); foreach $buf (@data) { ($a,$b) = split(/,/,$buf); push(@Lank,"$b,$a"); } @Lank = sort { $a <=> $b } @Lank ; @Lank = reverse @Lank ; print "
" if ( $acs == 0 ) ; print "<<<<< ランキング >>>>>

\n"; $c = $totalcount - 1; print "総投稿者数==>$c人
\n"; if ( $acs == 0 ) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } $cnt=1; foreach $buf ( @Lank ) { ($raihoucnt,$nm) = split(/,/,$buf); if ( $nm ne $kanriname) { if ( $bg eq $cellbgcolor1 ) { $bg = $cellbgcolor2; } else { $bg = $cellbgcolor1; } $raihoucnt = sprintf("%d",$raihoucnt); for ( $j = 0 ; $j <= $#OIWAI ; $j++ ) { if ( $raihoucnt >= $OIWAI[$j] ) { $ranking = $j ; } } if ( $acs == 0 ) { print "\n"; print "\n"; print "\n"; print "\n" if ( $rankicon[$ranking] ) ; print "\n" if ( !($rankicon[$ranking]) ) ; print "\n"; } else { print "■$cnt位:$nm($raihoucnt回…$rank[$ranking])
"; } $cnt++ ; } if ( $cnt > $rankcnt ) { last ; } } if ( $acs == 0 ) { print "
ランキングお名前投稿回数 
■$cnt位$nm$raihoucnt回$rank[$ranking]


\n"; print "
" ; &footer ; } else { print "\n"; } } ###<-------------------------------------------------------------- ###<--- Information(アイコン一覧) ###<-------------------------------------------------------------- sub icondisp { &header ; #<<

■■■ アイコン一覧 ■■■

\n"; print "\n"; $i = 0 ; $j = 0 ; while ( 1 ) { print "\n"; for ( $ln = 1 ; $j <= $#icon_gif && $ln <= $icon_line ; ) { print "\n"; print "\n"; $j++ ; $ln++ ; } if ( $j > $#icon_gif ) { if ( $ln < $icon_line ) { for ( ; $ln <= $icon_line ; ) { print "\n"; print "\n"; $ln++ ; } } print "\n"; last ; } print "\n"; $i++; } print "
$iconnm[$j]  
"; if ( $jiconnm[0] ne '' ) { print "
\n"; print "
▼常連様専用のアイコンです▼
\n"; $i = 0 ; $j = 0 ; while ( 1 ) { print "\n"; for ( $ln = 1 ; $j <= $#jicon_gif && $ln <= $icon_line ; ) { print "\n"; print "\n"; $j++ ; $ln++ ; } if ( $j > $#jicon_gif ) { if ( $ln < $icon_line ) { for ( ; $ln <= $icon_line ; ) { print "\n"; print "\n"; $ln++ ; } } print "\n"; last ; } print "\n"; $i++; } print "
$jiconnm[$j]  
"; } print "
\n"; &footer ; #<<$_[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 icon_set { #常連者の投稿の場合、常連者用アイコンに置き換える $found = 0 ; for ( $k = 0 ; $k <= $#jiconnm ; $k++ ) { if ( $_[0] eq $jiconnm[$k] ) { $found = 1 ; if ( $jicon_gif_w[$k] != 0 ) { $dmy = "width=\"$jicon_gif_w[$k]\" height=\"$jicon_gif_h[$k]\"" ; } else { $dmy = "" ; } print ""; last ; } } if ( $found == 0 ) { if ( $_[0] eq $oiconnm ) { $found = 1 ; if ( $oicon_gif_w != 0 ) { $dmy = "width=\"$oicon_gif_w\" height=\"$oicon_gif_h\"" ; } else { $dmy = "" ; } print ""; } } if ( $found == 0 ) { if ( !($icon) ) { $icon = 0 ; } if ( $icon_gif_w[$icon] != 0 ) { $dmy = "width=\"$icon_gif_w[$icon]\" height=\"$icon_gif_h[$icon]\"" ; } else { $dmy = "" ; } print ""; } } ###<------------------------------------------------------------- ###<--- ログダウンロードi001112 ###<-------------------------------------------------------------- sub download { print "Content-type: text/download\n\n"; print "$title"; $wk = "bgcolor=\"$bgcolor\""; print "\n"; &disp ; print "


\n"; &footer ; exit; } ###<-------------------------------------------------------------- ###<--- Information ###<-------------------------------------------------------------- sub info { &header ; #<<戻る\n"; print "
<<< \昇\進資格 >>>

\n"; print "以下の投稿回数に従って、あなたは\昇\進していきます!!

\n"; $i = 0; print "
\n"; print "\n"; $k = $#rank ; for ( @rank ) { print ""; print "\n"; print ""; print "\n" if ( $rankicon[$i] ) ; print "\n" if ( !($rankicon[$i]) ) ; print "\n"; $i++; } print "
"; if ( $acs == 0 ) { print "$rank[$i]"; } else { print "$rankicon[$i]"; } print ""; $j = $OIWAI[$i+1] - 1 ; if ( $i != $k ) { print "$OIWAI[$i] 〜$j 回\n"; } else { print "$OIWAI[$i] 以上\n"; } print " 
"; &footer ; #<<= $OIWAI[$j] ) { $ranking = $j ; } } return ($ranking); } ###<------------------------------------------------------------- ###<--- パスワード暗号化 ###<-------------------------------------------------------------- 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; }