diff --git a/config.inc.php b/config.inc.php index 0aabd58..100a90c 100644 --- a/config.inc.php +++ b/config.inc.php @@ -5,5 +5,6 @@ $allowedHost = array( "denisnotebook", "app.gruppolapastamadre.it", "dev.gruppolapastamadre.it", + "blog.gruppolapastamadre.it", "management.gruppolapastamadre.it" ); diff --git a/include.php b/include.php index aae1e0e..945b365 100644 --- a/include.php +++ b/include.php @@ -21,13 +21,18 @@ $app->hook('slim.before.router', function () use ($app, $allowedHost) { if(!in_array($currentRefererRequest, $allowedHost)) { $app->halt(500, "Generic error occurred"); + return; } $currentHostRequest = $app->request()->getHost(); if(!in_array($currentHostRequest, $allowedHost)) { $app->halt(403, "Request arrive from host not allowed " . $currentHostRequest ); + return; } + + if(isset($_SERVER['HTTP_ORIGIN'])) + header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']); }); diff --git a/spacciatoripm.php b/spacciatoripm.php index f0267ef..90d65dd 100644 --- a/spacciatoripm.php +++ b/spacciatoripm.php @@ -78,7 +78,7 @@ $app->get('/spacciatori/kml', function () use ($app) { $app->get('/spacciatori/bound/:FromLat/:FromLng/:ToLat/:ToLng', function ($FromLat, $FromLng, $ToLat, $ToLng) use ($app) { $callbackFn = $app->request()->get('callback'); $mysqlconnetion = new MysqlClass; - $query = "SELECT Name, Email, CONCAT(Comune, ', ', Cap, ' - ', Provincia) as Indirizzo, Latitudine, Longitudine, TipoPM FROM `profilo` " . + $query = "SELECT ProfiloID as ID, Name, Email, CONCAT(Comune, ', ', Cap, ' - ', Provincia) as Indirizzo, Latitudine, Longitudine, TipoPM FROM `profilo` " . "where bSpacciatore = 1 AND " . "Latitudine BETWEEN " . $ToLat . " AND " . $FromLat . " AND ". "Longitudine BETWEEN " . $ToLng . " AND " . $FromLng;