Add giveitem.php
This commit is contained in:
parent
60c8354ba0
commit
a8735c03aa
@ -8,11 +8,11 @@ if (is_empty($VARS['user'])) {
|
||||
sendError("Missing data.", true);
|
||||
}
|
||||
|
||||
$stats = $database->select('players', ['level', 'energy', 'maxenergy', 'teamid', 'lastping'], ['uuid' => file_get_contents("https://sso.netsyms.com/api/getguid.php?user=" . $VARS['user'])])[0];
|
||||
$stats = $database->select('players', ['level', 'energy', 'maxenergy', 'teamid', 'lastping'], ['uuid' => $_SESSION['uuid']])[0];
|
||||
|
||||
|
||||
$out = [];
|
||||
$out['status'] = 'OK';
|
||||
$out['stats'] = $stats;
|
||||
$out['stats']['lastping'] = 0;
|
||||
echo json_encode($out);
|
||||
echo json_encode($out);
|
||||
|
20
giveitem.php
Normal file
20
giveitem.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require 'required.php';
|
||||
require 'onlyloggedin.php';
|
||||
|
||||
$itemuuid = $VARS['itemuuid'];
|
||||
$player = $VARS['giveto'];
|
||||
|
||||
if (is_empty($itemuuid) || !is_numeric($itemuuid) || !$database->has('inventory', ["AND" => ['itemuuid' => $itemuuid, 'playeruuid' => $_SESSION['uuid']]])) {
|
||||
sendError("Invalid itemuuid.", true);
|
||||
}
|
||||
|
||||
if (is_empty($player) || !$database->has('players', ['nickname' => $player])) {
|
||||
sendError("Invalid nickname.", true);
|
||||
}
|
||||
|
||||
$playeruuid = $database->select('players', ['uuid'], ['nickname' => $player])[0];
|
||||
|
||||
|
||||
$database->update('inventory', ['playeruuid' => $playeruuid], ['itemuuid' => $itemuuid]);
|
Reference in New Issue
Block a user