Add hoodfile via hoodid

This commit is contained in:
Robert 2023-09-04 23:38:45 +02:00
parent c6d416fd9a
commit 360b41e3c0
2 changed files with 17 additions and 6 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

View File

@ -1,10 +1,15 @@
<?php
$lat = $_GET['lat'];
$lo = $_GET['long'];
if ((!is_numeric($lat)) || (!is_numeric($lo))) {exit("lat/long not numeric!");};
$hoodfile = shell_exec("./get_hood.sh $lat $lo");
$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;
?>