Add giveitem.php
parent
60c8354ba0
commit
a8735c03aa
@ -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