Files
EQN/appServer/distquake_status.php
2017-09-22 15:16:26 +02:00

30 lines
1.1 KiB
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);
}
$sql=mysql_query("delete from manual_notify where date < date_sub(now(), interval 30 minute)");
$sql=mysql_query("delete from contest_earthquakes_notify where date < date_sub(now(), interval 30 minute)");
$sql1=mysql_query("select count(*) as count from notifications where latitude<>0 AND longitude<>0 AND enabled=1");
$sql2=mysql_query("select count(*) as count from notifications_notactive where latitude<>0 AND longitude<>0");
$v1=mysql_result($sql1,0,"count");
$v2=mysql_result($sql2,0,"count");
$v3=round($v2*1.41);
$sql4=mysql_query("INSERT INTO status (enabled,geolocated,total) values ($v1,$v2,$v3)");
mysql_close();
?>