From a73b481809758495d536de69803cc34647b156b8 Mon Sep 17 00:00:00 2001 From: dorian Date: Mon, 15 Jul 2019 20:42:06 +0200 Subject: [PATCH] fixed location data fix --- api/blueweather.php | 6 ++++++ api/json.php | 7 +------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/blueweather.php b/api/blueweather.php index 66a49d4..b7623e8 100644 --- a/api/blueweather.php +++ b/api/blueweather.php @@ -120,6 +120,12 @@ class BlueWeather */ function getLocationData($locId, $range, $maxVals) { + + $locId = $this->_con->real_escape_string($locId); + $range["from"] = $this->_con->real_escape_string($range["from"]); + $range["to"] = $this->_con->real_escape_string($range["to"]); + $maxVals = $this->_con->real_escape_string($maxVals); + $sql = "SELECT * FROM `locations` WHERE`id`=$locId"; $result = $this->_con->query($sql); diff --git a/api/json.php b/api/json.php index 45ab14b..f58c536 100644 --- a/api/json.php +++ b/api/json.php @@ -26,12 +26,7 @@ $blueweather = new BlueWeather($config); if (isset($_GET['locId'])) { // get data of given location - $locId = $con->real_escape_string($_GET['locId']); - $range['from'] = $con->real_escape_string($_GET['range']['from']); - $range['to'] = $con->real_escape_string($_GET['range']['to']); - $maxVals = $con->real_escape_string($_GET['maxVals']); - - $data = getLocationData($locId, $range, $maxVals); + $data = getLocationData($_GET['locId'], $_GET['range'], $_GET['maxVals']); } else { $data = $blueweather->getAllLocations(); }