33 lines
1016 B
PHP
33 lines
1016 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);
|
|
}
|
|
|
|
$lat_min=$_REQUEST['lat_min'];
|
|
$lat_max=$_REQUEST['lat_max'];
|
|
$lon_min=$_REQUEST['lon_min'];
|
|
$lon_max=$_REQUEST['lon_max'];
|
|
|
|
$q=mysql_query("SELECT code,name,age,Y(location) as latitude,X(location) as longitude from usgs_faults where X(location)>=$lon_min and X(location)<=$lon_max and Y(location)>=$lat_min and Y(location)<=$lat_max");
|
|
|
|
if (mysql_num_rows($q))
|
|
{
|
|
while($e=mysql_fetch_assoc($q))
|
|
$output[]=$e;
|
|
print(json_encode($output));
|
|
}
|
|
else{
|
|
print("nothing");
|
|
}
|
|
|
|
mysql_close();
|
|
?>
|