Update player location and lastping when we get a lat/lng from them
This commit is contained in:
parent
e8ab312ff8
commit
dc52028474
@ -10,6 +10,15 @@ use AnthonyMartin\GeoLocation\GeoLocation as GeoLocation;
|
|||||||
|
|
||||||
$userlocation = GeoLocation::fromDegrees($VARS["latitude"], $VARS["longitude"]);
|
$userlocation = GeoLocation::fromDegrees($VARS["latitude"], $VARS["longitude"]);
|
||||||
|
|
||||||
|
// Update player ping/location
|
||||||
|
$database->update("players", [
|
||||||
|
"latitude" => $VARS["latitude"],
|
||||||
|
"longitude" => $VARS["longitude"],
|
||||||
|
"lastping" => date("Y-m-d H:i:s")
|
||||||
|
], [
|
||||||
|
"accountid" => getRequestUser()->getUID()
|
||||||
|
]);
|
||||||
|
|
||||||
$radius = 2;
|
$radius = 2;
|
||||||
if (!empty($VARS["radius"])) {
|
if (!empty($VARS["radius"])) {
|
||||||
$radius = min(10.0, $VARS["radius"] * 1.0);
|
$radius = min(10.0, $VARS["radius"] * 1.0);
|
||||||
|
@ -6,6 +6,15 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Update player ping/location
|
||||||
|
$database->update("players", [
|
||||||
|
"latitude" => $VARS["latitude"],
|
||||||
|
"longitude" => $VARS["longitude"],
|
||||||
|
"lastping" => date("Y-m-d H:i:s")
|
||||||
|
], [
|
||||||
|
"accountid" => getRequestUser()->getUID()
|
||||||
|
]);
|
||||||
|
|
||||||
$radius = 0.5;
|
$radius = 0.5;
|
||||||
|
|
||||||
if (!empty($VARS["radius"])) {
|
if (!empty($VARS["radius"])) {
|
||||||
@ -60,4 +69,4 @@ foreach ($nearby as $n) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
exitWithJson($geojson);
|
exitWithJson($geojson);
|
||||||
|
@ -10,6 +10,15 @@ use AnthonyMartin\GeoLocation\GeoLocation as GeoLocation;
|
|||||||
|
|
||||||
$userlocation = GeoLocation::fromDegrees($VARS["latitude"], $VARS["longitude"]);
|
$userlocation = GeoLocation::fromDegrees($VARS["latitude"], $VARS["longitude"]);
|
||||||
|
|
||||||
|
// Update player ping/location
|
||||||
|
$database->update("players", [
|
||||||
|
"latitude" => $VARS["latitude"],
|
||||||
|
"longitude" => $VARS["longitude"],
|
||||||
|
"lastping" => date("Y-m-d H:i:s")
|
||||||
|
], [
|
||||||
|
"accountid" => getRequestUser()->getUID()
|
||||||
|
]);
|
||||||
|
|
||||||
$radius = 2;
|
$radius = 2;
|
||||||
if (!empty($VARS["radius"])) {
|
if (!empty($VARS["radius"])) {
|
||||||
$radius = min(10.0, $VARS["radius"] * 1.0);
|
$radius = min(10.0, $VARS["radius"] * 1.0);
|
||||||
|
@ -19,4 +19,13 @@ $database->insert('messages', [
|
|||||||
'accountid' => getRequestUser()->getUID()
|
'accountid' => getRequestUser()->getUID()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Update player ping/location
|
||||||
|
$database->update("players", [
|
||||||
|
"latitude" => $VARS["latitude"],
|
||||||
|
"longitude" => $VARS["longitude"],
|
||||||
|
"lastping" => date("Y-m-d H:i:s")
|
||||||
|
], [
|
||||||
|
"accountid" => getRequestUser()->getUID()
|
||||||
|
]);
|
||||||
|
|
||||||
sendJsonResp();
|
sendJsonResp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user