73 lines
1.9 KiB
PHP
73 lines
1.9 KiB
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);
|
|
}
|
|
|
|
$sql1=mysql_query("select count(*) as count_earthquakes from earthquakes where donotshow=0 AND ban<5");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
$sql1=mysql_query("select count(*) as count_green from notifications where latitude<>0 AND longitude<>0 AND enabled=1");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
$sql1=mysql_query("select count(*) as count_red from notifications_notactive where latitude<>0 AND longitude<>0 AND enabled=0");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
$sql1=mysql_query("select count(*) as count_manual_green from manual where magnitude=1 and ban<3 and donotshow=0 and date > date_sub(now(), interval 1440 minute)");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
$sql1=mysql_query("select count(*) as count_manual_yellow from manual where magnitude=2 and ban<3 and donotshow=0 and date > date_sub(now(), interval 1440 minute)");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
$sql1=mysql_query("select count(*) as count_manual_red from manual where magnitude=3 and ban<3 and donotshow=0 and date > date_sub(now(), interval 1440 minute)");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
$sql1=mysql_query("select 0 as count_automatic");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
$sql1=mysql_query("select 'Update app' as message");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
$sql1=mysql_query("select 0 as count_automatic24");
|
|
|
|
$e=mysql_fetch_assoc($sql1);
|
|
|
|
$output[]=$e;
|
|
|
|
print(json_encode($output));
|
|
|
|
mysql_close();
|
|
?>
|