places.php now has owner data, players can be kicked with a message
This commit is contained in:
parent
84413765f7
commit
1ab5de66d9
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
error/
|
error/
|
||||||
stats/
|
stats/
|
||||||
vendor/
|
vendor/
|
||||||
settings.php
|
settings.php
|
||||||
*.log
|
*.log
|
||||||
database.mwb.bak
|
database.mwb.bak
|
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
24
ping.php
24
ping.php
@ -2,22 +2,36 @@
|
|||||||
|
|
||||||
require 'required.php';
|
require 'required.php';
|
||||||
|
|
||||||
require 'onlyloggedin.php';
|
if ($_SESSION['loggedin'] != true) {
|
||||||
|
sendError('Your session has expired. Please log in again.', true);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (is_empty($VARS['lat']) || is_empty($VARS['long'])) {
|
if (is_empty($VARS['lat']) || is_empty($VARS['long'])) {
|
||||||
sendError("Missing data.", true);
|
sendOK("Missing data.", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/-?[0-9]{1,3}\.[0-9]{4,}/', $VARS['lat'])) {
|
if (!preg_match('/-?[0-9]{1,3}\.[0-9]{4,}/', $VARS['lat'])) {
|
||||||
sendError("Latitude (lat) is in the wrong format.", true);
|
sendOK("Latitude (lat) is in the wrong format.", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/-?[0-9]{1,3}\.[0-9]{4,}/', $VARS['long'])) {
|
if (!preg_match('/-?[0-9]{1,3}\.[0-9]{4,}/', $VARS['long'])) {
|
||||||
sendError("Longitude (long) is in the wrong format.", true);
|
sendOK("Longitude (long) is in the wrong format.", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$uuid = $_SESSION['uuid'];
|
$uuid = $_SESSION['uuid'];
|
||||||
|
|
||||||
|
// Kick user out of game
|
||||||
|
$kick = $database->select('players', ['kick'], ['uuid' => $uuid])[0]['kick'];
|
||||||
|
if (!is_empty($kick)) {
|
||||||
|
$_SESSION['loggedin'] = false;
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
$database->update('players', ['kick' => ''], ['uuid' => $uuid]);
|
||||||
|
sendError($kick, true);
|
||||||
|
}
|
||||||
|
|
||||||
$database->update('players', ['latitude' => $VARS['lat'], 'longitude' => $VARS['long'], '#lastping' => 'NOW()'], ['uuid' => $uuid]);
|
$database->update('players', ['latitude' => $VARS['lat'], 'longitude' => $VARS['long'], '#lastping' => 'NOW()'], ['uuid' => $uuid]);
|
||||||
|
|
||||||
sendOK();
|
sendOK();
|
||||||
|
@ -58,11 +58,13 @@ foreach ($places as $place) {
|
|||||||
if (!$database->has('locations', ['osmid' => $osmid])) {
|
if (!$database->has('locations', ['osmid' => $osmid])) {
|
||||||
$database->insert('locations', ['osmid' => $osmid, 'teamid' => 0]);
|
$database->insert('locations', ['osmid' => $osmid, 'teamid' => 0]);
|
||||||
}
|
}
|
||||||
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'currentlife', 'maxlife'], ['osmid' => $osmid])[0];
|
$gameinfo = $database->select('locations', ["[>]players" => ["owneruuid" => "uuid"]], ['locations.locationid', 'players.nickname', 'locations.teamid', 'locations.currentlife', 'locations.maxlife'], ['osmid' => $osmid])[0];
|
||||||
|
//$gameinfo = $database->select('locations', ['locationid', 'teamid', 'currentlife', 'maxlife'], ['osmid' => $osmid])[0];
|
||||||
// Reset owner info for dead places
|
// Reset owner info for dead places
|
||||||
if ($gameinfo['currentlife'] <= 0) {
|
if ($gameinfo['currentlife'] <= 0) {
|
||||||
$database->update('locations', ['teamid' => 0, 'owneruuid' => null], ['locationid' => $gameinfo['locationid']]);
|
$database->update('locations', ['teamid' => 0, 'owneruuid' => null, 'maxlife' => 0], ['locationid' => $gameinfo['locationid']]);
|
||||||
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'currentlife', 'maxlife'], ['osmid' => $osmid])[0];
|
$gameinfo = $database->select('locations', ['locationid', 'teamid', 'currentlife', 'maxlife'], ['osmid' => $osmid])[0];
|
||||||
|
$gameinfo['nickname'] = "";
|
||||||
}
|
}
|
||||||
$geo['features'][] = array("type" => "Feature",
|
$geo['features'][] = array("type" => "Feature",
|
||||||
"geometry" => [
|
"geometry" => [
|
||||||
|
@ -11,10 +11,10 @@ header("Access-Control-Allow-Origin: *");
|
|||||||
|
|
||||||
if (strtolower($_GET['format']) == 'plain') {
|
if (strtolower($_GET['format']) == 'plain') {
|
||||||
define("JSON", false);
|
define("JSON", false);
|
||||||
header('Content-Type: text/plain');
|
header('Content-Type: text/plain; charset=utf-8');
|
||||||
} else {
|
} else {
|
||||||
define("JSON", true);
|
define("JSON", true);
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Composer
|
// Composer
|
||||||
|
@ -24,4 +24,15 @@ define("GIS_API_KEY", "");
|
|||||||
define("GOOGLEPLAY_PUBLICKEY", "");
|
define("GOOGLEPLAY_PUBLICKEY", "");
|
||||||
define("APP_STORE_SANDBOX", true);
|
define("APP_STORE_SANDBOX", true);
|
||||||
|
|
||||||
define("DARKSKY_APIKEY", "");
|
define("DARKSKY_APIKEY", "");
|
||||||
|
|
||||||
|
// Admin control panel login
|
||||||
|
define("ADMIN_USER", "");
|
||||||
|
define("ADMIN_PASS", "");
|
||||||
|
|
||||||
|
// Geocoding API key for admin panel lookups
|
||||||
|
define("MAPQUEST_KEY", "");
|
||||||
|
|
||||||
|
// Used for timestamps in the admin panel.
|
||||||
|
// For supported values, see http://php.net/manual/en/timezones.php
|
||||||
|
define("TIMEZONE", "UTC");
|
Reference in New Issue
Block a user