#! /usr/local/bin/perl #はじあや@ふぁみーるのパソヲタさん、本当にありがとう #-------------------- $body = ''; $bbstitle ="あやしいわーるど"; #$logdir = 'http://www2u.biglobe.ne.jp/~rebirth/strange/log/'; $cgiurl = 'getlog.cgi'; $action ='getlog'; $bbsurl = './bbs.cgi'; $logurl = './log/990720.html'; # 日本語コード変換ライブラリjocde.plのパス require './jcode.pl'; # キーワードの最大文字数(半角) $keylength = 64; # 時差 サーバの時計がずれてる時や日本時間以外にしたい時に使う $tim = 0; # 時刻処理 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time + $tim ); $month = ($mon + 1); $month= "0$month"; $filedate3 = "./log/$year$month$mday.html"; $m2day =$mday-1; $filedate2 = "./log/$year$month$m2day.html"; $m1day =$mday-2; $filedate1 = "./log/$year$month$m1day.html"; #-------------------- $buffer = $ENV{'QUERY_STRING'}; @argv = split(/&/,$buffer); foreach (@argv) { ($name, $value) = split(/=/); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; &jcode'convert(*value,'sjis'); $COMMAND{$name} = $value; } &error(2) if (length($COMMAND{'keyword'}) > $keylength); &viewlog if ($COMMAND{'action'} eq "$action"); &list; # リストの出力 ######################## sub list { #&error(0) if(!opendir(DIR, $logdir)); opendir(DIR, $logdir); @files=readdir(DIR); closedir(DIR); @files = sort by_number @files; $end = @files; $end--; print "Content-type: text/html\n\n"; print "$bbstitle 過去ログ\n"; print "
"; print "$body\n"; print "
$bbstitle 過去ログ一覧
\n"; print ""; print ""; print ""; ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat $filedate1; print ""; print ""; print ""; ######### ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat $logurl; print ""; print ""; print ""; ####### ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat $filedate3; print ""; print ""; print ""; print "\n"; print "
"; print " "; print "
ファイル名サイズ
$year$month$m1day.html$size byte
$year$month$m2day.html$size byte
$year$month$mday.html$size byte
※ラジオボタンでファイル名を指定してください。
時"; print"分から"; print "時"; print"分まで"; print "
検索:"; print ""; print "
"; print "
"; print "
"; #print "現在ベータテスト中です。バグを見つけたら掲示板に書いてね"; print "

掲示板へ

"; print "

Getlog Ver0.3b4

"; print ""; } sub viewlog { #if (!open(DB,"./log/$COMMAND{'logfile'}")) { &error(1); } open(DB,$COMMAND{'logfile'}); @lines = ; close(DB); #---------------------------- $COMMAND{'last'} = $COMMAND{'first'} + 1 if ($COMMAND{'first'} >= $COMMAND{'last'}); $first = "$COMMAND{'hour1'}時$COMMAND{'min1'}分"; $last = "$COMMAND{'hour2'}時$COMMAND{'min2'}分"; if ($COMMAND{'searchmode'} eq 'name') { $keyword = "投稿者:.*>${COMMAND{'keyword'}}<"; } elsif ($COMMAND{'searchmode'} eq 'subject') { $keyword = "color=\"#ffffee\">${COMMAND{'keyword'}}"; } else { $keyword = $COMMAND{'keyword'}; } if ($keyword ne '') { $keyword =~ s/\\/\\\\/; $keyword =~ s/\[/\\[/; } #---------------------------- print "Content-type: text/html\n\n"; print "$bbstitle 過去ログ $COMMAND{'logfile'}"; print "$body"; print "$COMMAND{'logfile'} $first〜$last"; ############################ $end = @lines; $end--; foreach (0 .. $end) { # MiniBBS7.5あやしいわーるど仕様 if ($lines[$_] =~ / 投稿日:/) { $hour = substr( $lines[$_], 36, 8 ); last if ($hour ge "$first"); } $skip++; } $skip--; #print"
"; foreach ($skip .. $end) { # MiniBBS7.5あやしいわーるど仕様 if ($lines[$_] =~ / 投稿日:/) { $hour = substr( $lines[$_], 36, 8 ); last if ($hour ge "$last"); } if ($keyword ne '') { if ($lines[$_] =~ /$keyword/) { $flag = 1; $hit++; } push( @article, $lines[$_] ); if ($lines[$_] =~ /<\/blockquote>/) { print @article if ($flag > 0); splice( @article, 0 ); $flag = 0; } } else { print $lines[$_]; } } if ($COMMAND{'keyword'} ne '') { print "
"; if ( $hit > 0 ) { print "

「$COMMAND{'keyword'}」は $hit件見つかりました。

"; } else { print "

「$COMMAND{'keyword'}」は見つかりませんでした。

"; } } print ""; exit; } #################### sub error { $error = $_[0]; if ($error == 0) { $errmsg = 'ディレクトリが開けませんでした。'; } if ($error == 1) { $errmsg = 'ファイルが開けませんでした。'; } if ($error == 2) { $errmsg = 'キーワードが長すぎます。'; } print "Content-type: text/html\n"; print "エラー"; print "$body"; print "

$errmsg

"; print ""; exit; }