//ハンドルを調べる
$fdat = explode( "<>", $line[$k], 4 ); //DATの行内で$lineを<>で分割
$fdat[0] = strip_tags( $fdat[0] ); //名前欄のタグ(トリップ付属の<b>タグ)を消去
$fdat[0] = ereg_replace( "@|@", " ", $fdat[0] ); //@をスペースに変換
if( ereg( "(◆.+)", $fdat[0], $regs ) ): //トリップがあればHNとする
$fdat0t = $regs[1];
else:
$fdat0t = ereg_replace( "(\(|(|【)[0-9]+.*(\)|)|】)", " ", $fdat[0] ); //(数字+)を取る
endif;
$hname = ereg_replace( "( | )", "", $fdat0t ); //名前からスペースを取る
for( $m = 0; $m < count($hnarr); $m++){
if( $hnarr[$m] != "" ):
$hname = $hnarr[$m];break; //ヌルでない名前を決定
endif;
}
//単位数を調べる
$fdat[0] = ereg_replace( "( | )", "", $fdat[0] ); //名前欄からスペースを取る
$maila = str_replace( "( | )", "", $fdat[1] ); //メール欄からスペースを取る
$fdat[3] = ereg_replace( "( | )", "", $fdat[3] ); //本文からスペースを取る←打ち間違い等対策
$ptim = explode( " ", $fdat[2], 3 ); //投稿日をスペースで分割
$tscore = -1; //初期化
if( ereg( "(\(|(|【)([0-9]+)(\)|)|】)", $fdat[0], $regs ) ): //名前欄に(〜)
$tscore = $regs[2];
elseif( ereg( "^([0-9]+)(\.[0-9]+)*$", $maila, $regs ) ): //メール欄が数字列のみ
$tscore = $regs[1];
elseif( ereg( "(\(|(|【)([0-9]+)", $fdat[0], $regs ) ): //閉じていない括弧
$tscore = $regs[2];
elseif( ereg( "^([0-9]+)(\.[0-9]+)*単位$", $maila, $regs ) ): //メール欄が「〜単位」
$tscore = $regs[1];
else:
$texts = split( "<br>", $fdat[3] ); //本文を改行で分ける
$j = count( $texts ) - 1;
while( $j > 0 ){ //本文の最後の行から順に調べる
if( ereg( "^([0-9]+)(\.[0-9]+)*$", $texts[$j], $reg ) ): //行に数字だけ書いてある
$tscore = $reg[1];break;
elseif( ereg( "^(合計|総計)([0-9]+)(\.[0-9]+)*(単位)*$", $texts[$j], $reg ) ): //行に合計〜(単位)とだけ
$tscore = $reg[2];break;
elseif( ereg( "tot\.([0-9]+)", $texts[$j], $reg ) ): //tot.〜
$tscore = $reg[1];break;
elseif( ereg( "(合計|総計)([0-9]+)(\.[0-9]+)*(単位)*", $texts[$j], $reg ) ): //とにかく"合計〜"が含まれればよい
$tscore = $reg[2];break;
endif;
$j--;
}
if(!$tscore):
$tscore = -1; //未定義の意を返す
endif;
endif;
$tscore = $tscore % 500; //完走分を引く
|