} if (!$chars->setRealm($RealmId)) { echo 'The realm assigned to your account is invalid.'; die; } //check if the realm is online if ($command->CheckConnection($RealmId) !== true) { echo 'The realm is currently unavailable. Please try again in few minutes.'; } //verify the refund id if (!$refundId) { echo 'The refund id is missing.'; die; } //Try getting the refund record $row = ItemRefundSystem::GetRefundable($refundId); unset($refundId); if (!$row) { echo 'The refund id is invalid.'; die; } //verify the refund status if ($row['status'] != IRS_STATUS_NONE) { echo 'The refund record has been already refunded.'; die; } //Check if the user is allowed to refund more items this week if (ItemRefundSystem::GetRefundsDone() >= 2) { echo 'You are not allowed to refund more items this week.'; die; }