diff --git a/repair.php b/repair.php index 20d4b71..8063c19 100644 --- a/repair.php +++ b/repair.php @@ -13,18 +13,23 @@ if ($user['battle'] != 0) { } // Гравировка 30 кред. Максимум 32 символа. -if (input::post('gravirovka_text') AND input::post('itemId') AND ($user['money'] >= 30)) { - if (33 > iconv_strlen(input::post('gravirovka_text'))) { - db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', input::post('gravirovka_text'), $_SESSION['uid'], input::post('itemId')); - db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']); - $status = 'Гравировка добавлена!'; - } else $status = 'Превышен лимит в 32 символа!'; +if (input::post('gravirovka_text') AND input::post('itemId')) { + if (30 <= $user['money']) { + if (33 > iconv_strlen(input::post('gravirovka_text'))) { + db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', input::post('gravirovka_text'), $_SESSION['uid'], input::post('itemId')); + db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']); + $status = 'Гравировка добавлена!'; + } else $status = 'Превышен лимит в 32 символа!'; + } else $status = 'Недостаточно денег!'; } // Снять гравировку. if (input::post('gravirovka_remove')) { - db::c()->query('UPDATE `inventory` SET `text` = ?n WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', null, input::post('gravirovka_remove'), $_SESSION['uid']); - $status = 'Гравировка удалена!'; + if (30 <= $user['money']) { + db::c()->query('UPDATE `inventory` SET `text` = ?n WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', null, input::post('gravirovka_remove'), $_SESSION['uid']); + db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']); + $status = 'Гравировка удалена!'; + } else $status = 'Недостаточно денег!'; } // Ремонт 0,5 кред за единицу.