model_type(); $datetime = $tmp -> datetime(); $today = gmdate('Y_m_d',time()+$datetime[difference]); //変数初期化 $flag = false; //データ読込み------------------------------------------------------------------------------ $fp = fopen("./log/{$today}.log","a+"); flock($fp,LOCK_EX); fseek($fp,0); while(!feof($fp)){ //ファイル取込み $tmp = explode("\t",fgets($fp)); if($tmp[0]){ //ID判別 if($vb[code] == $tmp[0]){ switch(model_check()){ case 'd' : $tmp[1]++; break; case 'a' : $tmp[2]++; break; case 'v' : $tmp[3]++; break; case 'p' : $tmp[4]++; break; case 'etc' : $tmp[5]++; break; } $flag = true; } $data .= "{$tmp[0]}\t{$tmp[1]}\t{$tmp[2]}\t{$tmp[3]}\t{$tmp[4]}\t{$tmp[5]}\t\n"; } } //初アクセス判別 if(!$flag){ $tmp[1] = $tmp[2] = $tmp[3] = $tmp[4] = $tmp[5] = 0; switch(model_check()){ case 'd' : $tmp[1]++; break; case 'a' : $tmp[2]++; break; case 'v' : $tmp[3]++; break; case 'p' : $tmp[4]++; break; case 'etc' : $tmp[5]++; break; } $data .= "{$vb[code]}\t{$tmp[1]}\t{$tmp[2]}\t{$tmp[3]}\t{$tmp[4]}\t{$tmp[5]}\t\n"; } //データ書込み ftruncate($fp,0); fputs($fp,$data); flock($fp,LOCK_UN); fclose($fp); //------------------------------------------------------------------------------------------ $url = $ad[$vb[code]]; } } //ロケーション header("Location: {$url}"); ?>