Add geocache search, add placeholder files, rearrange settings
parent
d0cc2b6fc1
commit
9decd046ec
@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$database = new medoo([
|
$database = new medoo([
|
||||||
'database_type' => 'mysql',
|
'database_type' => 'mysql',
|
||||||
'database_name' => 'c0terranquest',
|
'database_name' => 'c0terranquest',
|
||||||
'server' => 'localhost',
|
'server' => 'localhost',
|
||||||
'username' => 'c0terranquest',
|
'username' => 'c0terranquest',
|
||||||
'password' => 'qinkifTQ!OMY2',
|
'password' => 'qinkifTQ!OMY2',
|
||||||
'charset' => 'utf8'
|
'charset' => 'latin1'
|
||||||
]);
|
]);
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require 'required.php';
|
||||||
|
|
||||||
|
$okapi = "http://opencaching.us/okapi/";
|
||||||
|
|
||||||
|
if (is_empty($VARS['lat']) || is_empty($VARS['long'])) {
|
||||||
|
sendError("Missing information.", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/-?[0-9]{1,3}\.[0-9]{3,}/', $VARS['lat'])) {
|
||||||
|
sendError("Latitude (lat) is in the wrong format.", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/-?[0-9]{1,3}\.[0-9]{3,}/', $VARS['long'])) {
|
||||||
|
sendError("Longitude (long) is in the wrong format.", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$lat = $VARS['lat'];
|
||||||
|
$long = $VARS['long'];
|
||||||
|
|
||||||
|
$limit = 25;
|
||||||
|
if (!is_empty($VARS['limit']) && is_numeric($VARS['limit'])) {
|
||||||
|
$limit = intval($VARS['limit']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = file_get_contents($okapi . "services/caches/search/nearest?center=" . $lat . "|" . $long . "&limit=" . $limit . "&consumer_key=" . GEOCACHE_KEY);
|
||||||
|
|
||||||
|
if (!$json)
|
||||||
|
sendError("Something went wrong, try again later.", true);
|
||||||
|
|
||||||
|
$caches = json_decode($json)->results;
|
||||||
|
|
||||||
|
$list = "";
|
||||||
|
foreach ($caches as $val) {
|
||||||
|
$list .= $val . "|";
|
||||||
|
}
|
||||||
|
echo file_get_contents($okapi . "services/caches/geocaches?consumer_key=" . GEOCACHE_KEY . "&cache_codes=" . rtrim($list, "|"));
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require 'required.php';
|
||||||
|
|
||||||
|
if (is_empty($VARS['user'])) {
|
||||||
|
sendError("Missing data.", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inv = $database->select('items', ['[>]inventory' => ['itemid' => 'itemid'], '[>]itemclasses' => ['classid', 'classid']], ['inventory.itemuuid', 'inventory.itemid', 'inventory.itemjson', 'items.itemname', 'items.itemdesc', 'itemclasses.classid', 'itemclasses.classname'], ['inventory.playeruuid' => file_get_contents("https://sso.netsyms.com/api/getguid.php?user=" . $VARS['user'])]);
|
||||||
|
|
||||||
|
$out['status'] = 'OK';
|
||||||
|
$out['items'] = $inv;
|
||||||
|
echo json_encode($out);
|
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
@ -1,10 +1,60 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$msgs = $database->select('messages', ['username', 'message', 'time'], ['AND' => [
|
/*
|
||||||
'lat[>]' => $searchbounds[0]->getLatitudeInDegrees(),
|
Coordinate decimal places to earth resolution
|
||||||
'lat[<]' => $searchbounds[1]->getLatitudeInDegrees(),
|
decimal
|
||||||
'long[>]' => $searchbounds[0]->getLongitudeInDegrees(),
|
places degrees distance
|
||||||
'long[<]' => $searchbounds[1]->getLongitudeInDegrees()],
|
------- ------- --------
|
||||||
"ORDER" => "time DESC",
|
0 1 111 km
|
||||||
"LIMIT" => 30
|
1 0.1 11.1 km
|
||||||
]);
|
2 0.01 1.11 km
|
||||||
|
3 0.001 111 m
|
||||||
|
4 0.0001 11.1 m
|
||||||
|
5 0.00001 1.11 m
|
||||||
|
6 0.000001 11.1 cm
|
||||||
|
7 0.0000001 1.11 cm
|
||||||
|
8 0.00000001 1.11 mm
|
||||||
|
*/
|
||||||
|
|
||||||
|
require 'required.php';
|
||||||
|
|
||||||
|
use AnthonyMartin\GeoLocation\GeoLocation as GeoLocation;
|
||||||
|
|
||||||
|
if (is_empty($VARS['lat']) || is_empty($VARS['long'])) {
|
||||||
|
sendError("Missing information.", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/-?[0-9]{1,3}\.[0-9]{3,}/', $VARS['lat'])) {
|
||||||
|
sendError("Latitude (lat) is in the wrong format.", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/-?[0-9]{1,3}\.[0-9]{3,}/', $VARS['long'])) {
|
||||||
|
sendError("Longitude (long) is in the wrong format.", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$radius = 1;
|
||||||
|
if (!is_empty($VARS['radius']) && is_numeric($VARS['radius'])) {
|
||||||
|
$radius = intval($VARS['radius']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$userlocation = GeoLocation::fromDegrees($VARS['lat'], $VARS['long']);
|
||||||
|
$searchbounds = $userlocation->boundingCoordinates($radius, 'miles');
|
||||||
|
|
||||||
|
|
||||||
|
$people = $database->select('players', ['uuid', 'level', 'latitude', 'longitude', 'lastping'], ['AND' => [
|
||||||
|
'latitude[>]' => $searchbounds[0]->getLatitudeInDegrees(),
|
||||||
|
'latitude[<]' => $searchbounds[1]->getLatitudeInDegrees(),
|
||||||
|
'longitude[>]' => $searchbounds[0]->getLongitudeInDegrees(),
|
||||||
|
'longitude[<]' => $searchbounds[1]->getLongitudeInDegrees(),
|
||||||
|
'#lastping[>]' => 'DATE_SUB(NOW(), INTERVAL 5 MINUTE)'],
|
||||||
|
"LIMIT" => 50
|
||||||
|
]);
|
||||||
|
var_dump($database->error());
|
||||||
|
if (!$people) {
|
||||||
|
die('[]');
|
||||||
|
}
|
||||||
|
for ($i = 0; $i < count($people); $i++) {
|
||||||
|
$people[$i]['username'] = file_get_contents('https://sso.netsyms.com/api/getname.php?uuid=' . $people[$i]['uuid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($people);
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
define("DB_TYPE", "mysql");
|
||||||
|
define("DB_NAME", "c0terranquest");
|
||||||
|
define("DB_SERVER", "localhost");
|
||||||
|
define("DB_USER", "c0terranquest");
|
||||||
|
define("DB_PASS", "qinkifTQ!OMY2");
|
||||||
|
define("DB_CHARSET", "latin1");
|
||||||
|
define("GEOCACHE_KEY", "z6BxjV5ssS7DYrzfF7pw");
|
Reference in New Issue