25 lines
733 B
PHP
25 lines
733 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);
|
|
}
|
|
|
|
$q=mysql_query("SELECT geo_index as geo,pop_index as pop,DATE_FORMAT(date,'%e-%b') as dat FROM pressure where ID mod 3 = 0 order by date DESC limit 240");
|
|
|
|
while($e=mysql_fetch_assoc($q))
|
|
|
|
$output[]=$e;
|
|
|
|
print(json_encode($output));
|
|
|
|
mysql_close();
|
|
?>
|