#!/usr/bin/perl ## This file is euc-jisx0213 encoding. use Suika::CGI; $myvesion = '1.00 (2001-08-22)'; $about_perl = <<"EOH";
FlasH BBS Pro v1.41 [©¦Shigeto Nakazawa] ¤ò¥Ù¡¼¥¹¤Ë¿å̵·î¤Ð¤±¤é¤¬²þ¤ + ¼ãÍդΠquick hack $myversion EOH ## h12-05-06 ¿å̵·î¤Ð¤±¤é$navi_usage$navi_ichiran$navi_num$navi_new$navi_back
"; ## &get_cookie; if ($nazo eq 'only') {&nazo_only; } elsif ($OPT{'md'} eq 'reg') {®ist; } elsif ($OPT{'md'} eq 'del') {&delete; } elsif ($OPT{'md'} eq 'viw') {&view; } elsif ($OPT{'md'} eq 'new') { $html_navi = "$navi_usage$navi_ichiran$navi_num$navi_back"; &html_form('root'); } elsif ($OPT{'md'} eq 'set') { &set; } elsif ($OPT{'md'} eq 'num') { $html_navi = "
$navi_usage$navi_ichiran$navi_new$navi_back"; &number; } else { $html_navi = "
$navi_usage$navi_num$navi_new$navi_back"; &ichiran; } &html_footer; exit 0; # [ ¥Ø¥Ã¥À¡¼Éôʬɽ¼¨ ] # sub html_header { my($sub_title) = @_; my $s; if ($sub_title) { $s = <<"_EOF_"; Content-Type: text/html; charset=euc-jisx0213 Content-Language: ja Content-Style-Type: text/css Content-Script-Type: text/javascript
$link_element([Á´]¤òÁªÂò¤¹¤ë¤È´ØÏ¢µ»ö¤â´Þ¤á¤Æ°ì³çɽ¼¨¤Ç¤¤Þ¤¹¡£)
\n"; $tree = int($tree/$max_tree) * $max_tree; $end_tree = $tree + $max_tree; my($tree_count) = 0; while (¤³¤Îµ»ö¤ËÂФ·¤Æ¥³¥á¥ó¥È¤òÅê¹Æ¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£
'; return 0; }elsif( $nazo eq 'no' ){ $s .= ''; return 0; } if ($title =~ /^[Rr][Ee]\^\d+\:(.*)/) {$title = "Re: $1";} elsif ($title =~ /^[Rr][Ee]\[\d+\]\:(.*)/) {$title = "Re: $1";} elsif ($title =~ /^[Rr][Ee]\:(.*)/) {$title = "Re: $1";} else {$title = "Re: $title"; } $comment = "¤³¤Îµ»ö¤Ë´Ø¤¹¤ë¥³¥á¥ó¥È¤òÅê¹Æ¤¹¤ë¾ì¹ç¤Ï°Ê²¼¤ÎÅê¹ÆÍó¤Ë½ñ¤¹þ¤ó¤Ç²¼¤µ¤¤¡£
'; $s .= &html_form($OPT{'no'},$title,$comment,$OPT{'tn'},$lx,1); #Åê¹Æ¼Ôºï½ü if (crypt($COOKIE{'pwd'},$file_pwd) eq $file_pwd) { $s .= <<"_EOF_";No.$num_no"; if ($res eq 'root') { print '(¿Æµ»ö)'; } else { $res = int($res); print "¢¥[$res]"; } if (!$reply[$no]) { print ' / (Ãí¼á¤Ê¤·)'; } else { chop($reply[$no]); my(@replys) = split(/-/,$reply[$no]); foreach (@replys) { print " / ¢§[$_]"; } } print "
\n"; print &kiji_view($data); if( $nazo eq 'no' ){ print ''; }else{ print "¥³¥á¥ó¥È¤òÅê¹Æ / "; } print "µ»ö°ìÍ÷
ºÇ¶á¤Îµ»ö $new_kiji ·ï¤òɽ¼¨¤·¤Æ¤¤¤Þ¤¹¡£
"; print '['; my($i,$j,$tmp); for ( $i = 1; $i <= 10; $i++ ){ $j = $i * 10; unless ($new_kiji == $j){ if($tmp){ print ' / ' ; }else{ $tmp = 1; } print "$j ·ï"; } } print ' ]
'; open(LOG,$logfile) or &error('Æɤ߹þ¤ß¥¨¥é¡¼','¥í¥°¤ÎÆɤ߹þ¤ß¤¬½ÐÍè¤Þ¤»¤ó¡£´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); my($count, $last_nj); $count =$list_order: µ»öNo.$no
\n"; print &kiji_view($data); print<<"_EOF_";>$2<\/q>/g; $comment =~ s/
(>|>)([^<]*)/>$2<\/q>/g; #URL ¤Ë¥¢¥ó¥«¡¼¤òÀßÄꤹ¤ë if( $uri_mode eq 'uri' || $uri_mode eq 'all' ){ $comment =~ s/(https?|ftp|gopher|telnet|nntp|news)\:([\w|\:\!\#\$\%\=\&\-\^\`\\\|\@\~\[\{\]\}\;\+\*\,\.\?\/]+)/$1\:$2<\/a>/ig; } if( $uri_mode eq 'rfc' || $uri_mode eq 'all' ){ $comment =~ s/(\W)([Rr][Ff][Cc]\s?)([1-9]\d*)(\W)/$1$2$3<\/a>$4/g; } # &jcode'convert(*comment,$mojicode); if ($email) { $name = "$name"; } local($s) = <<"_EOF_";_EOF_ $s; } # [ µ»öÅÐÏ¿½èÍý ] sub regist { my($title,$name,$email,$comment,$lx,$tn,$pwd,$ref_url) = ($OPT{'title'},$OPT{'name'},$OPT{'email'},$OPT{'comment'},$OPT{'lx'},$OPT{'tn'},$OPT{'pwd'},$ENV{'HTTP_REFERER'}); $title =~ s/^\($default_title\)//; $title =~ s/\r\n//g; $title =~ s/[\r\n]//g; $name =~ s/^\($default_name\)//; $name =~ s/\r\n//g; $name =~ s/[\r\n]//g; $email =~ s/^\($default_email\)//; $email =~ s/\r\n//g; $email =~ s/[\r\n]//g; $comment =~ s/^\($default_comment\)//; $comment =~ s/^\s+//g; $comment =~ s/(\s|¡¡)+$//g; $comment =~ s/\r\n/
/g; $comment =~ s/[\r\n]/
/g; $lx++; $pwd =~ s/\r\n//g; $pwd =~ s/\r|\n//g; $ref_url =~ s/\?(.|\n)*//g; s/\%7E/\~/g; #Åê¹Æ¥Á¥§¥Ã¥¯ if($ENV{'REQUEST_METHOD'} ne "POST"){ &method_error(); # }elsif($base_url && ($ref_url !~ $base_url)){ # &error('ÉÔÀµÅê¹Æ','¥¢¥¯¥»¥¹¤Ï¼õ¤±Æþ¤ì¤é¤ì¤Þ¤»¤ó¤Ç¤·¤¿¡£³°Éô¤«¤é¤ÎÉÔÀµ¤ÊÅê¹Æ¤¬¹Ô¤ï¤ì¤¿²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£Àµ¤·¤¤Åê¹Æ¤Ç¤â¤³¤Î¥¨¥é¡¼¤¬½Ð¤ë¾ì¹ç¤Ï¡¢¥Ö¥é¥¦¥¶¤¬ Referer ¤òÁ÷½Ð¤¹¤ëÀßÄê¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£'); }elsif (length($title) > 80) { $_ = length($title) - 80; &error('Âê̾ÆþÎÏ¥¨¥é¡¼',"Âê̾¤¬Ä¹¤¹¤®¤Þ¤¹¡£$_ ¥Ð¥¤¥Èºï¸º¤·¤Æ¤¯¤À¤µ¤¤¡£"); }elsif (!$title) { &error('Âê̾ÆþÎÏ¥¨¥é¡¼','Âê̾¤¬ÆþÎϤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'); }elsif (!$name) { &error('Åê¹Æ¼Ô̾ÆþÎÏ¥¨¥é¡¼','Åê¹Æ¼Ô̾¤¬ÆþÎϤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£'); }elsif (length($name) > 42) { $_ = length($name) - 42; &error('Åê¹Æ¼Ô̾ÆþÎÏ¥¨¥é¡¼',"Åê¹Æ¼Ô̾¤¬Ä¹¤¹¤®¤Þ¤¹¡£$_ ¥Ð¥¤¥Èºï¸º¤·¤Æ¤¯¤À¤µ¤¤¡£"); }elsif ($email && $email !~ /\w[\w\.\-]*\@\w[\w\.\-]*\.\w+/){ &error('¥á¡¼¥ë¥¢¥É¥ì¥¹ÆþÎÏ¥¨¥é¡¼','¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î½ñ¼°¤¬ÉÔÀµ¤Ç¤¹¡£Á´³Ñʸ»ú¤ò»È¤Ã¤Æ¤¤¤Ê¤¤¤«¡¢¶õÇò¤ò´Þ¤á¤Æ¤¤¤Ê¤¤¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£'); }elsif (length($email) > 120) { $_ = length($email) - 120; &error('¥á¡¼¥ë¥¢¥É¥ì¥¹ÆþÎÏ¥¨¥é¡¼',"¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬Ä¹¤¹¤®¤Þ¤¹¡£$_ ¥Ð¥¤¥Èºï¸º¤·¤Æ¤¯¤À¤µ¤¤¡£"); }elsif (!$comment) { &error('ËÜʸÆþÎÏ¥¨¥é¡¼','ËÜʸ¤¬ÆþÎϤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£¶õÇò¤Î¤ß¤ÎÅê¹Æ¤Ï½ÐÍè¤Þ¤»¤ó¡£'); }elsif (length($comment) > $max_msg) { $_ = length($comment) - $max_msg; &error('ËÜʸÆþÎÏ¥¨¥é¡¼',"ËÜʸ¤¬Ä¹¤¹¤®¤Þ¤¹¡£$_ ¥Ð¥¤¥Èºï¸º¤·¤Æ¤¯¤À¤µ¤¤¡£"); }elsif ((!$pwd) || (length($pwd) > 8)) { $pwd = &random_string(8); } my($salt) = &random_string(2); $file_pwd = crypt($pwd,$salt); &get_date; open(LOG,$logfile) or &error('Æɤ߹þ¤ß¥¨¥é¡¼','¥í¥°¤ÎÆɤ߹þ¤ß¤¬½ÐÍè¤Þ¤»¤ó¡£´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); my($count, $last_nj); $count =;chop($count); $last_nj = ;chop($last_nj); my(@all_log) = ; close(LOG); $this_nj = $OPT{'nj'}; if (++$count > 9999) { &error('µ»ö¥«¥¦¥ó¥¿¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼','ÅÐÏ¿µ»ö¿ô¤¬ 10,000 ¤Ë㤷¤¿¤¿¤á¡¢Åê¹Æ¤ò¼õ¤±ÉÕ¤±¤ë¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£Åê¹Æ¤ò¼õ¤±ÉÕ¤±¤ë¤Ë¤Ï¡¢´û¸¤Îµ»ö¤òºÆÊÔÀ®¤·¤Æ·Ç¼¨ÈĤκÇŬ²½¤ò¹Ô¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡£´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); # }elsif ($this_nj eq $last_nj){ # &error('Æó½ÅÅê¹Æ','Æó½ÅÅê¹Æ¤Ç¤¹¡£Åê¹Æ¥Ü¥¿¥ó¤¬Ï¢ÂǤµ¤ì¤Æ¤·¤Þ¤Ã¤¿²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£°ìÍ÷ɽ¼¨¤ò¥ê¥í¡¼¥É¤·¤Æµ»ö¤¬Åê¹Æ¤µ¤ì¤¿¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£ºÆÅê¹Æ¤ÎºÝ¤Ï¡¢Åê¹Æ¥Õ¥©¡¼¥à¤ò¥ê¥í¡¼¥É¤·¤ÆÅê¹Æ¤ò¤ä¤êľ¤·¤Æ¤¯¤À¤µ¤¤¡£'); } my($kiji_no) = substr("0000",length($count)).$count; $rhost = $ENV{'REMOTE_HOST'}; $ipad = $ENV{'REMOTE_ADDR'}; if ($OPT{'no'} eq 'root') { $kiji_data = "$kiji_no<>root<>0<>$kiji_no<>$title<>$name<>$email<>$date_now<>0<>$file_pwd<>$rhost<>$ipad<>$comment\n"; unshift(@all_log,$kiji_data); } else { foreach $tree (@all_log) { if ($tn == (split(/<>/,$tree))[0]) { @datas = ÷_log($tree); $flag1 = 0; $flag2 = 0; $kiji_data = "$kiji_no<>$OPT{'no'}<>$lx<>$tn<>$title<>$name<>$email<>$date_now<>0<>$file_pwd<>$rhost<>$ipad<>$comment"; foreach $data (@datas) { if (($flag2 == 1) && ($temp_lx >= (split(/<>/,$data))[2])){ $tree_data = "$tree_data<#>$kiji_data"; $flag2 = 2; } if ($flag1) { $tree_data = "$tree_data<#>$data"; } else { $tree_data = $data; $flag1 = 1; } if (($OPT{'no'} == (split(/<>/,$data))[0]) && (!$flag2)) { $flag2 = 1; $temp_lx = (split(/<>/,$data))[2]; } } if ($flag2 == 1){ $tree_data = "$tree_data<#>$kiji_data"; } unshift (@new,"$tree_data\n"); } else { push (@new,$tree); } } @all_log = @new; } #ÍÆÎÌ¥ª¡¼¥Ð¡¼¤·¤¿µ»ö¤òºï½ü if ($max_size < 1500) { $max_size = 1500; } $size = -s $logfile; while ($size > $max_size){ my($delete) = pop(@all_log); $size -= length($delete); &delete_log($delete); } &write_file($count, $this_nj, @all_log); $COOKIE{'name'} = $name; $COOKIE{'email'} = $email; $COOKIE{'pwd'} = $pwd; &set_cookie; local($s) = $def_header_http.$defhead.$html_navi.' Åê¹Æ¤Î¼õÍý
'; $s .= <<"_EOF_";¸æÅê¹ÆÍÆñ¤¦¤´¤¶¤¤¤Þ¤¹¡£°Ê²¼¤ÎÆâÍƤò¼õÍý¤·¤Þ¤·¤¿¡£
_EOF_ $s .= &kiji_view($kiji_data); print ($s.$deffoot); exit; } # [ Åê¹Æ¼Ôºï½ü½èÍý ] sub delete { my(@kiji_datas) = ÷_log(&search_tree); my($kiji_data) = &search_data(@kiji_datas); my($no,$res,$lx,$tn,$title,$name,$email,$date,$act,$file_pwd,$rhost,$ipad,$comment) = ÷_data($kiji_data); if (crypt($COOKIE{'pwd'},$file_pwd) ne $file_pwd) { &error('ºï½ü¥¨¥é¡¼','»ØÄꤷ¤¿µ»ö¤Îºï½ü¤Ï¤Ç¤¤Þ¤»¤ó¡£´û¤Ëºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£¤É¤¦¤·¤Æ¤âºï½ü¤·¤¿¤¤¾ì¹ç¤Ï´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); } &get_date; #¾Úµò¤ò»Ä¤·¤Æ¤ª¤¯¡£ &delete_log($kiji_data); open(LOG,$logfile) or &error('Æɤ߹þ¤ß¥¨¥é¡¼','¥í¥°¤ÎÆɤ߹þ¤ß¤¬½ÐÍè¤Þ¤»¤ó¡£´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); my($count, $last_nj); $count =;chop($count); $last_nj = ;chop($last_nj); my($delete_notice); if (@kiji_datas == 1) { while ( ) { unless (/^$OPT{'no'}/) { push(@new,$_); } } $delete_notice = ' µ»ö¤Ï¥Ä¥ê¡¼¤ò¹½À®¤·¤Æ¤¤¤Ê¤«¤Ã¤¿¤¿¤á¡¢´°Á´¤Ë¾ÃÌǤ·¤Æ¤¤¤Þ¤¹¡£
'; } else { my($kiji_data) = "$no<>$res<>$lx<>$tn<>$title(Åê¹Æ¼Ôºï½ü)<>$name<><>$date<>8<>Null<>$rhost<>$ipad<>Åê¹Æ¼Ô¤Ë¤è¤Ã¤Æºï½ü¤µ¤ì¤Þ¤·¤¿¡£(ºï½ü: $date_now)"; my($flag) = 0; my($tree_data); foreach (@kiji_datas) { if ($flag) { $tree_data .= "<#>"; } else { $flag = 1; } if (/^$OPT{'no'}/) { $tree_data .= $kiji_data; } else { $tree_data .= $_; } } $tree_data =~ s/\n//; while () { if (!/^$OPT{'tn'}/) { push(@new,$_); } else { push(@new,"$tree_data\n"); } } $delete_notice = ' µ»ö¤Ï¥Ä¥ê¡¼¤Î°ìÉô¤ò¹½À®¤·¤Æ¤¤¤¿¤¿¤á¡¢(Åê¹Æ¼Ôºï½ü) ¤È¤¤¤¦µ»ö¤Ëº¹¤·Âؤ¨¤é¤ì¤Æ¤¤¤Þ¤¹¡£
'; } close(LOG); &write_file($count, $this_nj, @new); print &html_header("Åê¹Æ¼Ôºï½ü"); print<<"_EOF_";
µ»ö No.$OPT{'tn'}¡Ö$title¡×¤òºï½ü¤·¤Þ¤·¤¿¡£
$delete_notice°ìÍ÷ɽ¼¨¤ò¥ê¥í¡¼¥É¤·¤Æ¡¢µ»ö¤¬ºï½ü¤µ¤ì¤¿¤³¤È¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
_EOF_ } # [ ¥Ç¡¼¥¿½èÍý´ØÏ¢ÈÆÍÑ¥µ¥Ö ] sub divide_log { my($data) = @_; chop($data); return split(/<#>/,$data); } sub divide_data { my $data = @_; return split(/<>/,$_[0]); } sub search_data { my(@kiji_datas) = @_; my($search_data_no) = $OPT{'no'}; my($hit_data); foreach(@kiji_datas){ if ( /^$search_data_no/ ) { $hit_data = $_; last; } } return $hit_data; } sub search_tree { my($search_tree_no) = $OPT{'tn'}; my($hit_data); open(LOG,$logfile) or &error('Æɤ߹þ¤ß¥¨¥é¡¼','¥í¥°¤ÎÆɤ߹þ¤ß¤¬½ÐÍè¤Þ¤»¤ó¡£´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); my($count, $last_nj); $count =;chop($count); $last_nj = ;chop($last_nj); while ( ) { if ( /^$search_tree_no/ ){ $hit_data = $_; last; } } close(LOG); return $hit_data; } # [ ¥Õ¥©¡¼¥à¤«¤é¥Ç¡¼¥¿¼èÆÀ ] sub read_form { %OPT = %Suika::CGI::param; return; my($pair,$buffer); if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } my(@pairs) = split(/[&;]/,$buffer); #¥Ñ¥é¥á¡¼¥¿¶èÀÚ¤ê¤Ë ; ¤ò»È¤¨¤ë¤è¤¦¤Ë²þ¤¡£ foreach $pair (@pairs) { my($name,$value) = split(/=/,$pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $OPT{$name} = &change_code($value); } } # [ ¥¯¥Ã¥¡¼½èÍý ] sub get_cookie { my($pair,%DUMMY); my($cookies) = $ENV{'HTTP_COOKIE'}; my(@pairs) = split(/;/,$cookies); foreach $pair (@pairs) { my($name,$value) = split(/=/,$pair); $name =~ s/ //g; $value =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("C", hex($1))/eg; $DUMMY{$name} = $value; } @pairs = split(/,/,$DUMMY{$cookie_name}); foreach $pair (@pairs) { my($name,$value) = split(/:/,$pair); $COOKIE{$name} = &change_code($value); } } sub set_cookie { my($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime(time + 30*24*60*60); $year += 100 if $year < 99; $year += 1900; $sec = "0$sec" if $sec < 10; $min = "0$min" if $min < 10; $hour = "0$hour" if $hour < 10; $mday = "0$mday" if $mday < 10; $mon = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon]; $youbi = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')[$wday]; $date_gmt = "$youbi, $mday\-$mon\-$year $hour:$min:$sec GMT"; my($cook); foreach $valname ('name','email','pwd'){ my($tmp) = $COOKIE{$valname}; $tmp =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg; $cook .= "$valname:$tmp,"; } print "Set-Cookie: $cookie_name=$cook; expires=$date_gmt\n"; } # [ ʸ»ú¥³¡¼¥É´ØÏ¢ ] sub change_code { my($text)=$_[0]; &jcode'convert(*text,$mojicode); $text =~ s/&/&/g; $text =~ s/</g; $text =~ s/>/>/g; return $text; } # [ ÆüÉÕ¼èÆÀ ] sub get_date { $ENV{'TZ'} = "JST-9"; # TimeZone (ÆüËÜ»þ´Ö = ¹ñºÝɸ½à»þ(JST) - 9»þ´Ö) my($sec,$min,$hour,$day,$mon,$year) = localtime(); if ($year < 99) { $year += 100; } $year += 1900; $mon++; $sec = "0$sec" if $sec < 10; $min = "0$min" if $min < 10; $hour = "0$hour" if $hour < 10; $mon = "0$mon" if $mon < 10; $day = "0$day" if $day < 10; $date_now = "$year/$mon/$day $hour:$min:$sec"; $datetime = "$year-$mon-${day}T$hour:$min:$sec+09:00"; } # [ µÏ¿¥Õ¥¡¥¤¥ë¤Î½èÍý ] sub write_file { my($count,$this_nj,@lines) = @_; #¥×¥í¥»¥¹ID ¤«¤é¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë̾¤òÀ¸À® $pros = $$; $pros = time unless $pros; $tmp_file = "$ID$pros.tmp"; #¾¤Î¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤ò¸¡º÷ opendir(DIR,$log_dir) or &error('¥·¥¹¥Æ¥à¥¨¥é¡¼','ºî¶È¥Ç¥£¥ì¥¯¥È¥ê¤Î¥ª¡¼¥×¥ó¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£´ÉÍý¼Ô¤¬²¿¤«¤ò˺¤ì¤Æ¤¤¤ë²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£'); @list = readdir(DIR); closedir(DIR); unless (@list) { &error('¥·¥¹¥Æ¥à¥¨¥é¡¼','ºî¶È¥Ç¥£¥ì¥¯¥È¥ê¤¬´°Á´¤Ë¶õ¤Ç¤¹¡£'); } @lists = grep(/$ID.*\.tmp/,@list); #¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤¬¤¢¤ë¾ì¹ç my($retry_counter) = $retry; while (@lists) { if (--$retry_counter <= 0) { #¤·¤Ó¤ì¤òÀڤ餷¤¿ foreach (@lists) { #¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤òËõ»¦ unlink("$log_dir$_") if (-e "$log_dir$_"); } &error('¥Ó¥¸¡¼','¤¿¤Àº£º®»¨¤·¤Æ¤¤¤Þ¤¹¡£»þ´Ö¤ò¤ª¤¤¤ÆºÆÅټ¹Ԥ·¤Æ¤¯¤À¤µ¤¤¡£'); } sleep(1); opendir(DIR,"$log_dir"); @list = readdir(DIR); closedir(DIR); @lists = grep(/$ID.*\.tmp/,@list); } #¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤à open(WRITE,">$log_dir$tmp_file") or &error('½ñ¤¹þ¤ß¥¨¥é¡¼','µÏ¿¥Õ¥¡¥¤¥ë¤Î½ñ¤¹þ¤ß¤¬½ÐÍè¤Þ¤»¤ó¡£´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); print WRITE "$count\n"; print WRITE "$this_nj\n"; print WRITE @lines; close(WRITE); #¤â¤¦°ìÅÙ¾¤Î¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤ò¸¡º÷ opendir(DIR,$log_dir); @list = readdir(DIR); closedir(DIR); @lists = grep(/$ID.*\.tmp/,@list); @lists = grep(!/$tmp_file/,@lists);#¼«Ê¬¼«¿È¤Ï½ü³° if (@lists) {#¾¤Ç½ñ¤¹þ¤ßÃæ¤Ç¤¢¤ì¤Ð½ñ¤¹þ¤ß¤òÃæ»ß¤·¤Æ½ªÎ» unlink("$log_dir$tmp_file") if (-e "$log_dir$tmp_file"); &error('½ñ¤¹þ¤ß¤Î¶¥¹ç','Ê̤νñ¤¹þ¤ß¤Î½èÍýÃæ¤Ç¤¹¡£¤¹¤³¤·»þ´Ö¤ò¤ª¤¤¤Æ¤«¤é¡¢ºÆÅÙ¤´ÍøÍѲ¼¤µ¤¤¡£'); } rename("$log_dir$tmp_file",$logfile) or &error('½ñ¤¹þ¤ß¤Î¶¥¹ç','½ñ¤¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£ºÆÅټ¹Ԥ·¤Æ¤¯¤À¤µ¤¤¡£'); chmod 0666, $logfile; } sub delete_log{ my($delete) = @_; open(WRITE,">> $arc_dir${ID}.txt") or &error('¥¨¥é¡¼','ºï½ü¥í¥°¤Î¥·¥¹¥Æ¥à¥¨¥é¡¼¤Ç¤¹¡£´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); @datas = ÷_log($delete); @datas = sort(@datas); foreach $data (@datas) { my($no,$res,$lx,$tn,$title,$name,$email,$date,$act,$pwd,$rhost,$ipad,$comment) = ÷_data($data); print WRITE "No:$no $title\n"; print WRITE "$date"; print WRITE "$res ¤Ø¤Î¥³¥á¥ó¥È" unless ($res eq 'root'); print WRITE "\n"; $comment =~ s/
/\n/g; $comment =~ s/>/>/g; $comment =~ s/</ $link_element(¥¨¥é¡¼Êó¹ð) ¥¨¥é¡¼
$err_msg
$err_description
_EOF_ &html_footer; exit; } sub method_error{ print<<"_EOF_"; Status: 405 Method Not Allowed Allow: POST Content-type: text/html; $charset_code Content-Language: ja(¥¨¥é¡¼Êó¹ð) ¥¨¥é¡¼
ÉÔÀµÅê¹Æ
¥¢¥¯¥»¥¹¤Ï¼õ¤±Æþ¤ì¤é¤ì¤Þ¤»¤ó¤Ç¤·¤¿¡£³°Éô¤«¤é¤ÎÉÔÀµ¤ÊÅê¹Æ¤¬¹Ô¤ï¤ì¤¿²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£
_EOF_ &html_footer; exit; } sub navi_form{ my($tree_count) = @_; my($this_page,$page_navi); my($tmp_query) = $uri_query; $tmp_query =~ s/;tree=\d+//; if($tree_count){ for ($i = 0; $i < $tree_count; $i += $max_tree) { $j = $i / $max_tree + 1; if ($tree == $i) { $this_page = $j; } else { $page_navi .= "/ $j¥Ú¡¼¥¸\n" } } } $page_navi .= "( $this_page / $j ¥Ú¡¼¥¸ )" if $j > 1; print<<"_EOF_"; _EOF_ } sub nazo_only{ my(%nazo); my(@env); my($name, $value); open(LOG, $logfile) or &error('Æɤ߹þ¤ß¥¨¥é¡¼','¥í¥°¤ÎÆɤ߹þ¤ß¤¬½ÐÍè¤Þ¤»¤ó¡£´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£'); while(){ while( m|(¡Ú.+?¡Û)|g ){ $nazo{"$1"} ++; } } close(LOG); print &html_header("ÆæÅý·×¾ðÊó"); if(%nazo){ print ' '; while (($name, $value) = each(%nazo)){ push(@env, "$name = $value"); } foreach (sort(@env)){ print "
'; }else{ print '- "; } print '
$_
Not Found.
'; } &html_footer; exit; } sub location{ my($location) = @_; print <<"_EndOfText_"; Status: 302 Found Location: $location Content-Type: text/html; charset=EUC-JP Content-Language: ja _EndOfText_ print &html_header("$location"); print "$location ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
"; &html_footer; exit; } sub add_query{ my($name, $value) = @_; $uri_query .= ";$name=$value"; $form_query .= ""; } sub squelch{ my($data) = @_; #Ææ¤ò¥¹¥±¥ë¥Á¤¹¤ë if( $nazo eq 'no' ){ $data =~ s/(¡Ú[^<]+?¡Û)/$1<\/del>/g; } return $data; }
$children
";} $s .= <<"_EOF_";$parent $children