6) || (ereg("[^0-9]{1,6}", $aid)) ) { //不正パラメーター $page = "./template/ng.html"; ReadTemplate($page); } else { //ファイルオープン(IDチェック用) if (!($fno = fopen($file, 'r'))) { die; } while (!feof($fno)) { $rec = fgets($fno, 32000); $data = split(",",$rec); if ($aid == $data[0]){ //同[aid]が見つかった場合はNG、$nxtに登録済みの当選Noを記録 $ng = 1; $nxt = $data[1]; break; } } fclose($fno); //新規登録時 if ($ng != 1){ //1万円か10万円かをランダムに表示 srand((double)microtime()*1000000); $nxt = rand(1,10); if ($nxt > 1){ $nxt = 1; } else { $nxt = 2; } if (!($fno = fopen($file, 'a'))) { die; } fwrite($fno,$aid.",".$nxt."\n",32000); fclose($fno); } //対応するHTMLの呼び出し $page = "./template/cmp_".trim($nxt).".html"; ReadTemplate($page); }