Allow numeric and empty coordinates

Unconfigured routers are sending empty coordinates to recieve the trainstation data.

Signed-off-by: Robert Langhammer <rlanghammer@web.de>
This commit is contained in:
Robert Langhammer 2024-01-21 21:32:24 +01:00
parent 4e1376ce2e
commit c3100899bf
1 changed files with 19 additions and 0 deletions

19
index.php Normal file
View File

@ -0,0 +1,19 @@
<?php
$lat = $_GET['lat'] ?? null;
$lo = $_GET['long'] ?? null;
$hoodid = $_GET['hoodid'] ?? null;
if (empty($hoodid)) {
if (preg_match("/^[0-9.]*$/", $lat) and preg_match("/^[0-9.]*$/", $lo)) {
$hoodfile = shell_exec("./get_hood.sh $lat $lo");
}
else {
echo "coordinates not numeric! ";
}
}
else {
if ((!is_numeric($hoodid))) {exit("hoodid not numeric!");};
$hoodfile = shell_exec("./get_hoodid.sh $hoodid");
}
echo $hoodfile;
?>