27 lines
770 B
PHP
27 lines
770 B
PHP
<?php
|
|
// Parse with sections
|
|
$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);
|
|
}
|
|
|
|
$sql=mysql_query("select ID from earthquakes where code='".$_REQUEST['code']."'");
|
|
if (mysql_num_rows($sql))
|
|
{
|
|
$id=mysql_result($sql,0,"ID");
|
|
mysql_query("update earthquakes SET ban = ban + 0 WHERE ID = $id");
|
|
}
|
|
|
|
$output[]="ok";
|
|
print(json_encode($output));
|
|
|
|
mysql_close();
|
|
?>
|