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

95 lines
No EOL
3.1 KiB
PHP

<?php
error_reporting(E_ALL); ini_set('display_errors',0);
$kw_aktuell = (int)date('W');
$jahr = (int)date('Y');
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);
mysqli_set_charset($GLOBALS['mysql'], 'utf8');
header("Content-Type: text/html; charset=utf-8");
// $url='https://api.ilonexs.de/php/schnittstellen_url.php?api=MbL~9X2kZU~&schnittstelle=5&wz=1&gefl=1&preis=1&ta=1';
$url='iloroute.csv';
// $plz=$GLOBALS['mysql']->query_plz("SELECT ilonexs_route.plz,ilonexs_route.test,ilonexs_route.stadt FROM ilonexs_route WHERE ilonexs_route.test!=1 ORDER BY plz DESC LIMIT 0,1000");
$plz=$GLOBALS['mysql']->query_plz("SELECT ilonexs_route.plz,ilonexs_route.test,ilonexs_route.stadt FROM ilonexs_route WHERE ilonexs_route.test!=1 ORDER BY plz");
// echo "<pre>"; print_r($plz); echo "</pre>";
/*
[0] => DE
[1] => Plzvon
[2] => Plzbis
[3] => Kuerzel
[4] => Linie
[5] => Laufzeit
[6] => WZ
[7] => Gefluegel
[8] => Gesperrt
[9] => TA
[10] => Preis
[11] => KGBis
[12] => JePreis
[13] => JeGewicht
*/
$file = fopen($url,"r");
while(! feof($file)) {
$test=fgetcsv($file, null, ';');
if ($test[0]='DE') {
for ($i = $test[1]; $i <= $test[2]; $i++ ) { //echo($i).'-</br>';
/*
if(isset($plz[$i])) { echo($plz[$i]).'-</br>';
$ilocode=substr($test[3], -3,3);
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET kuerzel='".$test[3]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET station='".$ilocode."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET linie='".$test[4]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET laufzeit='".$test[5]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET wz='".$test[6]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET gefluegel='".$test[7]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET gesperrt='".$test[8]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET ta='".$test[9]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET preis='".$test[10]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET biskg='".$test[11]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET jepreis='".$test[12]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET jegewicht='".$test[13]."' WHERE plz='".$i."'");
$GLOBALS['mysql']->sql("UPDATE ilonexs_route SET test='1' WHERE plz='".$i."'");
echo $plz['plz'].' '.$plz['stadt'].' '.$ilocode.'</br>';
}
*/
}
echo '------------------</br>';
}
// echo "<pre>"; print_r($test); echo "</pre>";
}
fclose($file);
//----------------------------------------------------------------------------------------------------------------
//echo "<pre>"; print_r($xmldata); echo "</pre>";
//echo "<pre>"; print_r($output); echo "</pre>";
?>