Blogger Syntax Highlighter
こんなのあった。
というわけでテスト。
生贄になったのは、競艇のアプレットのデータを取得するphpです。
<? $db_host = "localhost"; $db_user = ""; $db_passwd = ""; $db_name = ""; $db = mysql_connect($db_host,$db_user,$db_passwd); mysql_select_db($db_name,$db); mysql_query("set names utf8"); for ($jou=1;$jou<=24;$jou++) { $url = "http://www.mbrace.or.jp/od/O/".sprintf("%02d", $jou)."/OJ01.dat"; $d = explode(",", file_get_contents($url)); if ($d[0] == "NODATA") { continue; } for ($race=1;$race<=12;$race++) { $url = "http://www.mbrace.or.jp/od/O/".sprintf("%02d", $jou)."/OJ".sprintf("%02d", $race).".dat"; $d = explode(",", file_get_contents($url)); for($boat=1;$boat<=6;$boat++) { $sql = "delete from motor where day='".date("Y-m-d")."' and jou={$jou} and race={$race} and boat={$boat}"; mysql_query($sql, $db); $sinnyu=(!is_numeric($d[56+26*($boat-1)]))?0:$d[56+26*($boat-1)]; $tenji =(!is_numeric($d[59+26*($boat-1)]))?"0.00":$d[59+26*($boat-1)]; $sql = "insert into motor (day,jou,race,boat,motor_no,toban,weight,sinnyu,tenji) values ('".date("Y-m-d")."',{$jou},{$race},{$boat},".$d[78+26*($boat-1)].",".$d[55+26*($boat-1)].",".$d[80+26*($boat-1)].",{$sinnyu},{$tenji})"; mysql_query($sql, $db); for ($i=0;$i<4;$i++) { $num = 60+(2*$i)+26*($boat-1); if ($d[$num] != "-") { $sql = "delete from parts_change where day='".date("Y-m-d")."' and jou={$jou} and race={$race} and boat={$boat} and seq={$i}"; mysql_query($sql, $db); $sql = "insert into parts_change (day,jou,race,boat,seq,name,amount) values ('".date("Y-m-d")."',{$jou},{$race},{$boat},{$i},'".$d[$num]."',".$d[$num+1].")"; mysql_query($sql, $db); } } } } }
0 Response for the "Blogger Syntax Highlighter"
コメントを投稿