#! /usr/bin/perl # # mjbbs.cgi # 麻雀掲示板 # # Revision history # 2.008 : 3/26/07 : NG wordを追加 # 2.007 : 10/16/06 : Cookieを修正 # 2.006 : 10/5/06 : 直接書き込み防止機能を追加 # 2.005 : 1/7/06 : 画像処理を修正 # 2.004 : 10/7/05 : logo設定のタイプミスを修正 # 2.003 : 10/2/05 : Copyrightにリンクを追加 # 2.002 : 9/18/05 : jcode.plを削除 # 2.001 : 2/28/05 : ジャンタグ一覧のHTMLを修正 # 2.0 : 2/22/05 : 一般公開のため大幅改造、nerimb3.cgiをベースに牌表示機能を追加 # # 直接実行可能なMode Options: # mode=read # mode=title # mode=wrform # mode=res # mode=delete # mode=edit # mode=link # mode=sumform # mode=sumpsnl # mode=schform # mode=archform # mode=past # mode=iread # mode=iwrform # mode=iresform # mode=unlock # mode=setup # mode=namedef # mode=print # mode=ssi(SSIで呼び出すときのみ有効) # # mode=unlockとmode=backupはメニューに出てきませんので直接URLを # タイプしてください。 # 例)nerimb3.cgi?mode=unlock #   nerimb3.cgi?mode=backup (ver.1.0 compatibleのみ有効) # 他のメニュー表示、非表示はセットアップ画面で選択できます。 # 非表示にした場合、mode=delete(削除)、mode=setup(セットアップ)のみ # URL直接指定で実行できます。その他の機能は直接指定しても動きません。 # # パスワードファイルを削除することにより新パスワードを設定し直す事ができます。 # # - mode=ssi # 次のようにSSIとして埋め込むのことによって最新メッセージの最初のline行を # を表示することができます。 # # # Undocumented Usage : # 次のようになどで直接リンクすることで特定のメッセージを表示させることが # できます。 # - nerimb3.cgi?mode=print&message= # でMessage# を表示します。 # は、ハイフン、カンマで複数指定することが出来ます。 # ハイフンは範囲、カンマは区切りを表します。 # 例:nerimb3.cgi?mode=print&message=12,15,24,20-22,8-5 # Message#5,6,7,8,12,15,20,21,22,24を表示します。 # - nerimb3.cgi?mode=print&message=&title=on # でMessage# のタイトルを表示します。 # は、ハイフン、カンマで複数指定することが出来ます。 # ハイフンは範囲、カンマは区切りを表します。 # 例:nerimb3.cgi?mode=print&message=12,15,24,20-22,8-5 # Message#5,6,7,8,12,15,20,21,22,24のタイトルを表示します。 # # - nerimb3.cgi?mode=past&number= # でMessage# を表示します。 # - nerimb3.cgi?mode=past&number=&lin= # でから分前までを表示します。 # 例:nerimb3.cgi?mode=past&number=1232&lin=6 # Message#1226から#1232まで計7件表示します。 # - nerimb3.cgi?mode=read&number=d # で今日から過去日分のメッセージを表示します。 # 例:nerimb3.cgi?mode=read&number=d16 # 今日から過去16日分表示(最新200件分以内のみ有効) # - nerimb3.cgi?mode=read&number= # で最新メッセージから過去分のメッセージを表示します。 # 例:nerimb3.cgi?mode=read&number=120 # 最新メッセージから過去120件分表示(最新200件分以内のみ有効) # # 自動リンク: # - 書き込み記事内のhttp://から半角文字の最後まで自動リンクされます。 # - 書き込み記事内の(#1234)などの表記でそのメッセージナンバーへリンクされます。 # - 書き込み記事内のMessage#1234の表記でもそのメッセージナンバーへリンクされます。 # # rejectlink.datとnamedef.datはファイル名が決まっています。 # rejectlink.datは、link modeで、namedef.datは、summary modeで # 使用されますが、無くても問題ありません。 # どちらもnerimb3.cgiと同じディレクトリに置いてください。 # 通常どちらもcgi-binに置いてください。 # # rejectlink.dat : # メッセージ中のリンクの中でデッドリンク等でリンク表示のリストから # 除外したいメッセージナンバーをrejectlink.datに1行つづ記述してください。 # 例:以下はrejectlink.datの内容の例です。 #   ---------------------------------------- #   1 #   120 #   123 #   523 #   ---------------------------------------- # # namedef.dat : # 統計の個人名方式で「人物」を選んだ場合に違う名前を同一人物と # 判断させることができます。 # namedef.datにそれらの名前を人物ごとに1行に登録されていると # 一番左の名前が代表として表示されます。 # 例:以下はnamedef.datの内容の例です。 #   ---------------------------------------- #   管理人,作成者,かんりにん #   ホークス,hawks #   ---------------------------------------- # この例では、「作成者」「かんりにん」共に「管理人」と同一人物として # まとめて集計されます。 # 「ホークス」は改行されているので管理人と別人として判断されますが、 # 「hawks」とは同一人物となります。 # namedef.datがない場合は、書き込みの名前そのままで集計されます。 # # http://www.hidekik.com # # $Id: mjbbs.cgi,v 1.13 2007/03/26 04:24:40 Hideki Kanayama Exp $ # Copyright(c) 1998-2007 Hideki Kanayama Allright reserved ######################################################################## =head1 麻雀牌は以下のサイトのを利用しています。 ------------------------------------------ まつセン 牌画 (フリー素材) ------------------------------------------ 「軽さ」にこだわった「小ファイルサイズ!」のGIF牌画像  麻雀を世に広めるため、牌画を使って素敵なHPやプログラム をつくってみましょうよ!!  リンク貼れだの、メール連絡しろだのと細かい使用条件はなる べくつけませんので、どんどん活用方法を考えてみてください! ※使用上の注意 ・牌画は勝手にどんどん使ってください。HP等での使用にあた  って使用連絡する必要ナシ。 ・(この牌画だけを有料で配布なんてことはまず商業的に無理で  しょうから)プログラムに使うなど、ご自分で付加価値を高め  ての商用化はご自由に。著作権料もいりません。 ・再配布したい方、プログラム等に使用したい方はご連絡だけいた  だけませんでしょうか。  (使用条件、制限を求めるとかではないのでご心配なく) ・16色透過GIF画像です。 ・好みに応じて牌の色を変えたり自分で改造して使用してください。 ・花牌など、無い牌は自分で作ってください(笑)。 ・このHPへのリンクはご自由にどうぞ! まつセンパイ -------------------------------------------- e-mail: l6000all@m4.cty-net.ne.jp HP : http://www4.cty-net.ne.jp/~l6000all/ (^ー^) Let's play mahjong ! m::::::m =cut ###################################################################### use CGI::Carp qw(fatalsToBrowser); use GD; require "timelocal.pl"; require "cgi-lib.pl"; $mbsetupfile = "mbsetup.pl"; $admindat = "adminpwd.dat"; $namedef = "namedef.dat"; $version = "2.008"; $reservedyear = "1998-2007"; $program = $0; $program =~ s/^.+[\/\\]([^\/\\]+)$/$1/; $script = "$program"; $lang = 0; #### File definitions ###################### #$cgibin = "../cgi-bin"; $mbdir = "."; $mbdata = "$mbdir/logdata.dat"; # The following files are only used in versino 1.0 compatible mode. $mbpastdata = "$mbdir/logpast.dat"; $mbarchdata = "$mbdir/logarch.dat"; $pastall = "$mbdir/logpast.all"; $alldata = "$mbdir/logdata.all"; $mbdellog="$mbdir/mbdel.log"; $cookiename = "mb_cookie"; $cookiename2 = "read_cookie"; # 使い方の説明ファイルは各自で用意してください。 $mbusage = "$mbdir/mbusage.html"; # 牌画像ファイルのディレクトリ $paidir = 'pai'; $lockfile = "$mbdir/lockfile.lock"; $mbtitle = "麻雀掲示板"; $mblogo = "$mbdir/mboard.gif"; $logo_style = ''; $logo_color = 'black'; $logo_size = '+1'; $logo_face = ''; $logo_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $logo_loc=1; # 0:左、1:中、2:右 $mbwrtitle = "麻雀掲示板書き込み"; $mbwr_logo = ""; $mbwr_style = ''; $mbwr_color = 'black'; $mbwr_size = '+1'; $mbwr_face = ''; $mbwr_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $mbwr_loc=0; # 0:左、1:中、2:右 $mbrestitle = "麻雀掲示板返事"; $mbres_logo = ""; $mbres_style = ''; $mbres_color = 'black'; $mbres_size = '+1'; $mbres_face = ''; $mbres_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $mbres_loc=0; # 0:左、1:中、2:右 $mbsumtitle = "麻雀掲示板 書き込み統計"; $mbsum_logo = ""; $mbsum_style = ''; $mbsum_color = 'black'; $mbsum_size = '+1'; $mbsum_face = ''; $mbsum_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $mbsum_loc=1; # 0:左、1:中、2:右 $mbarctitle = "麻雀掲示板 アーカイブ作成"; $mbarc_logo = ""; $mbarc_style = ''; $mbarc_color = 'black'; $mbarc_size = '+1'; $mbarc_face = ''; $mbarc_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $mbarc_loc=1; # 0:左、1:中、2:右 $mblinktitle = "リンク抜粋"; $mblink_logo = ""; $mblink_style = ''; $mblink_color = 'black'; $mblink_size = '+1'; $mblink_face = ''; $mblink_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $mblink_loc=1; # 0:左、1:中、2:右 $mbsrctitle = "麻雀掲示板 サーチ"; $mbsrc_logo = ""; $mbsrc_style = ''; $mbsrc_color = 'black'; $mbsrc_size = '+1'; $mbsrc_face = ''; $mbsrc_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $mbsrc_loc=1; # 0:左、1:中、2:右 $mbdeltitle = "麻雀掲示板削除"; $mbdel_logo = ""; $mbdel_style = ''; $mbdel_color = 'black'; $mbdel_size = '+1'; $mbdel_face = ''; $mbdel_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $mbdel_loc=1; # 0:左、1:中、2:右 $mbedititle = "麻雀掲示板変更"; $mbedit_logo = ""; $mbedit_style = ''; $mbedit_color = 'black'; $mbedit_size = '+1'; $mbedit_face = ''; $mbedit_sel = 0; # 0:デフォルト、1:テキスト、2:ロゴ、3:スタイルシート $mbedit_loc=1; # 0:左、1:中、2:右 ############################################# #### Function settings ###################### # Background設定 # 1:画像を使う 0:カラー番号を使う $bgimage_en = 0; $bgimagefile = "$mbdir/sample.jpg"; $bgcolor="#ffffff"; # 統計の「ピッタリ賞」でキリ番として扱われるメッセージナンバーの設定。 @period=(1,100,111,200,222,300,333,400,444,500,555,600,666,700,777,800,888,900,999,1000,1111,1234,2000,2222,2345,3000,3333,3456,4000,4321,4444,4567,5000,5555,5678,6000,6666,6789,7000,7777,8000,8888,9000,9999,10000,11111,20000,22222,30000,33333); # 統計 1:有効 0:無効 $summary_en = 0; # アーカイブ 1:有効 0:無効 $archive_en = 0; # リンク 1:有効 0:無効 $link_en = 1; # タイトル 1:有効 0:無効 $title_en = 1; # サーチ 1:有効 0:無効 $search_en = 1; # 携帯モード 1:有効 0:無効 $imode_en = 0; # 削除機能 1:有効 0:無効 $delete_en = 1; # 変更機能 1:有効 0:無効 $modify_en = 1; # 使い方 1:有効 0:無効 # 使い方の説明ファイルは各自で用意してください。 $usage_en = 0; # セットアップ表示 1:表示 0:非表示 $setup_en = 1; # 自動リンククリック時 1:同じウィンドウ 0:別ウィンドウ $link_samewin_en = 1; # トップへのリンク 1:表示 0:非表示 $top_link_en = 1; $top_link_title = 'トップへ'; $top_link = '../index.html'; # 書き込みタイトルのサイズ、色、フォント $post_title_color = '#00aa00'; $post_title_size = '+2'; $post_title_face = ''; # 返信引用記事の色 $quate_color = '#804040'; # 名前欄のメールアドレス表示 1:on 0:off $maildisp_en = 1; # 名前欄の敬称 1:on 0:off $namesan_en = 0; $namesan = 'さん'; # 返信コメントでの敬称 1:on 0:off $ressan_en = 0; $ressan = 'さん'; # SSIモード設定 # SSIモードを使用するHTMLファイルから見たこのスクリプトへの相対パス、 # 又はhttp://からのフルパス $httpcgibin = "http://localhost/cgi-bin"; # 続き表示リンクの文字列 $gotomb = '続きはこちら.....'; # SSIモードの表示ライン数のデフォルト $ssiline = 7; # 時間設定 GMTからのオフセット 日本:+9 $offset = 9; $time_offset = time + $offset * 3600; # Data file compatible with version 1.0 # 1: Compatible, 0: Incompatible # Version 1.0 では、200件以前の過去のデータを # $mbarchdataと$mbpastdataに分割して保存します。 # Versoin 2.0 以降では、全てのデータを$mbdataの一つのファイルに保存します。 $compatible = 0; # Archiveで使われる圧縮コマンド $compress = "gzip"; #実行されるコマンド $compmsg = "gzip"; #説明に使われるコマンド名 # Compantible modeで使われるUNIX コマンド $cat = "cat"; # Summary で使われる棒グラフの棒 $gif="$mbdir/bar.gif"; # 画像機能 0:無し 1:有り $image_en = 0; # 画像格納ディレクトリ $imagedir = "$mbdir"; # 画像クリック時のウィンドウ 0:別ウィンドウ 1:同じウィンドウ $image_samewin_en = 1; # 縮小表示時のサイズ $max_w = 150; $max_h = 150; #最大画像アップサイズ(kB) $maxmb = 100; #スタイルシート 1:on 0:off $style_sheet_en = 0; $style_sheet = ' A:link {text-decoration: none} A:visited {text-decoration: none} A:active {text-decoration: none} '; #〜内に挿入できる構文 1:on, 0:off $head_insert_en = 0; $head_insert = ''; #トップからのSSI表示による更新時間のための予備のアップデートファイル # 1: on, 0: off $update1_file_en = 0; $update2_file_en = 0; $update1_file = "$mbdir/update1.log"; $update2_file = "$mbdir/update2.log"; #スパム防止のためのキーワード $ticket = 'qualified'; ######################################################################### if (-e "$mbsetupfile"){ require "$mbsetupfile"; } if ($maxmb < 100) {$maxmb = 100;} $maxmb2 = $maxmb + 20; # Margin for text up size $cgi_lib::maxdata = $maxmb2 * 1024; &ReadParse; %in=&mbdecode(%in); if ($script eq 'mbssi.cgi'){ $script = 'nerimb3.cgi'; $in{mode} = 'ssi'; } elsif ($script eq 'mbiread.cgi'){ $script = 'nerimb3.cgi'; $in{mode} = 'iread'; } if ($in{mode} eq 'ssi' && $in{line} eq ''){ $in{line} = $ssiline; } $mbread = "$script?mode=read"; $mbreadt = "$script?mode=title"; $mbwrite = "$script?mode=write"; $mbres = "$script?mode=res"; $mbpast = "$script?mode=past"; $mbwrform = "$script?mode=wrform"; $mblink = "$script?mode=link"; $mbdel1 = "$script?mode=delete"; $mbdel2 = "$script?mode=del2"; $mbdel3 = "$script?mode=del3"; $mbsum = "$script?mode=summary"; $mbsearch = "$script?mode=search"; $mbschform = "$script?mode=schform"; $mbarchform = "$script?mode=archform"; $mbarch = "$script?mode=archive"; $mbsumfm = "$script?mode=sumform"; $mbsumpsfm = "$script?mode=sumpsnl"; $mbiread = "$script?mode=iread"; $mbiwrite = "$script?mode=iwrite"; $mbiwrform = "$script?mode=iwrform"; $mbires = "$script?mode=iresform"; $mbbackup = "$script?mode=backup"; $mbunlock = "$script?mode=unlock"; $mbsetup = "$script?mode=setup"; $mbedit = "$script?mode=edit"; $mbnamedef = "$script?mode=namedef"; $mbnamedefwr = "$script?mode=namedefwr"; $mbprint = "$script?mode=print"; $mbssi = "$script?mode=ssi"; if (! -e "$admindat"){ if ($in{mode} eq 'adminpwd'){ &wradminpwd; } else { &setadminpwd; } } if ($bgimage_en == 1){ $bgimage = "background=\"$bgimagefile\""; } else { $bgimage = "bgcolor=\"$bgcolor\""; } @janpai = qw( man1 man2 man3 man4 man5 man6 man7 man8 man9 pin1 pin2 pin3 pin4 pin5 pin6 pin7 pin8 pin9 sou1 sou2 sou3 sou4 sou5 sou6 sou7 sou8 sou9 haku hatu tyun ton nan sha pei man5red pin5red sou5red ura ); #if ($in{mode} ne 'setup' && $in{mode} ne 'setup1' && $in{mode} ne 'setup2'){ # if (! -d "$mbdir"){ # print "Content-Type:text/html\n\n"; # print "\n"; # print "\n"; # print "\n"; # print "\n"; # print "ディレクトリ$mbdirが存在しません\n"; # print "\n"; # print "\n"; # print "
ディレクトリ$mbdirが存在しません。
\n"; # print "\n"; # exit; # } #} if ($in{mode} eq 'read' || ($in{mode} eq 'title' && $title_en == 1) || $in{mode} eq ''){ &mbread; } elsif ($in{mode} eq 'wrform'){ &mbwrform; } elsif ($in{mode} eq 'write'){ &mbwrite; } elsif ($in{mode} eq 'res'){ &mbres; } elsif ($in{mode} eq 'delete'){ &mbdel1; } elsif ($in{mode} eq 'del2'){ &mbdel2; } elsif ($in{mode} eq 'del3'){ &mbdel3; } elsif ($in{mode} eq 'edit'){ &mbedit; } elsif ($in{mode} eq 'edit2'){ &mbedit2; } elsif ($in{mode} eq 'link' && $link_en == 1){ &mblink; } elsif ($in{mode} eq 'sumform' && $summary_en == 1){ &mbsumform; } elsif ($in{mode} eq 'sumpsnl' && $summary_en == 1){ &mbsumpsnl; } elsif ($in{mode} eq 'summary' && $summary_en == 1){ &mbsum; } elsif ($in{mode} eq 'namedef' && $summary_en == 1){ &mbnamedef; } elsif ($in{mode} eq 'namedefwr' && $summary_en == 1){ &mbnamedefwr; } elsif ($in{mode} eq 'schform' && $search_en == 1){ &mbschform; } elsif ($in{mode} eq 'search' && $search_en == 1){ &mbsearch; } elsif ($in{mode} eq 'archform' && $archive_en == 1){ &mbarchform; } elsif ($in{mode} eq 'archive' && $archive_en == 1){ &mbarch; } elsif ($in{mode} eq 'past' || $in{mode} eq 'print'){ &mbpast; } elsif ($in{mode} eq 'iread' && $imode_en == 1){ &mbiread; } elsif ($in{mode} eq 'iwrite' && $imode_en == 1){ &mbiwrite; } elsif ($in{mode} eq 'iwrform' && $imode_en == 1){ &mbiwrform; } elsif ($in{mode} eq 'iresform' && $imode_en == 1){ &mbiresform; } elsif ($in{mode} eq 'backup'){ &mbbackup; } elsif ($in{mode} eq 'unlock'){ &mbunlock; } elsif ($in{mode} eq 'setup'){ &setadminpwd; } elsif ($in{mode} eq 'setup1'){ &asksetup; } elsif ($in{mode} eq 'setup2'){ &makesetup; } elsif ($in{mode} eq 'ssi'){ &mbssi; } elsif ($in{mode} eq 'jantag'){ &mbjantag; } else { &mbread; } exit; ############################################################################# # Read mode ################################################################# ############################################################################# sub mbread { &getmbdata; @alldata = reverse(@alldata); $cookies = $ENV{'HTTP_COOKIE'}; @pairs = split(/;/,$cookies); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ s/ //g; $DUMMY{$name} = $value; } @pairs = split(/,/,$DUMMY{$cookiename2}); foreach $pair (@pairs) { ($name, $value) = split(/:/, $pair); $COOKIE{$name} = &cookie_decode($value); } $date_gmt=&mbcook; @findata = split(/,/,$alldata[0]); $cook="done:$findata[0]"; #$ago = $ENV{"QUERY_STRING"}; $ago = $in{number}; #if ($ago ne ''){ print "Set-Cookie: $cookiename2=$cook; expires=$date_gmt\n"; #} print "Content-Type: text/html\n\n"; $fdone=$findata[0] - $COOKIE{done}; $fnext=$findata[0] - 20; $startpoint = 0; if($ago eq done){ $line=$fdone; } elsif ($ago =~ /&/) { ($ago,$t)=split(/&/,$ago); $line = $ago; } elsif ($ago =~ /^d/) { $ago =~ s/d(\d+)/$1/; $today=$time_offset; for($i=0;$i<=$ago;$i=$i+1){ $yesterday=$today-86400*$i; ($ysec,$ymin,$yhour,$ymday,$ymon,$yyear,$ywday,$yyday,$yisdst)=gmtime($yesterday); $yrmon=$ymon+1; $yester1="${yyear}_${yrmon}_${ymday}"; @yesterdata=grep(/^\d\d*,$yester1,/,@alldata); $ycount=$#yesterdata + 1; $line = $line + $ycount; } } elsif ($ago =~ /^n/) { $ago =~ s/n(\d+)/$1/; $startpoint=$findata[0] - $ago; $fnext=$ago - 20; $line=$startpoint+20; } elsif ($ago =~ /^\d/) { $line=$ago; } else { $line=20; } $t = $in{mode}; if ($#alldata < $line){ $finline=$#alldata; } else { $finline=$line-1; } print ""; print < $mbtitle HEADPRINT if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } print "\n"; print "\n"; &disphead; if (($fnext > $findata[0] - 200) && (($ago eq '')||($startpoint != 0))) { if ($fnext > 0) {print "
更に前の20件を見る ";} } print "
\n"; if ($t eq 'title') {print "
\n";}; if (($fnext > $findata[0] - 200) && (($ago eq '')||($startpoint != 0))) { if ($fnext > 0) {print "更に前の20件を見る ";} } &disptail; print "

新規書き込み

\n"; ©right; print ""; print ""; } sub get_image_size { my ($image,$max_width,$max_height) = @_; my $imagefile = "$imagedir/$image"; my $im; $image =~ /\.jpe?g$/i and $im = GD::Image->newFromJpeg($imagefile); $image =~ /\.gif$/i and $im = GD::Image->newFromGif($imagefile); $image =~ /\.png$/i and $im = GD::Image->newFromPng($imagefile); $image =~ /\.xbm$/i and $im = GD::Image->newFromxbm($imagefile); $image =~ /\.gd$/i and $im = GD::Image->newFromgd($imagefile); $image =~ /\.gd2$/i and $im = GD::Image->newFromgd2($imagefile); $image =~ /\.xpm$/i and $im = GD::Image->newFromxpm($imagefile); my ($width, $height) = $im->getBounds() if ($im); my $actual_width; my $actual_height; if ($width > $max_width or $height > $max_height){ my $width_shrink = $max_width / $width; my $height_shrink = $max_height / $height; my $shrink_ratio; if ($width_shrink < $height_shrink){ $shrink_ratio = $width_shrink; } else { $shrink_ratio = $height_shrink; } $actual_width = int($width * $shrink_ratio); $actual_height = int($height * $shrink_ratio); } else { $actual_width = $width; $actual_height = $height; } return($imagefile,$actual_width,$actual_height); } sub copyright { my $mysite = ('http://www.hidekik.com/','http://www.hidekik.com/en/')[$lang]; print "

$script Ver. $version
\n"; print "
Copyright(C) $reservedyear, hidekik.com
\n"; } sub convjantag { my ($tag) = shift; my $result, $orgtag, $word; $orgtag = $tag; $tag =~ tr/[A-Z]/[a-z]/; $tag =~ /<(.+)>/; $word = $1; if (-e "$paidir/$word.gif") { $result = ""; return($result); } else { return($orgtag); } } sub readpai { my ($pai) = shift; my (@paiarray); @paiarray = split(/<>/,$pai); &paidisplay(@paiarray); } sub disphead { local(@md)=@_; $today=$time_offset; foreach $i (0 .. 5){ $yesterday=$today-86400*$i; ($ysec,$ymin,$yhour,$ymday,$ymon,$yyear,$ywday,$yyday,$yisdst)=gmtime($yesterday); $yrmon=$ymon+1; $yester1="${yyear}_${yrmon}_${ymday}"; @yesterdata=grep(/^\d\d*,$yester1,/,@alldata); $ycount=$#yesterdata + 1; $line[$i] = $ycount; } $mb0=$line[0]; $mb1=$mb0+$line[1]; $mb2=$mb1+$line[2]; $mb3=$mb2+$line[3]; $mb4=$mb3+$line[4]; $mb5=$mb4+$line[5]; $titleprint=&titleprint("$mbtitle","$mblogo","$logo_style","$logo_color","$logo_size","$logo_face","$logo_sel","$logo_loc"); if ($md[0] == 0){ if ($logo_sel != 4){ # print "
\"$mbtitle\"

\n"; print "$titleprint\n"; } print "
最近の書き込み件数: 今日 $mb0件、昨日 $line[1]件
\n"; print "
"; if ($fdone > 0) {print "";} print "未読分:$fdone件"; if ($fdone > 0) {print "\n";} print "

\n"; #print "
未読分:$fdone件

\n"; print "
"; if ($top_link_en == 1){ print "$top_link_title "; } print "新規書き込み

\n"; } print "

最新20件最新50件最新100件最新200件200件以前
\n"; print "昨日以降($mb1)*2日前以降($mb2)*3日前以降($mb3)*4日前以降($mb4)*5日前以降($mb5)
\n"; if ($summary_en == 1){print "統計*";} if ($archive_en == 1){print "アーカイブ*";} if ($link_en == 1){print "リンク*";} if ($title_en == 1){print "タイトル*";} if ($search_en == 1){print "サーチ*";} #if ($delete_en == 1){print "削除*";} if ($imode_en == 1){print "携帯モード*";} if ($usage_en == 1){print "使い方*";} if ($setup_en == 1){print "セットアップ";} print "
"; print "\n"; } sub disptail { print "
最新20件最新50件最新100件最新200件200件以前
\n"; print "
昨日以降2日前以降3日前以降4日前以降5日前以降
\n"; } sub getmbdata { if ($compatible == 1){ open(FILE,"< $mbdata"); @alldata=; close(FILE); } else { open(FILE,"< $mbdata"); while(){ chomp; push(@alldata,$_); if ($#alldata >= 200){ shift(@alldata); } }; close(FILE); } } ############################################################################# # Write Form mode ########################################################### ############################################################################# sub mbwrform { $cookies = $ENV{'HTTP_COOKIE'}; @pairs = split(/;/,$cookies); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ s/ //g; $DUMMY{$name} = $value; } @pairs = split(/,/,$DUMMY{$cookiename}); foreach $pair (@pairs) { ($name, $value) = split(/:/, $pair); $COOKIE{$name} = &cookie_decode($value); } print "Content-Type: text/html\n\n"; print < $mbwrtitle END1 if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } $titleprint=&titleprint("$mbwrtitle","$mbwr_logo","$mbwr_style","$mbwr_color","$mbwr_size","$mbwr_face","$mbwr_sel","$mbwr_loc"); print <
$titleprint お名前(必須)

メールアドレス

タイトル(必須)

内容 ジャンタグ一覧

END &wrticket; if ($image_en == 1){ print <

ENDIMAGE } &paiinput; if ($delete_en == 1 || $modify_en == 1){ print <

END2 } print "書き込み後の表\示:"; print <

 書き込む前にもう一度チェック

END2 &write_comment; &unlockdisp; print "

\n"; } sub paiinput { local($value) = shift; my $j; if ($value ne ''){ my (@localpai) = split(/<>/,$value); for($j=0;$j<=$#localpai;$j++){ if ($localpai[$j] eq '') {$num_check[$j+1][0] = 'checked';next;} if ($localpai[$j] =~ /(y?)([a-z]*)(\d?)((red)?)\.?([ma]?)\.?(s?)/){ if ($1 eq 'y') {$yoko_check[$j+1] = 'checked'} if ($2 eq 'man') {$man_check[$j+1] = 'checked'} if ($2 eq 'sou') {$sou_check[$j+1] = 'checked'} if ($2 eq 'pin') {$pin_check[$j+1] = 'checked'} if ($2 eq 'haku') {$haku_check[$j+1] = 'checked'} if ($2 eq 'hatu') {$hatu_check[$j+1] = 'checked'} if ($2 eq 'tyun') {$tyun_check[$j+1] = 'checked'} if ($2 eq 'ton') {$ton_check[$j+1] = 'checked'} if ($2 eq 'nan') {$nan_check[$j+1] = 'checked'} if ($2 eq 'sha') {$sha_check[$j+1] = 'checked'} if ($2 eq 'pei') {$pei_check[$j+1] = 'checked'} if ($2 eq 'ura') {$ura_check[$j+1] = 'checked'} $num_check[$j+1][$3] = 'checked'; if ($4 eq 'red') {$red_check[$j+1] = 'checked'} if ($6 eq 'm') {$minkan_check[$j+1] = 'checked'} if ($6 eq 'a') {$ankan_check[$j+1] = 'checked'} if ($7 eq 's') {$space_check[$j+1] = 'checked'} } } } else { for ($j=1;$j<=14;$j++){ $num_check[$j][0] = 'checked'; } } my $cols=25; print "数字だけで牌の種類(萬品索)がチェックされていなければデフォルトは萬子になります。
\n"; print "暗槓、明槓はその列の牌を4つ表\\示します。上の二つが指定されている場合はそれらもそのまま表\\示されます。
\n"; print "明槓で二つ上の「横」がチェックされているとカンの左端の牌が横になります。一つ上の「横」がチェックされていると左から2番目の牌が横になります。その列の「横」がチェックされていると右端の牌が横になります。
\n"; print "「赤」は伍萬、伍品、伍索だけに有効です。
\n"; print "\n"; print "\n"; my $i; foreach $i (1 .. 14) { &haipai_oneline($i); if ($i == 3 || $i == 6 || $i == 9 || $i == 12 || $i == 13){ print "\n"; } } print "
"; #print "全部表\\示 "; print "全部非表\\示 "; print "
スペース
\n"; print "

"; print "\n"; print "

"; } sub haipai_oneline { my ($i) = shift; print <
1
2
3
4
5
6
7
8
9








西




ONELINE print "暗槓
" if ($i%3 == 0); print "明槓
" if ($i%3 == 0); print "\n"; } sub mbjantag { &htmlhead('ジャンタグ'); print "

下のタグを記事中に埋め込む事で麻雀牌の画像を表\\示させる事ができます。

\n"; my $cols=9; my $rows=5; print "\n"; $colsm1 = $cols - 1; $rowsm1 = $rows - 1; for($h=0;$h<=1;$h++){ foreach $i (0 .. $rowsm1){ for($l=0;$l<=1;$l++){ foreach $j (0 .. $colsm1){ if ($h==0) {$prefix=''} else {$prefix='y'} print "" if ($j == 0); my $key = $i*$cols+$j; if ($janpai[$key] ne ''){ print "\n" if ($l == 0); print "\n" if ($l == 1); } else { print "\n"; } print "" if ($j == $colsm1); } } } } print "
<$prefix$janpai[$key]> 
\n"; &htmltail; } sub htmlhead { my($title) = shift; print "Content-type: text/html\n\n"; print ""; print < $title HEADPRINT if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } print "\n"; print "\n"; } sub htmltail { print ""; } sub mbcheckpai { &htmlhead('手牌プレビュー'); print "

\n"; my @paiarray = &resolvepai; &paidisplay(@paiarray); print "

\n"; my @pais = (); foreach $abc (keys(%in)){ push (@pais,"$abc=$in{$abc}") if ($abc =~ /^num/); push (@pais,"$abc=$in{$abc}") if ($abc =~ /^type/); push (@pais,"$abc=$in{$abc}") if ($abc =~ /^ankan/); push (@pais,"$abc=$in{$abc}") if ($abc =~ /^minkan/); push (@pais,"$abc=$in{$abc}") if ($abc =~ /^yoko/); push (@pais,"$abc=$in{$abc}") if ($abc =~ /^ura/); push (@pais,"$abc=$in{$abc}") if ($abc =~ /^red/); push (@pais,"$abc=$in{$abc}") if ($abc =~ /^space/); } $arg = join ('&',@pais); print "この画面を別ウィンドウで開く

"; print "

"; print "
\n"; &htmltail; exit; } sub paidisplay { my (@paiarray) = @_; my $i; my $elem; my $flag = 0; my $tmp; my $j = 0; foreach $elem (@paiarray){ my $yoko1 = ''; my $yoko2 = ''; my $yoko3 = ''; if ($elem eq '') {$j++;next;} if (-e "$paidir/$elem.gif"){ $flag = 1; print ""; } else { (@small) = split(/\./,$elem); (@smallm2) = split(/\./,$paiarray[$j-2]) if ($j >= 2); (@smallm1) = split(/\./,$paiarray[$j-1]) if ($j >= 1); if (grep(/^m$/,@small)){ if ($smallm2[0] =~ /^y/){$yoko1 = 'y'} else {$yoko1 = ''} if ($smallm1[0] =~ /^y/){$yoko2 = 'y'} else {$yoko2 = ''} if ($small[0] =~ /^y/){$yoko3 = 'y'} else {$yoko3 = ''} $tmp = $small[0]; $tmp =~ s/^y//; if (-e "$paidir/$yoko1$tmp.gif" && -e "$paidir/$yoko2$tmp.gif" && -e "$paidir/$tmp.gif" && -e "$paidir/$yoko3$tmp.gif") { print ""; print ""; print ""; print ""; } } elsif (grep(/^a$/,@small)){ $tmp = $small[0]; $tmp =~ s/^y//; if (-e "$paidir/$tmp.gif"){ print ""; for ($i=0;$i<2;$i++){print "";} print ""; } } elsif (-e "$paidir/$small[0].gif") { print ""; } if (grep(/^s$/,@small)){ print " "; } $flag = 1; } $j++; } if ($flag == 1) {print "

\n";} } sub resolvepai { my @paiarray = (); my $i; return(@paiarray) if ($in{allinvalid} eq 'on'); foreach $i (1 .. 14){ my $numkey = "num_$i"; my $typekey = "type_$i"; my $redkey = "red_$i"; my $yokokey = "yoko_$i"; my $ankankey = "ankan_$i"; my $minkankey = "minkan_$i"; my $spacekey = "space_$i"; my $pai; if ($in{$yokokey} eq on) {$prefix = 'y'} else {$prefix = ''} if ($in{$redkey} eq on && $in{$numkey} == 5) {$suffix = 'red'} else {$suffix = ''} if ($in{$numkey} !~ /^0/){ if ($in{$numkey} =~ /\d/){ if ($in{$typekey} eq ''){ $pai = "man$in{$numkey}"; } else { $pai = "$in{$typekey}" . "$in{$numkey}"; } } else { $pai = "$in{$numkey}"; } } $pai = "$prefix$pai$suffix"; if ($in{$ankankey} eq on){ $pai = "$pai.a"; } elsif ($in{$minkankey} eq on){ $pai = "$pai.m"; } if ($in{$spacekey} eq on){ $pai = "$pai.s"; } push (@paiarray,"$pai"); } return (@paiarray); } ############################################################################# # Write mode ################################################################ ############################################################################# sub mbwrite { if ($in{checkpai} ne ''){ &mbcheckpai; } if ($ENV{REQUEST_METHOD} ne 'POST' or $in{ticket} ne "$ticket") { &error("正規の書き込み方法ではありません。"); } while(-f "$lockfile"){ sleep(1); } open(LOCK,"> $lockfile"); close(LOCK); if ($compatible == 1){$max=200;} ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($time_offset); @wday_array = ('日','月','火','水','木','金','土'); $date_now = sprintf("%02d年%01d月%01d日(%s)%02d時%02d分",$year,$mon +1,$mday,$wday_array[$wday],$hour,$min); $rmon=$mon+1; $datecode="${year}_${rmon}_${mday}"; my @paiarray = &resolvepai; my $paijoin = join ('<>',@paiarray); $cook="name\:" . &cookie_encode($in{name}) . "\,email\:$in{addr}\,mypwd\:$in{pwd}"; $date_gmt = &mbcook; print "Set-Cookie: $cookiename=$cook; expires=$date_gmt\n"; if ($in{name} eq "" || $in{subject} eq "") { &error('名前とタイトルは必ず書いてください'); } if (! open(RD,"<$mbdata")){ $number = 1; } else { if ($compatible == 1){ @alldata=; @tmpdata=@alldata; $line=pop(@tmpdata); ($number,@dummy)=split(/,/,$line); close(RD); if ($max <= $#alldata + 1) { open(LOG,">>$mbpastdata"); print LOG shift(@alldata); close(LOG); chmod(0666,"mbpastdata"); } } else { &getmbdata; ($number,@dummy)=split(/,/,$alldata[$#alldata]); } $number = $number + 1; } $host = $ENV{'REMOTE_HOST'}; $ip = $ENV{'REMOTE_ADDR'}; if ($in{pwd} ne '') { $encpwd = &makecrypt($in{pwd}); } else { $encpwd = ''; } $main=$in{main}; if ($main =~ /\[URL/i or $main =~ /a *href/i ) { &error("書き込み禁止です。"); } if ($image_en == 1 && $in{imagefile} ne ''){ foreach (@in){ if ($_ =~ /name=\"imagefile\"/){ if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; } if ($_ =~ /(.*)filename=\"(.*)\"/i) { $origfile=$2; $origfile =~ s/^.*[\\\/]([^\\\/]+)$/$1/; $imagefile="$number-$origfile"; } } } if ("$origfile" !~ /^[0-9a-zA-Z\._]+$/) { &error("$origfile:アップ後のファイル名は半角英数で。"); } open(OUT,"> $imagedir/$imagefile") || &error("アップロードに失敗しました。"); binmode(OUT); binmode(STDOUT); print OUT $in{imagefile}; close(OUT); chmod (0666,"$imagedir/$imagefile"); } if ($compatible == 1){ push(@alldata,"$number,$datecode,$in{name},$in{addr},${ip}_${host},$date_now,$in{subject},$main,$encpwd,$imagefile,$paijoin\n"); open(FILE,">$mbdata") || &error("$mbdataを開けません。"); print FILE @alldata; close(FILE); } else { open(FILE,">>$mbdata") || &error("$mbdataを開けません。"); print FILE "$number,$datecode,$in{name},$in{addr},${ip}_${host},$date_now,$in{subject},$main,$encpwd,$imagefile,$paijoin\n"; close(FILE); } chmod(0666,"$mbdata"); &extraupdate; unlink("$lockfile"); if ($in{name} ne "" && $in{subject} ne "") { print "Location: $mbread$in{past}\n\n"; } } ############################################################################# # Res Form mode ############################################################# ############################################################################# sub mbres { &getmbdata; @resdata = grep(/^$in{resnum},/,@alldata); my $pai; ($resnumber,$rescode,$resname,$resmail,$reshost,$resdate,$ressubject,$resmain,$resencpwd,$resimagefile,$pai)=split(/,/,$resdata[0]); $cookies = $ENV{'HTTP_COOKIE'}; @pairs = split(/;/,$cookies); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ s/ //g; $DUMMY{$name} = $value; } @pairs = split(/,/,$DUMMY{$cookiename}); foreach $pair (@pairs) { ($name, $value) = split(/:/, $pair); $COOKIE{$name} = &cookie_decode($value); } #$ressubject =~ s/,(\d)/,$1/g; print "Content-Type: text/html\n\n"; print < $mbrestitle END1 if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } $titleprint=&titleprint("$mbrestitle","$mbres_logo","$mbres_style","$mbres_color","$mbres_size","$mbres_face","$mbres_sel","$mbres_loc"); print <

$titleprint お名前(必須)

メールアドレス

タイトル(必須)

END2 &wrticket; print "

内容 ジャンタグ一覧
\n"; if ($pai =~ /\w/){ &readpai($pai); } print < END3 @resdata=split(/<[bB][rR]>/,$resmain); print "$resname"; if ($ressan_en == 1){ print "$ressan"; } print "のメッセージ(#$resnumber)への返事\n\n"; foreach (@resdata){ # s/(http..*)<\/a>/$1/; # s/,(\d)/,$1/g; print "> $_\n"; } print "

"; if ($image_en == 1){ print <

ENDIMAGE } &paiinput($pai); if ($delete_en == 1 || $modify_en == 1){ print <

END2 } print "書き込み後の表\示:"; print <

 書き込む前にもう一度チェック

END2 &write_comment; &unlockdisp; print "

\n"; } ############################################################################# # Message edit Form mode #################################################### ############################################################################# sub mbedit { &getmbdata; @resdata = grep(/^$in{resnum},/,@alldata); my $pai; ($resnumber,$rescode,$resname,$resmail,$reshost,$resdate,$ressubject,$resmain,$resencpwd,$resimagefile,$pai)=split(/,/,$resdata[0]); $cookies = $ENV{'HTTP_COOKIE'}; @pairs = split(/;/,$cookies); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ s/ //g; $DUMMY{$name} = $value; } @pairs = split(/,/,$DUMMY{$cookiename}); foreach $pair (@pairs) { ($name, $value) = split(/:/, $pair); $COOKIE{$name} = &cookie_decode($value); } #$ressubject =~ s/,(\d)/,$1/g; print "Content-Type: text/html\n\n"; print < $mbedititle END1 if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } $titleprint=&titleprint("$mbedititle","$mbedit_logo","$mbedit_style","$mbedit_color","$mbedit_size","$mbedit_face","$mbedit_sel","$mbedit_loc"); print <
$titleprint お名前(必須)

メールアドレス

タイトル(必須)

END2 print "

内容 ジャンタグ一覧
\n"; &wrticket; print < END3 @resdata=split(/<[bB][rR]>/,$resmain); foreach (@resdata){ print "$_\n"; } print "

"; if ($image_en == 1){ $resimagefile =~ s/[\n\r]*$//; if ($resimagefile ne ''){ print <画像はそのまま
画像を削除
画像を差し替え
差し替え画像ファイル(ファイル名は半角英数、アンダースコア、ドットのみ) ENDIMAGE } else { print < アップ画像ファイル(ファイル名は半角英数、アンダースコア、ドットのみ) ENDIMAGE2 } print "

\n"; } if ($pai =~ /\w/){ &readpai($pai); } &paiinput("$pai"); if ($delete_en == 1 || $modify_en == 1){ print <

END2 } print "書き込み後の表\示:"; print <

 書き込む前にもう一度チェック

END2 &write_comment; &unlockdisp; print "

\n"; } ############################################################################# # Edit execute mode ####################################################### ############################################################################# sub mbedit2 { if ($in{checkpai} ne ''){ &mbcheckpai; } while(-f "$lockfile"){ sleep(1); } open(LOCK,"> $lockfile"); close(LOCK); $host = $ENV{'REMOTE_HOST'}; $ip = $ENV{'REMOTE_ADDR'}; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($time_offset); @wday_array = ('日','月','火','水','木','金','土'); $date_now = sprintf("%01d月%01d日(%s)%02d時%02d分",$mon +1,$mday,$wday_array[$wday],$hour,$min); $rmon=$mon+1; $datecode="${year}_${rmon}_${mday}"; my @paiarray = &resolvepai; my $paijoin = join ('<>',@paiarray); if ($in{name} eq "" || $in{subject} eq "") { print "Content-Type: text/html\n\n"; print "\n"; print "\n"; print "
名前とタイトルは必ず書いてください。

\n"; print "

\n\n"; unlink("$lockfile"); exit 1; } open(FILE,"< $admindat"); $adminpwd = ; close(FILE); open(RD,"< $mbdata"); open(FILE,"> $mbdir/tmp.$$"); while(){ s/[\r\n]*$//; # instead of chop ($number,$datecode,$name,$mail,$host,$date,$subject,$main,$oldencpwd,$old_imagefile)=split(/,/); if ($number == $in{resnum}){ if (((crypt($in{pwd},$oldencpwd) eq "$oldencpwd") && ($oldencpwd ne '')) || (crypt($in{pwd},$adminpwd) eq "$adminpwd")) { if ($image_en == 1){ if ($in{imageedit} eq 'delete'){ unlink("$imagedir/$old_imagefile"); $imagefile = ''; } elsif ($in{imageedit} eq 'asis'){ $imagefile = "$old_imagefile"; } elsif ($in{imageedit} eq 'replace'){ if ($in{imagefile} ne ''){ unlink("$imagedir/$old_imagefile"); foreach (@in){ if ($_ =~ /name=\"imagefile\"/){ if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; } if ($_ =~ /(.*)filename=\"(.*)\"/i) { $origfile=$2; $origfile =~ s/^.*[\\\/]([^\\\/]+)$/$1/; $imagefile="$number-$origfile"; } } } if ("$origfile" !~ /^[0-9a-zA-Z\._]+$/) { &error("$origfile:アップ後のファイル名は半角英数で。"); } open(OUT,"> $imagedir/$imagefile") || &error("アップロードに失敗しました。"); binmode(OUT); binmode(STDOUT); print OUT $in{imagefile}; close(OUT); chmod (0666,"$imagedir/$imagefile"); } } else { $imagefile = "$old_imagefile"; } } else { $imagefile = "$old_imagefile"; } open(LOG,">>$mbdellog"); print LOG "$_\n"; close(LOG); print FILE "$number,$datecode,$in{name},$in{addr},${ip}_${host},$date,$in{subject},$in{main},$oldencpwd,$imagefile,$paijoin\n"; chmod(0666,"$mbdellog"); $error = 0; } else { print "Content-Type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "パスワードエラー\n"; print "\n"; print "\n"; if ("$oldencpwd" ne '') { print "
 
パスワードが違います。
\n"; } else { print "
 
パスワードが設定されていないので管理人のみ変更できます。
\n"; } print "\n"; print "\n"; print FILE "$_\n"; $error = 1; } } else { print FILE "$_\n"; } } close(RD); close(FILE); rename("$mbdir/tmp.$$","$mbdata"); chmod(0666,"$mbdata"); &extraupdate; unlink("$lockfile"); if ($error == 0) {print "Location: $mbread\n\n";} } ############################################################################# # Delete display mode ####################################################### # $delete_en = 0 の場合は直接$mbdel1をタイプして実行してください。 # 管理人のみ削除できることになります。 ############################################################################# sub mbdel1 { &getmbdata; @alldata = reverse(@alldata); @findata = split(/,/,$alldata[0]); print "Content-Type: text/html\n\n"; $ago = $in{number}; if ($ago eq ''){ $line = 200; } elsif ($ago >= 1 && $ago <= 5) { $today=time; for($i=0;$i<=$ago;$i=$i+1){ $yesterday=$today-86400*$i; ($ysec,$ymin,$yhour,$ymday,$ymon,$yyear,$ywday,$yyday,$yisdst)=gmtime($yesterday); $yrmon=$ymon+1; $yester1="${yyear}_${yrmon}_${ymday}"; @yesterdata=grep(/^\d\d*,$yester1,/,@alldata); $ycount=$#yesterdata + 1; $line = $line + $ycount; } } else { $line=$ago; } if ($#alldata < $line){ $finline=$#alldata; } else { $finline=$line-1; } $titleprint=&titleprint("$mbdeltitle","$mbdel_logo","$mbdel_style","$mbdel_color","$mbdel_size","$mbdel_face","$mbdel_sel","$mbdel_loc"); print "\n"; print "\n"; print " \n"; print " \n"; print " \n"; print " $mbdeltitle\n"; if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } print "\n"; print "\n"; print "$titleprint\n"; &disphead(1); print "
\n"; foreach $count (0 .. $finline){ chomp($alldata[$count]); my $pai; ($number,$datecode,$name,$mail,$host,$date,$subject,$main,$encpwd,$imagefile,$pai)=split(/,/,$alldata[$count]); print ""; # print ""; print "
Message#${number} $date
"; @darray = split(/[^\d]/,$date); print "
Message#${number} "; $dy = $darray[0]+1900; $date =~ s/^\d?\d\d([^\d]..*)$/$dy$1/; print "$date
"; print "From: "; if ($mail ne ""){ print "${name}" } else { print "$name"; } if ($namesan_en == 1){ print "$namesan"; } if ($mail ne ""){ print " ($mail)" } print "
"; print "
"; if ($#sub2 > 1){ print "Re$#sub2:$sub2[$#sub2]"; } else { print "$subject"; } print "
"; if ($link_samewin_en == 1){ $link_target = '_top'; } else { $link_target = '_blank'; } # $main =~ s/(#)(\d+)/$1$2<\/a>/g; $main =~ s/(https?:\/\/[\w\.\~\-\/\?\&\+\=\:\@\%\;\#\%\$]*)/$1<\/a>$2/g; @mainarry=split(/<[bB][rR]>/,$main); print ""; print ""; print ""; print "
"; $imagefile =~ s/[\r\n]*$//; if ($image_en == 1 && $imagefile ne ''){ $imagefile =~ /.+(\..+)$/; $tail = $1; ($imagefile,$w,$h)=&get_image_size($imagefile,$max_w,$max_h); if ($image_samewin_en == 1){ $newwin = ''; } else { $newwin = 'target="_blank"'; } print ""; } print ""; foreach (@mainarry){ if(/^(\>)(.*)$/){ print "$1$2"; } else { print; } print "
"; } print "

\n"; } &disptail; print ""; print ""; } ############################################################################# # Delete confirm mode ####################################################### ############################################################################# sub mbdel2 { &getmbdata; @resdata = grep(/^$in{resnum},/,@alldata); my $pai; ($resnumber,$rescode,$resname,$resmail,$reshost,$resdate,$ressubject,$resmain,$resencpwd,$imagefile,$pai)=split(/,/,$resdata[0]); print "Content-Type: text/html\n\n"; print < $mbdeltitle END1 if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } $titleprint=&titleprint("$mbdeltitle","$mbdel_logo","$mbdel_style","$mbdel_color","$mbdel_size","$mbdel_face","$mbdel_sel","$mbdel_loc"); print <
$titleprint END2 print "
"; @darray = split(/[^\d]/,$resdate); print ""; print "
Message#${resnumber} "; $dy = $darray[0]+1900; $resdate =~ s/^\d?\d\d([^\d]..*)$/$dy$1/; print "$resdate
"; print "From: "; if ($resmail ne ""){ print "${resname}" } else { print "$resname"; } if ($namesan_en == 1){ print "$namesan"; } if ($resmail ne ""){ print " ($resmail)" } print "
 
"; print "
"; @sub2=split(/Re:/,$ressubject); if ($#sub2 > 1){ print "Re$#sub2:$sub2[$#sub2]"; } else { print "$ressubject"; } print "
"; print ""; print ""; print ""; print "
"; $imagefile =~ s/[\r\n]*$//; if ($image_en == 1 && $imagefile ne ''){ $withimage = 'と画像'; } else { $withimage = ''; } if ($image_en == 1 && $imagefile ne ''){ $imagefile =~ /.+(\..+)$/; $tail = $1; $imagefile = "$imagedir/$imagefile"; ($imagefile,$w,$h)=&get_image_size($imagefile,$max_w,$max_h); if ($image_samewin_en == 1){ $newwin = ''; } else { $newwin = 'target="_blank"'; } print ""; } print ""; &readpai($pai); print "
"; $resmain =~ s/(<\w+>)/&convjantag($1)/ige; @mainarry=split(/<[bB][rR]>/,$resmain); foreach (@mainarry){ if(/^(\>)(.*)$/){ print "$1$2"; } else { print; } print "
"; } print "

\n"; print "上のメッセージ$withimageを削除します。
よければパスワードを入力し、削除ボタンをクリックしてください。

"; print "パスワード:"; print ""; print ""; print "

"; print "

"; print "
"; print ""; print ""; } ############################################################################# # Delete execute mode ####################################################### ############################################################################# sub mbdel3 { while(-f "$lockfile"){ sleep(1); } open(LOCK,"> $lockfile"); close(LOCK); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($time_offset); @wday_array = ('日','月','火','水','木','金','土'); $date_now = sprintf("%01d月%01d日(%s)%02d時%02d分",$mon +1,$mday,$wday_array[$wday],$hour,$min); $rmon=$mon+1; $datecode="${year}_${rmon}_${mday}"; open(FILE,"< $admindat"); $adminpwd = ; close(FILE); open(RD,"< $mbdata"); open(FILE,"> $mbdir/tmp.$$"); while(){ s/[\r\n]*$//; # instead of chop my $pai; ($number,$datecode,$name,$mail,$host,$date,$subject,$main,$encpwd,$imagefile,$pai)=split(/,/); if ($number == $in{number}){ if (((crypt($in{pwd},$encpwd) eq "$encpwd") && ($encpwd ne '')) || (crypt($in{pwd},$adminpwd) eq "$adminpwd")) { open(LOG,">>$mbdellog"); print LOG "$_\n"; close(LOG); chmod(0666,"$mbdellog"); unlink("$imagedir/$imagefile"); $error = 0; } else { print "Content-Type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "パスワードエラー\n"; print "\n"; print "\n"; if ($encpwd ne '') { print "
 
パスワードが違います。
\n"; } else { print "
 
パスワードが設定されていないので管理人のみ削除できます。
\n"; } print "\n"; print "\n"; print FILE "$_\n"; $error = 1; } } else { print FILE "$_\n"; } } close(RD); close(FILE); rename("$mbdir/tmp.$$","$mbdata"); chmod(0666,"$mbdata"); &extraupdate; unlink("$lockfile"); if ($error == 0) {print "Location: $mbread\n\n";} } ############################################################################# # Link display mode ######################################################### # メッセージ中のリンクの中でデッドリンク等でリンク表示のリストから # 除外したいメッセージナンバーをrejectlink.datに1行つづ記述してください。 ############################################################################# sub mblink { &getmbdata; if (open(REJECT,"< rejectlink.dat")){ @reject = ; close(REJECT); } else { @reject = (); } if ($compatible == 1) { $in{past} = on; $in{new} = on; if (($in{new} eq on)&&($in{past} eq on)){ `$cat $mbarchdata $mbpastdata $mbdata > $alldata`; chmod(0666,"$alldata"); $filename="$alldata"; } elsif ($in{new} eq on){ $filename="$mbdata"; } elsif ($in{past} eq on){ `$cat $mbarchdata $mbpastdata > $pastall`; chmod(0666,"$pastall"); $filename="$pastall"; } } else { $filename = $mbdata; } print "Content-Type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "$mblinktitle\n"; if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } $titleprint=&titleprint("$mblinktitle","$mblink_logo","$mblink_style","$mblink_color","$mblink_size","$mblink_face","$mblink_sel","$mblink_loc"); print "\n"; print "\n"; if (($in{m1} =~ /^[13578]$/) || ($in{m1} =~ /^1[02]$/)){ $finday = 31; } elsif (($in{m1} =~ /^[469]$/) || ($in{m1} == 11)){ $finday = 30; } elsif ($in{m1} == 2){ $finday = 28; } open(FILE,"< $filename"); while (){ chop; my $pai; ($number,$b,$c,$d,$e,$date,$title,$main,$encpwd,$imagefile,$pai)=split(/,/); if (/https?:\/\/[\w\.\~\-\/\?\&\+\=\:\@\%\;\#\%\$]*/){ foreach (split(/<[Bb][rR]>/,$main)){ # print "$_
\n"; if (/(https?:\/\/[\w\.\~\-\/\?\&\+\=\:\@\%\;\#\%\$]*)/ & !/^\>/){ # print "$_
\n"; $linkarray2 .= "$1
"; } } if($linkarray2 ne ""){ ($aaa)=grep(/^$number/,@reject); if ($aaa != $number){ push(@numarray,$number); push(@datearray,$date); push(@titlearray,$title); push(@linkarray,$linkarray2); } } $linkarray2=""; } } close(FILE); print "$titleprint\n"; print "
麻雀掲示板中にあるURLを抜粋して表\\示してあります。
デッドリンク、重複しているものは除外していますが、残っている場合もあります。
Message#の番号をクリックするとそのメッセージが表\\示されます。

\n"; &disphead(1); print "


"; print "
    \n"; for($i=$#linkarray;$i>=0;$i=$i-1){ print "
  • #$numarray[$i],"; $subject = $titlearray[$i]; # $subject =~ s/,(\d)/,$1/g; @sub2=split(/Re:/,$subject); if ($#sub2 > 1){ print "Re$#sub2:$sub2[$#sub2]
    \n"; } else { print "$subject
    \n"; } # print "
  • #$numarray[$i], $titlearray[$i]
    \n"; foreach $url (split(/<[Bb][Rr]>/,$linkarray[$i])){ # $url =~ s/,(\d)/,$1/g; if ($link_samewin_en == 1){ $link_target = '_top'; } else { $link_target = '_blank'; } print "$url
    "; } print "

  • \n"; } print "
\n"; print "
\n"; &disptail; print ""; } ############################################################################# # Summary Form mode ######################################################### ############################################################################# sub mbsumform { &getmbdata; ($num,$datecode,@dum)=split(/,/,$alldata[$#alldata]); $datecode =~ /^(\d\d+)_\d+_\d+/; $finyear = $1; if ($compatible == 0){ open(FILE,"< $mbdata"); $firstdata = ; close(FILE); } else { open(FILE,"< $mbarchdata") || open(FILE,"< $mbpastdata") || open(FILE,"< $mbdata"); $firstdata = ; close(FILE); } ($num,$datecode,@dum)=split(/,/,$firstdata); $datecode =~ /^(\d\d+)_/; $firstyear = $1; $titleprint=&titleprint("$mbsumtitle","$mbsum_logo","$mbsum_style","$mbsum_color","$mbsum_size","$mbsum_face","$mbsum_sel","$mbsum_loc"); print "Content-Type:text/html\n\n"; print < $mbsumtitle END if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } print <
$titleprint
参照対象  
全部  Message# から まで
日付が
個人名方式   名前  人物 (印のみ有効) 同一人物設定
日毎の集計
トップ100 書き込み量の上位100
件数対日数 日数を件数でソ\\ート
時間帯集計 時間帯毎の書き込みの量
曜日毎集計 曜日毎の書き込みの量
月毎の集計 毎月の書き込みの量
年毎の集計 毎年の書き込みの量
ぴったり賞 Message#100, 777, 等に当たった人
個人別集計 名前別書き込みの量
月間個人別集計
年間個人別集計
月間トップ3 歴代の月間トップ3
個人最終書き込み 特定の名前で最後に書き込んだ日
     

麻雀掲示板へ  個人データ詳細

END5 } ############################################################################# # Summary personal Form mode ################################################ ############################################################################# sub mbsumpsnl { &getmbdata; ($num,$datecode,@dum)=split(/,/,$alldata[$#alldata]); $datecode =~ /^(\d\d+)_\d+_\d+/; $finyear = $1; if ($compatible == 0){ open(FILE,"< $mbdata"); $firstdata = ; close(FILE); } else { open(FILE,"< $mbarchdata") || open(FILE,"< $mbpastdata") || open(FILE,"< $mbdata"); $firstdata = ; close(FILE); } ($num,$datecode,@dum)=split(/,/,$firstdata); $datecode =~ /^(\d\d+)_/; $firstyear = $1; print "Content-Type:text/html\n\n"; $titleprint=&titleprint('個人データ詳細',"$mbsum_logo","$mbsum_style","$mbsum_color","$mbsum_size","$mbsum_face","$mbsum_sel","$mbsum_loc"); print < 個人データ詳細 END if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } print <
$titleprint
参照対象  
全部  Message# から まで
日付が
個人名方式   名前  人物 同一人物設定
名前  
日毎の集計
トップ30 書き込み量の上位30
件数対日数 日数を件数でソ\\ート
時間帯集計 時間帯毎の書き込みの量
曜日毎集計 曜日毎の書き込みの量
月毎の集計 毎月の書き込みの量
年毎の集計 毎年の書き込みの量
     

麻雀掲示板へ  書き込み統計へ

END3 } ############################################################################# # Summary mode ############################################################## ############################################################################# sub mbsum { ($filename,$tmpdata) = &gentmpdata; %sum_item_titles = ( 'data1', '日毎の集計', 'data1a', 'トップ100', 'data1b', '件数対日数', 'data2', '時間帯集計', 'data3', '曜日毎集計', 'data4', '月毎の集計', 'data4a', '年毎の集計', 'data5', 'ぴったり賞', 'data6', '個人データ集計', 'data6a', '月間個人別集計', 'data6b', '年間個人別集計', 'data6c', '歴代月間トップ3', 'data7', '個人最終書き込み', 'data10', '日ごとのデータ集計', 'data11', '書き込みトップ30', 'data12', '件数対日数', 'data13', '時間帯集計', 'data14', '曜日毎集計', 'data15', '毎月の書き込み集計', 'data15a', '毎年の書き込み集計', ); $titleprint=&titleprint("$sum_item_titles{$in{choise}}","$mbsum_logo","$mbsum_style","$mbsum_color","$mbsum_size","$mbsum_face","$mbsum_sel","$mbsum_loc"); print "Content-Type: text/html\n\n"; print < $mbsumtitle SUM_HEAD if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } print "\n"; $rightend = 400; if ($in{choise} eq data1){ print "$titleprint\n"; &subtitle; print "
\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,@line)=split(/,/); if ($date =~ /^${in{y1}}_${in{m1}}_/){ $count{$date}++; $total++; } } close(FILE); for ($i=1;$i<=$finday;$i++){ $date="${in{y1}}_${in{m1}}_${i}"; printf("%04d/%02d/%02d | ",$in{y1}+1900,$in{m1},$i); $linemax = 40; $width=($count{$date}/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$count{$date};$j++){ # print "*"; # } if ($count{$date} eq ""){$count{$date}=0;} print " $count{$date}
"; } $mean=$total/$finday; print "---------------------
"; print "トータル=$total件、 一日平均="; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data1a){ print "$titleprint\n"; &subtitle; print "
\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,@line)=split(/,/); $count{$date}++; $total++; } close(FILE); $i=0; foreach (keys(%count)){ $content{"${count{$_}}_${i}"}="$_"; $i++; } @tmp=keys(%content); @tmp1=reverse(sort({$a<=>$b}@tmp)); @sortdata=splice(@tmp1,0,100); foreach $number (@sortdata){ $date=$content{$number}; ($yy,$mm,$dd,$dummy)=split(/_/,$date); printf("%04d/%02d/%02d | ",$yy+1900,$mm,$dd); $linemax = 60; $width=($count{$date}/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$number;$j++){ # print "*"; # } if ($number eq ""){$number=0;} print " $count{$date}
"; } $mean=$total/$finday; print "---------------------
"; print "トータル=$total件、 一日平均="; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data1b){ print "$titleprint\n"; &subtitle; print "
\n"; open(FILE,"< $filename"); $i=0; while (){ chop; ($num,$date,@line)=split(/,/); if ($i==0){$date1=$date;$num0=$num;} $count{$date}++; $i++; } close(FILE); ($yyy,$mmm,$ddd)=split(/_/,$date1); ($yyy2,$mmm2,$ddd2)=split(/_/,$date); @timetmp=gmtime($time_offset); $firstline=&timelocal(0,0,0,$ddd,$mmm-1,$yyy,$timetmp[6],$timetmp[7],$timetmp[8]); $endline=&timelocal(0,0,0,$ddd2,$mmm2-1,$yyy2,$timetmp[6],$timetmp[7],$timetmp[8]); @tmp=sort {$a<=>$b} values(%count); $max=$tmp[$#tmp]; $total=$#tmp+1; $yyyy = $yyy; $yyyy2 = $yyy2; $yyy=$yyy+1900; $yyy2=$yyy2+1900; print "$yyy年$mmm月$ddd日から$yyy2年$mmm2月$ddd2日まで

"; for ($i=0;$i<=$max;$i++){ @dnum=grep(/^$i$/,@tmp); $value=$#dnum+1; if ($i==0){ for($y=$yyyy;$y<=$yyyy2;$y++){ for($m=1;$m<=12;$m++){ if (($m =~ /^[13578]$/) || ($m =~ /^1[02]$/)){ $finday = 31; } elsif (($m =~ /^[469]$/) || ($m == 11)){ $finday = 30; } elsif ($m == 2){ $finday = 28; } for($d=1;$d<=$finday;$d++){ $curline=&timelocal(0,0,0,$d,$m-1,$y,$timetmp[6],$timetmp[7],$timetmp[8]); if (($curline < $firstline)||($curline > $endline)){next;} if ($count{"${y}_${m}_${d}"} eq ""){ $value++; } if ($date eq "${y}_${m}_${d}"){last;} } if ($date eq "${y}_${m}_${d}"){last;} } if ($date eq "${y}_${m}_${d}"){last;} } $gtotal=$value; } printf("%02d件 | ",$i); $linemax=600; $width=($value/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$value;$j=$j+5){ # print "*"; # } $num2 = $num2+$value*$i; $mean1=($value/($total+$gtotal))*100; print " $value日"; printf(" (%3.2f%%)
",$mean1); } $total=$total+$gtotal; $mean=($total/($num2))*24; print "---------------------
"; print "トータル=$total日、$num2件、 投稿平均間隔="; printf("%3.2f",$mean); print "時間
"; } if ($in{choise} eq data2){ if (($in{new} eq on)&&($in{past} eq on)){ $inc=10; } elsif ($in{new} eq on){ $inc=1; } elsif ($in{past} eq on){ $inc=10; } print "$titleprint\n"; &subtitle; print "

\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if ($today =~ /(\d\d)時\d\d分$/){ $count[$1]++; $total++; } } close(FILE); @tmp=sort {$a <=> $b} @count; $linemax=$tmp[$#tmp]; for($i=0;$i<=23;$i++){ printf("%02d時〜%02d時 | ",$i,$i+1); if ($linemax == 0){last;} $width=($count[$i]/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$count[$i];$j=$j+$inc){ # print "*"; # } if ($total == 0){last;} $pars=($count[$i]/$total)*100; if ($count[$i] eq ""){$count[$i] = 0;} print " $count[$i]"; printf(" (%2.2f%%)
\n",$pars); } print "---------------------
"; print "トータル=$total件
"; } if ($in{choise} eq data3){ if (($in{new} eq on)&&($in{past} eq on)){ $inc=20; } elsif ($in{new} eq on){ $inc=1; } elsif ($in{past} eq on){ $inc=20; } print "$titleprint\n"; &subtitle; print "
\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if ($today =~ /\((.*)\)\d\d時\d\d分$/){ $count{$1}++; $total++; } } close(FILE); @tmp=sort {$a <=> $b} values(%count); $linemax=$tmp[$#tmp]; foreach $week ('日','月','火','水','木','金','土'){ printf("%s | ",$week); if ($linemax == 0){last;} $width=($count{$week}/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$count{$week};$j=$j+$inc){ # print "*"; # } if ($count{$week} eq ""){$count{$week}=0;} if ($total == 0){$last;} $pars=($count{$week}/$total)*100; print " $count{$week}\n"; printf(" (%2.2f%%)
\n",$pars); } print "---------------------
"; print "トータル = $total件
\n"; } if ($in{choise} eq data4){ $inc=10; print "$titleprint\n"; &subtitle; print "
\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,@line)=split(/,/); $date =~ s/^(\d?\d\d_\d?\d)_\d?\d$/$1/; $count{$date}++; $total++; } close(FILE); @item=keys(%count); @item1=(); foreach (@item){ s/^(\d?\d\d)_(\d)$/${1}0$2/; s/^(\d?\d\d)_(\d\d)$/$1$2/; push(@item1,$_); } @item1=sort {$a <=> $b} @item1; @tmp=sort {$a <=> $b} values(%count); $linemax= $tmp[$#tmp]; foreach $date (@item1){ $date =~ s/^(\d?\d\d)([1-9]\d)$/${1}_$2/; $date =~ s/^(\d?\d\d)0(\d)$/${1}_$2/; ($yy,$mm)=($1,$2); printf("%04d年%02d月 | ",$yy+1900,$mm); if ($linemax == 0){last;} $width=($count{$date}/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$count{$date};$j=$j+$inc){ # print "*"; # } if ($count{$date} eq ""){$count{$date}=0;} print " $count{$date}
"; } $mean=$total/($#item+1); print "---------------------
"; print "トータル=$total件、 月平均="; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data4a){ $inc=10; print "$titleprint\n"; &subtitle; print "
\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,@line)=split(/,/); $date =~ s/^(\d?\d\d)_\d?\d_\d?\d/$1/; $count{$date}++; $total++; # print "$date
\n"; } close(FILE); @item=keys(%count); @item1=@item; # @item1=(); # foreach (@item){ # s/^(\d?\d\d)_/$1/; # push(@item1,$_); # } @item1=sort {$a <=> $b} @item1; @tmp=sort {$a <=> $b} values(%count); $linemax=$tmp[$#tmp]; foreach $date (@item1){ printf("%04d年 | ",$date+1900); if ($linemax == 0){last;} $width=($count{$date}/$linemax)*$rightend; if ($width != 0){ print "\n"; } if ($count{$date} eq ""){$count{$date}=0;} print " $count{$date}
"; } $mean=$total/($#item+1); print "---------------------
"; print "トータル=$total件、 年平均="; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data5){ print "$titleprint\n"; &subtitle; print "
\n"; # @period=(1,100,111,200,222,300,333,400,444,500,555,600,666,700,777,800,888,900,999,1000,1111,1234,2000,2222,2345,3000,3333,3456,4000,4321,4444,4567,5000,5555,5678,6000,6666,6789,7000,7777,8000,8888,9000,9999,10000); open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if (grep(/^$num$/,@period) ne ""){ $pname{$num}=$name; $date =~ s/^(\d?\d\d)_\d?\d_\d?\d$/$1/; $today2=$today; $today2 =~ s/^(\d\d?\d?)..*/$1/; if ($today2 != $date){ $date =~ s/^(\d?\d\d)_\d?\d_\d?\d$/$1/; # $ptoday{$num}=sprintf("%s年%s",$date+1900,$today); } else { @darray = split(/[^\d]/,$today); @tmpaaa = split(/日[^\)]/,$today); $date=$darray[0]; $today=sprintf("%s月%s日(%s",$darray[2],$darray[4],$tmpaaa[1]); # $ptoday{$num}=$today; } $ptoday{$num}=sprintf("%s年%s",$date+1900,$today); } } close(FILE); print ""; foreach $number (reverse(@period)){ if ($pname{$number} eq ""){next;} if ($in{perso} eq "nokeep"){ $name=&checkname($pname{$number}); } else { $name = $pname{$number} } print ""; printf("",$number,$name,$ptoday{$number}); print "\n"; } print "
Message# %d%s%s
"; } if ($in{choise} eq data6){ if (($in{new} eq on)&&($in{past} eq on)){ $inc=25; } elsif ($in{new} eq on){ $inc=1; } elsif ($in{past} eq on){ $inc=25; } print "$titleprint\n"; &subtitle; print "
\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if ($in{perso} eq "nokeep"){$name=&checkname($name);} $count{$name}++; $total++; } close(FILE); $i=0; foreach (keys(%count)){ $content{"${count{$_}}_${i}"}="$_"; $i++; } @tmp=keys(%content); @sortdata=reverse(sort({$a<=>$b}@tmp)); print "\n"; foreach $data (@sortdata){ print ""; print " \n"; $data =~ s/^(\d\d*)_\d\d*/$1/; print ""; print ""; } print "
$content{$data}"; $linemax=$sortdata[0]; if ($linemax == 0){last;} $width=($data/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$data;$j=$j+$inc){ # print "*"; # } if ($total == 0){last;} $pars=($data/$total)*100; print " $data"; printf(" (%3.2f%%)",$pars); print "
"; $people=$#sortdata+1; print "
"; print "トータル=$total件、 延べ人数="; print "$people"; print "人、一人平均="; if ($people == 0){$people=1;} $mean=$total/$people; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data6a){ $inc=2; print "$titleprint\n"; &subtitle; print "
\n"; $realy=$in{y2}+1900; print "$realy年$in{m2}月のデータ

"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if ($date =~ /^$in{y2}_$in{m2}_\d\d?$/){ if ($in{perso} eq "nokeep"){$name=&checkname($name);} $count{$name}++; $total++; } } close(FILE); $i=0; foreach (keys(%count)){ $content{"${count{$_}}_${i}"}="$_"; $i++; } @tmp=keys(%content); @sortdata=reverse(sort({$a<=>$b}@tmp)); $linemax=$sortdata[0]; print "\n"; foreach $data (@sortdata){ print ""; print " \n"; $data =~ s/^(\d\d*)_\d\d*/$1/; print ""; print ""; } print "
$content{$data}"; if ($linemax == 0){last;} $width=($data/$linemax)*400; if ($width != 0){ print "\n"; } # for($j=0;$j<$data;$j=$j+$inc){ # print "*"; # } if ($total == 0){last;} $pars=($data/$total)*100; print " $data"; printf(" (%3.2f%%)",$pars); print "
"; $people=$#sortdata+1; print "
"; print "トータル=$total件、 延べ人数="; print "$people"; print "人、一人平均="; if ($people == 0){$people=1;} $mean=$total/$people; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data6b){ $inc=20; print "$titleprint\n"; &subtitle; print "

\n"; $realy=$in{y3}+1900; print "$realy年のデータ

"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if ($date =~ /^$in{y3}_\d\d?_\d\d?$/){ $name1=$name; if ($in{perso} eq "nokeep"){$name=&checkname($name);} $count{$name}++; $total++; } } close(FILE); $i=0; foreach (keys(%count)){ $content{"${count{$_}}_${i}"}="$_"; $i++; } @tmp=keys(%content); @sortdata=reverse(sort({$a<=>$b}@tmp)); $linemax=$sortdata[0]; print "\n"; foreach $data (@sortdata){ print ""; print " \n"; $data =~ s/^(\d\d*)_\d\d*/$1/; print ""; print ""; } print "
$content{$data}"; if ($linemax == 0){last;} $width=($data/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$data;$j=$j+$inc){ # print "*"; # } if ($total == 0){last;} $pars=($data/$total)*100; print " $data"; printf(" (%3.2f%%)",$pars); print "
"; $people=$#sortdata+1; print "
"; print "トータル=$total件、 延べ人数="; print "$people"; print "人、一人平均="; if ($people == 0){$people=1;} $mean=$total/$people; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data6c){ $inc=2; print "$titleprint\n"; &subtitle; print "

\n"; print ""; print ""; print ""; print ""; print ""; print ""; open(FILE,"< $filename"); $j=0; while () { chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if ($in{perso} eq "nokeep"){$name=&checkname($name);} $date =~ s/^(\d?\d\d_\d\d?)_\d\d?$/$1/; if ($lastmon ne '' && $lastmon ne $date){ &mktbl; $j=$j+1; undef %count; undef %content; } $count{"$name"}++; $total++; $lastmon=$date; } close(FILE); &mktbl; for($i=$j;$i>=0;$i=$i-1){ ($ym,$a1,$a2,$b1,$b2,$c1,$c2)=split(/\,/,$tbl[$i]); ($yyy,$mmm)=split(/_/,$ym); $yyy=$yyy+1900; print ""; print ""; print ""; print ""; print ""; } print "
1位2位3位
$yyy年$mmm月$a1
$a2件
$b1
$b2件
$c1
$c2件
"; } sub mktbl { $i=0; foreach (keys(%count)){ $content{"${count{$_}}_$i"}="$_"; $i++; } @tmp = keys(%content); @tmp1 = reverse(sort {$a<=>$b} @tmp); $top=$tmp1[0]; $top =~ s/^(\d\d*)_\d\d*$/$1/; $second=$tmp1[1]; $second =~ s/^(\d\d*)_\d\d*$/$1/; $third=$tmp1[2]; $third =~ s/^(\d\d*)_\d\d*$/$1/; $tbl[$j]="$lastmon,$content{$tmp1[0]},$top,$content{$tmp1[1]},$second,$content{$tmp1[2]},$third"; } if ($in{choise} eq data7){ print "$titleprint\n"; &subtitle; print "
\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); $date =~ s/_(\d_\d?\d)$/_0${1}/; $date =~ s/_(\d\d_)(\d)$/_${1}0${2}/; $date =~ s/^(9\d_\d\d_\d\d)$/0${1}/; $date2=$date; $date =~ s/^(\d?\d\d)_\d?\d_\d?\d$/$1/; $today2=$today; $today2 =~ s/^(\d\d?\d?)..*/$1/; if ($in{perso} eq "nokeep"){$name=&checkname($name);} if ($today2 != $date){ $count{$name}=sprintf("%s_%s年%s_%s",$date2,$date,$today,$num); } else { $count{$name}="${date2}_${today}_${num}"; } } close(FILE); foreach (keys(%count)){ $content{"$count{$_}"}="$_"; } @tmp=keys(%content); @sortdata=reverse(sort(@tmp)); print ""; foreach $today (@sortdata){ $today2 = $today; $today2 =~ s/^\d?\d\d_\d\d_\d\d_(..*)_(\d\d*)$/$1/; @darray = split(/[^\d]/,$today2); @tmpaaa = split(/日[^\)]/,$today2); $datex=$darray[0]; $tx=sprintf("%s月%s日(%s",$darray[2],$darray[4],$tmpaaa[1]); $today2=sprintf("%s年%s",$datex+1900,$tx); $mesnum=$2; print "\n"; } print "
$content{$today}$today2 #$mesnum
"; } if ($in{choise} eq data10){ print "$titleprint\n"; &subtitle; print "
\n"; print "$in{hname}」での集計

\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,@line)=split(/,/); if ($in{perso} eq "nokeep"){ $name=&checkname($name); $hname=&checkname($in{hname}); } else { $hname=$in{hname}; } if ($name eq $hname){ if ($date =~ /^${in{y1}}_${in{m1}}_/){ $count{$date}++; $total++; } } } close(FILE); for ($i=1;$i<=$finday;$i++){ $date="${in{y1}}_${in{m1}}_${i}"; printf("%04d/%02d/%02d | ",$in{y1}+1900,$in{m1},$i); $linemax=40; $width=($count{$date}/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$count{$date};$j++){ # print "*"; # } if ($count{$date} eq ""){$count{$date}=0;} print " $count{$date}
"; } $mean=$total/$finday; print "---------------------
"; print "トータル=$total件、 一日平均="; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data11){ print "$titleprint\n"; &subtitle; print "

\n"; print "$in{hname}」での集計

\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,@line)=split(/,/); if ($in{perso} eq "nokeep"){ $name=&checkname($name); $hname=&checkname($in{hname}); } else { $hname=$in{hname}; } if ($name eq $hname){ $count{$date}++; $total++; } } close(FILE); $i=0; foreach (keys(%count)){ $content{"${count{$_}}_${i}"}="$_"; $i++; } @tmp=keys(%content); @tmp1=reverse(sort({$a<=>$b}@tmp)); @sortdata=splice(@tmp1,0,30); foreach $number (@sortdata){ $date=$content{$number}; ($yy,$mm,$dd,$dummy)=split(/_/,$date); printf("%04d/%02d/%02d | ",$yy+1900,$mm,$dd); $linemax=20; $width=($number/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$number;$j++){ # print "*"; # } if ($number eq ""){$number=0;} print " $count{$date}
"; } $mean=$total/$finday; print "---------------------
"; print "トータル=$total件、 一日平均="; printf("%3.2f",$mean); print "件
"; } if ($in{choise} eq data12){ print "$titleprint\n"; &subtitle; print "

\n"; print "$in{hname}」での集計

\n"; open(FILE,"< $filename"); $i=0; while (){ chop; ($num,$date,$name,@line)=split(/,/); if ($in{perso} eq "nokeep"){ $name=&checkname($name); $hname=&checkname($in{hname}); } else { $hname=$in{hname}; } if ($name eq $hname){ if ($i==0){$date1=$date;$num0=$num;} $count{$date}++; $i++; } } close(FILE); ($yyy,$mmm,$ddd)=split(/_/,$date1); ($yyy2,$mmm2,$ddd2)=split(/_/,$date); @timetmp=gmtime($time_offset); $firstline=&timelocal(0,0,0,$ddd,$mmm-1,$yyy,$timetmp[6],$timetmp[7],$timetmp[8]); $endline=&timelocal(0,0,0,$ddd2,$mmm2-1,$yyy2,$timetmp[6],$timetmp[7],$timetmp[8]); @tmp=sort {$a<=>$b} values(%count); $max=$tmp[$#tmp]; $total=$#tmp+1; $yyy = $yyy + 1900; $yyy2 = $yyy2 + 1900; print "$yyy年$mmm月$ddd日から$yyy2年$mmm2月$ddd2日まで

"; for ($i=0;$i<=$max;$i++){ @dnum=grep(/^$i$/,@tmp); $value=$#dnum+1; if ($i==0){ for($y=$yyy-1900;$y<=$yyy2-1900;$y++){ for($m=1;$m<=12;$m++){ if (($m =~ /^[13578]$/) || ($m =~ /^1[02]$/)){ $finday = 31; } elsif (($m =~ /^[469]$/) || ($m == 11)){ $finday = 30; } elsif ($m == 2){ $finday = 28; } for($d=1;$d<=$finday;$d++){ $curline=&timelocal(0,0,0,$d,$m-1,$y,$timetmp[6],$timetmp[7],$timetmp[8]); if (($curline < $firstline)||($curline > $endline)){next;} if ($count{"${y}_${m}_${d}"} eq ""){ $value++; } if ($date eq "${y}_${m}_${d}"){last;} } if ($date eq "${y}_${m}_${d}"){last;} } if ($date eq "${y}_${m}_${d}"){last;} } $gtotal=$value; } $linemax=2000; printf("%02d件 | ",$i); $width=($value/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$value;$j=$j+5){ # print "*"; # } $num2 = $num2+$value*$i; $mean1=($value/($total+$gtotal))*100; print " $value日"; printf(" (%3.2f%%)
",$mean1); } $total=$total+$gtotal; $mean=($total/($num2))*24; print "---------------------
"; print "トータル=$total日、$num2件、 投稿平均間隔="; printf("%3.2f",$mean); print "時間
"; } if ($in{choise} eq data13){ if (($in{new} eq on)&&($in{past} eq on)){ $inc=5; } elsif ($in{new} eq on){ $inc=1; } elsif ($in{past} eq on){ $inc=5; } print "$titleprint\n"; &subtitle; print "

\n"; print "$in{hname}」での集計

\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if ($in{perso} eq "nokeep"){ $name=&checkname($name); $hname=&checkname($in{hname}); } else { $hname=$in{hname}; } if ($name eq $hname){ if ($today =~ /(\d\d)時\d\d分$/){ $count[$1]++; $total++; } } } close(FILE); @tmp = sort {$a <=> $b} @count; $linemax=$tmp[$#tmp]; for($i=0;$i<=23;$i++){ printf("%02d時〜%02d時 | ",$i,$i+1); if ($linemax == 0){last;} $width=($count[$i]/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$count[$i];$j=$j+$inc){ # print "*"; # } if ($total == 0){last;} $pars=($count[$i]/$total)*100; if ($count[$i] eq ""){$count[$i] = 0;} print " $count[$i]"; printf(" (%2.2f%%)
\n",$pars); } print "---------------------
"; print "トータル=$total件
"; } if ($in{choise} eq data14){ if (($in{new} eq on)&&($in{past} eq on)){ $inc=5; } elsif ($in{new} eq on){ $inc=1; } elsif ($in{past} eq on){ $inc=5; } print "$titleprint\n"; &subtitle; print "

\n"; print "$in{hname}」での集計

\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,$mail,$host,$today,@line)=split(/,/); if ($in{perso} eq "nokeep"){ $name=&checkname($name); $hname=&checkname($in{hname}); } else { $hname=$in{hname}; } if ($name eq $hname){ if ($today =~ /\((.*)\)\d\d時\d\d分$/){ $count{$1}++; $total++; } } } close(FILE); @tmp = sort {$a <=> $b} values(%count); $linemax=$tmp[$#tmp]; foreach $week ('日','月','火','水','木','金','土'){ printf("%s | ",$week); if ($linemax == 0){last;} $width=($count{$week}/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$count{$week};$j=$j+$inc){ # print "*"; # } if ($count{$week} eq ""){$count{$week}=0;} if ($total == 0){last;} $pars=($count{$week}/$total)*100; print " $count{$week}\n"; printf(" (%2.2f%%)
\n",$pars); } print "---------------------
"; print "トータル = $total件
\n"; } if ($in{choise} eq data15){ $inc=2; print "$titleprint\n"; &subtitle; print "

\n"; print "$in{hname}」での集計

\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,@line)=split(/,/); if ($in{perso} eq "nokeep"){ $name=&checkname($name); $hname=&checkname($in{hname}); } else { $hname=$in{hname}; } $date =~ s/^(\d?\d\d_\d?\d)_\d?\d$/$1/; $count{$date}++; $total++; if ($name eq $hname){ $personal{$date}++; $ptotal++; } } close(FILE); @item=keys(%count); @item1=(); foreach (@item){ s/^(\d?\d\d)_(\d)$/${1}0$2/; s/^(\d?\d\d)_(\d\d)$/$1$2/; push(@item1,$_); } @item1=sort {$a <=> $b} @item1; $flag = 0; @tmp = sort {$a <=> $b} values(%personal); $linemax=$tmp[$#tmp]; foreach $date (@item1){ $date =~ s/^(\d?\d\d)([1-9]\d)$/${1}_$2/; $date =~ s/^(\d?\d\d)0(\d)$/${1}_$2/; ($yy,$mm)=($1,$2); if ($personal{$date} == 0 && $flag == 0){next;} printf("%04d年%02d月 | ",$yy+1900,$mm); if ($linemax == 0){last;} $width=($personal{$date}/$linemax)*$rightend; if ($width != 0){ print "\n"; } # for($j=0;$j<$personal{$date};$j=$j+$inc){ # print "*"; # } if ($count{$date} != 0){ $pers=($personal{$date}/$count{$date})*100; } else { $pers=0; } if ($personal{$date} eq ""){$personal{$date}=0;} print " $personal{$date}"; printf(" (%3.2f%%)
\n",$pers); # if ($personal{$date} == 0 && $flag == 0){next;} $flag = 1; $item3++; $p2total = $p2total + $count{$date}; } # $mean1=$total/($#item+1); if ($total != 0){$pers2=($ptotal/$total)*100;} if ($p2total != 0){$pers1=($ptotal/$p2total)*100;} if ($item3 != 0){$mean2=$ptotal/$item3;} print "---------------------
"; print "トータル=$ptotal件、 初書き込み以来月平均="; printf("%3.2f",$mean2); print "件、
"; print "初書き込み以来全体の"; printf("%3.2f%%、",$pers1); print "全書き込みの"; printf("%3.2f%%",$pers2); print "
\n"; } if ($in{choise} eq data15a){ $inc=2; print "$titleprint\n"; &subtitle; print "

\n"; print "$in{hname}」での集計

\n"; open(FILE,"< $filename"); while (){ chop; ($num,$date,$name,@line)=split(/,/); if ($in{perso} eq "nokeep"){ $name=&checkname($name); $hname=&checkname($in{hname}); } else { $hname=$in{hname}; } $date =~ s/^(\d?\d\d)_\d?\d_\d?\d$/$1/; $count{$date}++; $total++; if ($name eq $hname){ $personal{$date}++; $ptotal++; } } close(FILE); @item=keys(%count); @item1=@item; # @item1=(); # foreach (@item){ # s/^(\d?\d\d)_(\d)$/${1}0$2/; # s/^(\d?\d\d)_(\d\d)$/$1$2/; # push(@item1,$_); # } @item1=sort {$a <=> $b} @item1; $flag = 0; @tmp = sort {$a <=> $b} values(%personal); $linemax=$tmp[$#tmp]; foreach $date (@item1){ # $date =~ s/(\d?\d\d)([1-9]\d)/${1}_$2/; # $date =~ s/(\d?\d\d)0(\d)/${1}_$2/; $yy=$date; if ($personal{$date} == 0 && $flag == 0){next;} printf("%04d年 | ",$yy+1900); if ($linemax == 0){last;} $width=($personal{$date}/$linemax)*$rightend; if ($width != 0){ print "\n"; } $pers=($personal{$date}/$count{$date})*100; if ($personal{$date} eq ""){$personal{$date}=0;} print " $personal{$date}"; printf(" (%3.2f%%)
\n",$pers); # if ($personal{$date} == 0 && $flag == 0){next;} $flag = 1; $item3++; $p2total = $p2total + $count{$date}; } # $mean1=$total/($#item+1); if ($item3 != 0){$mean2=$ptotal/$item3;} if ($p2total != 0){$pers1=($ptotal/$p2total)*100;} if ($total != 0){$pers2=($ptotal/$total)*100;} print "---------------------
"; print "トータル=$ptotal件、 初書き込み以来年平均="; printf("%3.2f",$mean2); print "件、
"; print "初書き込み以来全体の"; printf("%3.2f%%、",$pers1); print "全書き込みの"; printf("%3.2f%%",$pers2); print "
\n"; } print "

\n"; print ""; if ($in{ref} eq 'part' || $in{ref} eq 'timeframe' || $compatible == 1){ unlink("$tmpdata"); } exit; sub subtitle { if ($in{ref} eq 'part'){ print "Message#$in{startnum}から$in{endnum}まで

\n"; } elsif ($in{ref} eq 'timeframe'){ $fullsty=$in{styear}+1900; $fulledy=$in{endyear}+1900; print "$fullsty年$in{stmon}月$in{stday}日から$fulledy年$in{endmon}月$in{endday}日まで

\n"; } } } sub gentmpdata { local($filename,$tmpdata); $tmpdata = "$mbdir/tmp.$$"; if ($compatible == 1) { `$cat $mbarchdata $mbpastdata $mbdata > $alldata`; chmod(0666,"$alldata"); $filename="$alldata"; } else { $filename = $mbdata; } if (($in{m1} =~ /^[13578]$/) || ($in{m1} =~ /^1[02]$/)){ $finday = 31; } elsif (($in{m1} =~ /^[469]$/) || ($in{m1} == 11)){ $finday = 30; } elsif ($in{m1} == 2){ $finday = 28; } if ($in{ref} eq 'part'){ open(ALLFILE,"< $filename"); open(TMPFILE,"> $tmpdata"); while(){ ($num,@dum)=split(/,/); if ($num >= $in{startnum} && $num <= $in{endnum}){ print TMPFILE; } if ($num > $in{endnum}){last;} } close(ALLFILE); close(TMPFILE); $filename=$tmpdata; } elsif ($in{ref} eq 'timeframe'){ open(ALLFILE,"< $filename"); open(TMPFILE,"> $tmpdata"); @timetmp=gmtime($time_offset); $firstline=&timelocal(0,0,0,$in{stday},$in{stmon}-1,$in{styear},$timetmp[6],$timetmp[7],$timetmp[8]); $endline=&timelocal(0,0,0,$in{endday},$in{endmon}-1,$in{endyear},$timetmp[6],$timetmp[7],$timetmp[8]); while(){ ($num,$datecode,@dum)=split(/,/); ($cury,$curm,$curd)=split(/_/,$datecode); $curline=&timelocal(0,0,0,$curd,$curm-1,$cury,$timetmp[6],$timetmp[7],$timetmp[8]); if (($curline >= $firstline)&&($curline <= $endline)){ print TMPFILE; } if ($curline > $endline){last;} } close(ALLFILE); close(TMPFILE); $filename=$tmpdata; } return ($filename,$tmpdata); } # 統計の個人名方式で「人物」を選んだ場合に違う名前を同一人物と # 判断させることができます。 # namedef.datにそれらの名前を人物ごとに1行に登録されていると # 一番左の名前が代表として表示されます。 # 例:以下はnamedef.datの内容の例です。 #   ---------------------------------------- #   管理人,作成者,かんりにん #   ホークス,hawks #   ---------------------------------------- # この例では、「作成者」「かんりにん」共に「管理人」と同一人物として # まとめて集計されます。 # 「ホークス」は改行されているので管理人と別人として判断されますが、 # 「hawks」とは同一人物となります。 # namedef.datがない場合は、書き込みの名前そのままで集計されます。 sub checkname { local($name)=@_; open(NAMES,"< $namedef") || return($name); while(){ s/[\r\n]*$//; # instead of chop; (@nicknames)=split(/,/); foreach $nick (@nicknames){ if ("$name" eq "$nick"){ close(NAMES); return($nicknames[0]); } } } close(NAMES); return($name); } ############################################################################# # Search Form mode ########################################################## ############################################################################# sub mbschform { &getmbdata; ($num,$datecode,@dum)=split(/,/,$alldata[$#alldata]); $datecode =~ /^(\d\d+)_\d+_\d+/; $finyear = $1; if ($compatible == 0){ open(FILE,"< $mbdata"); $firstdata = ; close(FILE); } else { open(FILE,"< $mbarchdata") || open(FILE,"< $mbpastdata") || open(FILE,"< $mbdata"); $firstdata = ; close(FILE); } ($num,$datecode,@dum)=split(/,/,$firstdata); $datecode =~ /^(\d\d+)_/; $firstyear = $1; print "Content-Type:text/html\n\n"; print < $mbsrctitle END if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } $titleprint=&titleprint("$mbsrctitle","$mbsrc_logo","$mbsrc_style","$mbsrc_color","$mbsrc_size","$mbsrc_face","$mbsrc_sel","$mbsrc_loc"); print <

$titleprint
  • ブランクにしている項目は無視されます。
  • 本文中に「>」でインデントされている部分(返事のための引用部)は検索しません。
  • 検索結果は1ページで表\\示されるので大量にマッチする検索は表\\示に時間がかかります。
検索範囲
全部  Message# から まで
日付が
名前でサーチ
AND  OR
タイトルでサーチ
AND  OR
本文でサーチ
AND  OR

AND  OR

   

麻雀掲示板へ

END2 } ############################################################################# # Search mode ############################################################### ############################################################################# sub mbsearch { print "Content-Type: text/html\n\n"; @tmparry=split(/&/,$data); foreach $string (@tmparry){ ($key,$value)=split(/=/,$string); # $value =~ tr/+/ /; # 正規表現のスペシャルな文字に関してエスケープする。 # \=%5C, (=%28, )=%29, [=%5B, ]=%5D, |=%7C # ?=%3F, +=%2B, ^=%5E, $=%24, {=%7B, }=%7D # 圭=%8C%5C、表=%95%5C、ー=%81%5B、望=%96%5D、 # 評=%95%5D、従=%8F%5D、転=%93%5D、余=%97%5D、ゾ=%83%5D、犠=%8B%5D、 $value =~ s/%5[bBcCdDeE]/%5c$&/g; $value =~ s/%2[489B]/%5c$&/g; $value =~ s/%3F/%5c$&/g; $value =~ s/%7[BCD]/%5c$&/g; $value =~ s/[\.\*]/%5c$&/g; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s//>/g; if ($key ne main){ $br = ""; } else { $br = "
"; } if ($value =~ /\r\n/) { $value =~ s/\r\n/$br/g; } if ($value =~ /\n/) { $value =~ s/\n/$br/g; } if ($value =~ /\r/) { $value =~ s/\r/$br/g; } if ($value =~ /,/) { $value =~ s/,/,/g; } if ($key eq title){ $value =~ s/\'/'/g; } $in{"$key"}=$value; } #if ($compatible == 1){ # `$cat $mbarchdata $mbpastdata $mbdata > $alldata`; # chmod(0666,"$alldata"); # $filename="$alldata"; #} else { # $filename = $mbdata; #} ($filename,$tmpdata) = &gentmpdata; $name = $in{name}; #print "Content-Type: text/html\n\n"; print "\n"; print "\n"; if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } print "\n"; print "\n"; print "
\n"; open(FILE,"< $filename") || "die Cannot open file\n"; print "
    \n"; while (){ s/[\r\n]*$//; $nameres = "false"; $titleres = "false"; $main1res = "false"; $main2res = "false"; $main3res = "false"; ($lnum,$ldcode,$lname,$lmadd,$lip,$ldate,$ltitle,$lmain,$lencpwd,$limagefile)=split(/,/); $