add position: improve parameters checking
This commit is contained in:
parent
e448651e07
commit
619ef59f51
@ -92,7 +92,7 @@ switch ($action) {
|
|||||||
$imageId = isset($_REQUEST["imageid"]) ? $_REQUEST["imageid"] : NULL;
|
$imageId = isset($_REQUEST["imageid"]) ? $_REQUEST["imageid"] : NULL;
|
||||||
$trackId = isset($_REQUEST["trackid"]) ? $_REQUEST["trackid"] : NULL;
|
$trackId = isset($_REQUEST["trackid"]) ? $_REQUEST["trackid"] : NULL;
|
||||||
|
|
||||||
if (is_null($lat) || is_null($lon) || is_null($timestamp) || is_null($trackId)) {
|
if (!is_numeric($lat) || !is_numeric($lon) || !is_numeric($timestamp) || !is_numeric($trackId)) {
|
||||||
setError($response, "Missing required parameter");
|
setError($response, "Missing required parameter");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
$altitude = NULL, $speed = NULL, $bearing = NULL, $accuracy = NULL,
|
$altitude = NULL, $speed = NULL, $bearing = NULL, $accuracy = NULL,
|
||||||
$provider = NULL, $comment = NULL, $imageId = NULL) {
|
$provider = NULL, $comment = NULL, $imageId = NULL) {
|
||||||
$positionId = false;
|
$positionId = false;
|
||||||
if (!is_null($lat) && !is_null($lon) && !is_null($timestamp) && !empty($userId) && !empty($trackId)) {
|
if (is_numeric($lat) && is_numeric($lon) && is_numeric($timestamp) && is_numeric($userId) && is_numeric($trackId)) {
|
||||||
$track = new uTrack($trackId);
|
$track = new uTrack($trackId);
|
||||||
if ($track->isValid && $track->userId == $userId) {
|
if ($track->isValid && $track->userId == $userId) {
|
||||||
$query = "INSERT INTO `" . self::db()->table('positions') . "`
|
$query = "INSERT INTO `" . self::db()->table('positions') . "`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user