jb-data.de/timerechner.php
2025-08-11 22:23:30 +02:00

200 lines
17 KiB
PHP

<?php
error_reporting(E_ALL); ini_set('display_errors',1);
echo "test";
require('lib/config.php');
require('lib/mysql.class.php');
$GLOBALS['mysql'] = new mysql(CONFIG_MYSQL_HOST,CONFIG_MYSQL_USER,CONFIG_MYSQL_PW,CONFIG_MYSQL_DB);
//$GLOBALS['pisql'] = new mysql(CONFIG_PISQL_HOST,CONFIG_PISQL_USER,CONFIG_PISQL_PW,CONFIG_PISQL_DB,53306);
header("Content-Type: text/html; charset=utf-8");
//----------------------------------------------------------------------------------------------------------
//echo'<pre>'; print_r($node); echo'</pre>';
//----------------------------------------------------------------------------------------------------------
//date_default_timezone_set('Europe/London');
date_default_timezone_set('Europe/Berlin');
$jahr = (int)date('Y');
$monat = (int)date('n');
$tag = (int)date('j');
//----------------------------------------------------------------------------------------------------------------------------------------------------
/*
// ********************* Corona ********************************************************************************************************************
//----------------------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------- Stadt Leipzig -----------------------------------------------------------------------------------------------------
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=true&spatialRel=esriSpatialRelIntersects&objectIds=362&outFields=*&outSR=102100&cacheHint=true");
$test2 = json_decode($json, true);
$temp=0; $temp=$test2['features'][0]['attributes']['cases7_per_100k']; $GLOBALS['mysql']->query("UPDATE corona SET inzidenzen='".$temp."' WHERE id=1");
$status=1; //grün
if ($temp>25) { $status=2; } //orange
if ($temp>50) { $status=3; } //rot
if ($temp>100) { $status=4; } //dunkelrot
$GLOBALS['mysql']->insert("UPDATE corona SET status='".$status."' WHERE id=1");
//------ Leipzig Stadt
$temp=0; $temp=$test2['features'][0]['attributes']['cases']; $GLOBALS['mysql']->insert("UPDATE corona SET mutant='".$temp."' WHERE id=1");
$temp=0; $temp=$test2['features'][0]['attributes']['deaths']; $GLOBALS['mysql']->insert("UPDATE corona SET death='".$temp."' WHERE id=1");
$temp=0; $temp=$test2['features'][0]['attributes']['last_update']; $GLOBALS['mysql']->insert("UPDATE corona SET lastdate='".$temp."' WHERE id=1");
$temp=0; $temp=$test2['features'][0]['attributes']['last_update']; $GLOBALS['mysql']->insert("UPDATE corona SET lastdate='".$temp."' WHERE id=1");
//-------------------------------- Stadt Halle -----------------------------------------------------------------------------------------------------
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=true&spatialRel=esriSpatialRelIntersects&objectIds=366&outFields=*&outSR=102100&cacheHint=true");
$test2 = json_decode($json, true);
$temp=0; $temp=$test2['features'][0]['attributes']['cases7_per_100k']; $GLOBALS['mysql']->query("UPDATE corona SET inzidenzen='".$temp."' WHERE id=3");
$status=1; //grün
if ($temp>25) { $status=2; } //orange
if ($temp>50) { $status=3; } //rot
if ($temp>100) { $status=4; } //dunkelrot
$GLOBALS['mysql']->insert("UPDATE corona SET status='".$status."' WHERE id=3");
//------ Leipzig Stadt
$temp=0; $temp=$test2['features'][0]['attributes']['cases']; $GLOBALS['mysql']->insert("UPDATE corona SET mutant='".$temp."' WHERE id=3");
$temp=0; $temp=$test2['features'][0]['attributes']['deaths']; $GLOBALS['mysql']->insert("UPDATE corona SET death='".$temp."' WHERE id=3");
$temp=0; $temp=$test2['features'][0]['attributes']['last_update']; $GLOBALS['mysql']->insert("UPDATE corona SET lastdate='".$temp."' WHERE id=3");
$temp=0; $temp=$test2['features'][0]['attributes']['last_update']; $GLOBALS['mysql']->insert("UPDATE corona SET lastdate='".$temp."' WHERE id=3");
//-------------------------------- LK Leipzig -----------------------------------------------------------------------------------------------------
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?f=json&where=BL%3D%27Sachsen%27&returnGeometry=true&spatialRel=esriSpatialRelIntersects&objectIds=363&outFields=*&outSR=102100&cacheHint=true");
$test2 = json_decode($json, true);
$temp=0; $temp=$test2['features'][0]['attributes']['cases7_per_100k']; $GLOBALS['mysql']->query("UPDATE corona SET inzidenzen='".$temp."' WHERE id=5");
$status=1; //grün
if ($temp>25) { $status=2; } //orange
if ($temp>50) { $status=3; } //rot
if ($temp>100) { $status=4; } //dunkelrot
$GLOBALS['mysql']->insert("UPDATE corona SET status='".$status."' WHERE id=5");
//------ Leipzig Stadt
$temp=0; $temp=$test2['features'][0]['attributes']['cases']; $GLOBALS['mysql']->insert("UPDATE corona SET mutant='".$temp."' WHERE id=5");
$temp=0; $temp=$test2['features'][0]['attributes']['deaths']; $GLOBALS['mysql']->insert("UPDATE corona SET death='".$temp."' WHERE id=5");
$temp=0; $temp=$test2['features'][0]['attributes']['last_update']; $GLOBALS['mysql']->insert("UPDATE corona SET lastdate='".$temp."' WHERE id=5");
$temp=0; $temp=$test2['features'][0]['attributes']['last_update']; $GLOBALS['mysql']->insert("UPDATE corona SET lastdate='".$temp."' WHERE id=5");
//-------------------------------- LK Nordsachsen -----------------------------------------------------------------------------------------------------
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?f=json&where=BL%3D%27Sachsen%27&returnGeometry=true&spatialRel=esriSpatialRelIntersects&objectIds=364&outFields=*&outSR=102100&cacheHint=true");
$test2 = json_decode($json, true);
$temp=0; $temp=$test2['features'][0]['attributes']['cases7_per_100k']; $GLOBALS['mysql']->query("UPDATE corona SET inzidenzen='".$temp."' WHERE id=6");
$status=1; //grün
if ($temp>25) { $status=2; } //orange
if ($temp>50) { $status=3; } //rot
if ($temp>100) { $status=4; } //dunkelrot
$GLOBALS['mysql']->insert("UPDATE corona SET status='".$status."' WHERE id=6");
//------ Leipzig Stadt
$temp=0; $temp=$test2['features'][0]['attributes']['cases']; $GLOBALS['mysql']->insert("UPDATE corona SET mutant='".$temp."' WHERE id=6");
$temp=0; $temp=$test2['features'][0]['attributes']['deaths']; $GLOBALS['mysql']->insert("UPDATE corona SET death='".$temp."' WHERE id=6");
$temp=0; $temp=$test2['features'][0]['attributes']['last_update']; $GLOBALS['mysql']->insert("UPDATE corona SET lastdate='".$temp."' WHERE id=6");
$temp=0; $temp=$test2['features'][0]['attributes']['last_update']; $GLOBALS['mysql']->insert("UPDATE corona SET lastdate='".$temp."' WHERE id=6");
//----------------------------------------------------------------------------------------------------------
$GLOBALS['mysql']->insert("UPDATE corona SET savetime='".date("Y-m-d H:i:s", time())."'");
//----------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------ zuwachs Infizierte Leipzig
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=(NeuerFall%20IN(1%2C%20-1))%20AND%20(IdLandkreis%3D%2714713%27)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlFall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true");
$test3 = json_decode($json, true);
$temp=0; $temp=$test3['features'][0]['attributes']['value']; $GLOBALS['mysql']->query("UPDATE corona SET zu_mutant='".$temp."' WHERE id=1");
//------------------------------------------------------------------------ zuwachs Infizierte Halle
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=(NeuerFall%20IN(1%2C%20-1))%20AND%20(IdLandkreis%3D%2715002%27)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlFall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true");
$test3 = json_decode($json, true);
$temp=0; $temp=$test3['features'][0]['attributes']['value']; $GLOBALS['mysql']->query("UPDATE corona SET zu_mutant='".$temp."' WHERE id=3");
//------------------------------------------------------------------------ zuwachs LK Leipzig
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=(NeuerFall%20IN(1%2C%20-1))%20AND%20(IdLandkreis%3D%2714729%27)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlFall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true");
$test3 = json_decode($json, true);
$temp=0; $temp=$test3['features'][0]['attributes']['value']; $GLOBALS['mysql']->query("UPDATE corona SET zu_mutant='".$temp."' WHERE id=5");
//------------------------------------------------------------------------ zuwachs LK NS
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=(NeuerFall%20IN(1%2C%20-1))%20AND%20(IdLandkreis%3D%2714730%27)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlFall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true");
$test3 = json_decode($json, true);
$temp=0; $temp=$test3['features'][0]['attributes']['value']; $GLOBALS['mysql']->query("UPDATE corona SET zu_mutant='".$temp."' WHERE id=6");
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------ zuwachs tote Leipzig
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=(NeuerTodesfall%20IN(1%2C%20-1))%20AND%20(IdLandkreis%3D%2714713%27)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlTodesfall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true");
$test3 = json_decode($json, true);
$temp=0; $temp=$test3['features'][0]['attributes']['value']; $GLOBALS['mysql']->query("UPDATE corona SET zu_death='".$temp."' WHERE id=1");
//------------------------------------------------------------------------ zuwachs tote Halle
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=(NeuerTodesfall%20IN(1%2C%20-1))%20AND%20(IdLandkreis%3D%2715002%27)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlTodesfall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true");
$test3 = json_decode($json, true);
$temp=0; $temp=$test3['features'][0]['attributes']['value']; $GLOBALS['mysql']->query("UPDATE corona SET zu_death='".$temp."' WHERE id=3");
//------------------------------------------------------------------------ zuwachs tote LK Lpz
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=(NeuerTodesfall%20IN(1%2C%20-1))%20AND%20(IdLandkreis%3D%2714729%27)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlTodesfall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true");
$test3 = json_decode($json, true);
$temp=0; $temp=$test3['features'][0]['attributes']['value']; $GLOBALS['mysql']->query("UPDATE corona SET zu_death='".$temp."' WHERE id=5");
//------------------------------------------------------------------------ zuwachs tote NS
$json = file_get_contents("https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=(NeuerTodesfall%20IN(1%2C%20-1))%20AND%20(IdLandkreis%3D%2714730%27)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlTodesfall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true");
$test3 = json_decode($json, true);
$temp=0; $temp=$test3['features'][0]['attributes']['value']; $GLOBALS['mysql']->query("UPDATE corona SET zu_death='".$temp."' WHERE id=6");
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
// saso anpassen
/*
$laufend2 = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE time < 10000 and typ = 8");
while($row = $laufend2->fetch_assoc()) {
$teile[0]=0; $teile[1]=0;
$teile = explode(":", $row['zeit']);
$startzeit=mktime((int)$teile[0],(int)$teile[1], 0,(int)$row['monat'],(int)$row['tag'],(int)$row['jahr']);
$wochentag = date("N", $startzeit);
if ($teile[0]>19) {
//echo $wochentag;
if ($wochentag==7) {
echo date("d,m,y",$startzeit-86400);
$GLOBALS['mysql']->insert("UPDATE tourenliste SET tag='".date("d",$startzeit-86400)."' WHERE id='".$row['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET monat='".date("m",$startzeit-86400)."' WHERE id='".$row['id']."'");
$GLOBALS['mysql']->insert("UPDATE tourenliste SET jahr='".date("Y",$startzeit-86400)."' WHERE id='".$row['id']."'");
}
}
}
*/
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
// zeitrechnung
//----------------------------------------------------------------------------------------------------------
$laufend3 = $GLOBALS['mysql']->query("SELECT * FROM fplaner WHERE timestamp < 1");
while($row = $laufend3->fetch_assoc()) {
$startzeit=mktime(0,0,0, $row['monat'],$row['tag'],$row['jahr']);
$GLOBALS['mysql']->insert("UPDATE fplaner SET timestamp='".date("Y-m-d H:i:s", $startzeit)."' WHERE pid='".$row['pid']."'");
}
$laufend4 = $GLOBALS['mysql']->query("SELECT * FROM planer WHERE timestamp < 1");
while($row = $laufend4->fetch_assoc()) {
$startzeit=mktime(0,0,0, $row['monat'],$row['tag'],$row['jahr']);
$GLOBALS['mysql']->insert("UPDATE planer SET timestamp='".date("Y-m-d H:i:s", $startzeit)."' WHERE pid='".$row['pid']."'");
}
$laufend5 = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE time < 10000");
while($row = $laufend5->fetch_assoc()) {
$teile[0]=0; $teile[1]=0;
$teile = explode(":", $row['zeit']);
$startzeit=mktime((int)$teile[0],(int)$teile[1], 0,(int)$row['monat'],(int)$row['tag'],(int)$row['jahr']);
$GLOBALS['mysql']->insert("UPDATE tourenliste SET time='".$startzeit."' WHERE id='".$row['id']."'");
}
$laufend7 = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE timestamp < 10000");
while($row = $laufend7->fetch_assoc()) { $teile[0]=0; $teile[1]=0;
if((int)$row['zeit']>0) { $teile = explode(":", $row['zeit']); } else { $teile[0]=0; $teile[1]=0; }
$startzeit=mktime((int)$teile[0],(int)$teile[1], 0,(int)$row['monat'],(int)$row['tag'],(int)$row['jahr']);
$GLOBALS['mysql']->insert("UPDATE tourenliste SET timestamp='".date("Y-m-d H:i:s", $startzeit)."' WHERE id='".$row['id']."'");
}
$laufend0 = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE monat='".date("m")."' and jahr='".date("Y")."' and typ>6");
if($laufend0['num_rows']>0) { // gibt es einträge ???????????????
$laufend9 = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE monat='".date("m")."' and jahr='".date("Y")."' and typ>6");
while($row = $laufend9->fetch_assoc()) {
if((int)$row['zeit']>0) { $teile = explode(":", $row['zeit']); } else { $teile[0]=0; $teile[1]=0; }
$startzeit=mktime((int)$teile[0],(int)$teile[1], 0,(int)$row['monat'],(int)$row['tag'],(int)$row['jahr']);
$GLOBALS['mysql']->insert("UPDATE tourenliste SET time='".$startzeit."' WHERE id='".$row['id']."'");
//echo'<pre>'; print_r($row); echo'</pre>';
}
}
echo"fertig_zeitrechner";
?>