30 lines
787 B
PHP
30 lines
787 B
PHP
<?php
|
|
$ini = parse_ini_file("conf.ini", true);
|
|
mysql_connect($ini['db']['host'],$ini['db']['user'],$ini['db']['pass']);
|
|
mysql_select_db($ini['db']['db']);
|
|
|
|
if ($ini['db']['log']=="1"){
|
|
$arrival_time=microtime(true);
|
|
$filename=basename(__FILE__);
|
|
$filename="log_".$filename.".txt";
|
|
$chunck=strval($arrival_time)." ".$_SERVER['REQUEST_URI']."\r\n";
|
|
file_put_contents($filename,$chunck,FILE_APPEND);
|
|
}
|
|
|
|
$fault_code=$_REQUEST['fault_code'];
|
|
|
|
$q=mysql_query("SELECT AsText(line) from usgs_fault_lines where fault_code=$fault_code");
|
|
|
|
if (mysql_num_rows($q))
|
|
{
|
|
while($e=mysql_fetch_assoc($q))
|
|
$output[]=$e;
|
|
print(json_encode($output));
|
|
}
|
|
else{
|
|
print("ko");
|
|
}
|
|
|
|
mysql_close();
|
|
?>
|