add index.php with get_hood_by_id

The routers pull "URL/index.php?lat&log"
So index.php is needed.

Signed-off-by: Robert Langhammer <rlanghammer@web.de>
This commit is contained in:
Robert Langhammer 2024-01-20 12:47:51 +01:00
parent c64fcef377
commit 1fae580e59
2 changed files with 21 additions and 0 deletions

6
get_hoodid.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
hoodfile=$(grep -l "id\": \"$1\"" hood/* )
[ -z $hoodfile ] && echo "no hood $1" && exit
cat $hoodfile

15
index.php Normal file
View File

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