Add location broadcast (Netsyms/HelpingHelenaApp/issues/5)
parent
b15c2a0b99
commit
3af45b33d0
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
$accountid = $database->get("authkeys", "accountid", ["key" => $VARS["key"]]);
|
||||
|
||||
if (!$database->has("accounts", ["AND" => ["accountid" => $accountid, "type" => 2]])) {
|
||||
sendJsonResp($Strings->get("Only receivers may broadcast their location to the map.", false), "ERROR");
|
||||
}
|
||||
|
||||
$database->update("accounts", [
|
||||
"latitude" => $VARS["latitude"],
|
||||
"longitude" => $VARS["longitude"],
|
||||
"lastgpsfix" => date("Y-m-d H:i:s")
|
||||
], ["accountid" => $accountid]);
|
||||
|
||||
sendJsonResp();
|
Loading…
Reference in New Issue