giveitem.php 631 B

12345678910111213141516171819202122
  1. <?php
  2. require 'required.php';
  3. require 'onlyloggedin.php';
  4. $itemuuid = $VARS['itemuuid'];
  5. $player = $VARS['giveto'];
  6. if (is_empty($itemuuid) || !is_numeric($itemuuid) || !$database->has('inventory', ["AND" => ['itemuuid' => $itemuuid, 'playeruuid' => $_SESSION['uuid']]])) {
  7. sendError(INVALID_ITEMID, true);
  8. }
  9. if (is_empty($player) || !$database->has('players', ['nickname' => $player])) {
  10. sendError(INVALID_NICKNAME, true);
  11. }
  12. $playeruuid = $database->select('players', ['uuid'], ['nickname' => $player])[0]['uuid'];
  13. $database->update('inventory', ['playeruuid' => $playeruuid], ['itemuuid' => $itemuuid]);
  14. sendOK();