diff --git a/presents.php b/presents.php index 7618065..fb0b9f9 100644 --- a/presents.php +++ b/presents.php @@ -25,12 +25,16 @@ WHERE u.`id` = ?i', $_SESSION['uid'])->fetch_assoc(); $dirname = "i/presents/"; $images = glob($dirname . "*.png"); -if (!empty($_POST['present'])) { +if (!empty($_POST['sendAction'])) { + if (empty($_POST['present'])) { + $status = "Подарок не выбран!"; + return; + } if (empty($_POST['receiver'])) { $status = "Поле «Получатель» не заполнено!"; return; } - $receiver = db::c()->query('SELECT `id` FROM `users` WHERE `login` = ?i', $_POST['receiver'])->fetch_assoc(); + $receiver = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $_POST['receiver'])->fetch_assoc(); if (empty($receiver)) { $status = "Получатель {$receiver} не найден в базе!"; return; @@ -81,7 +85,7 @@ if (!empty($_POST['present'])) {