Забыл проверки на нехватку денег.

This commit is contained in:
lopar 2018-12-12 20:35:32 +02:00
parent f5c0a00451
commit 492fdd36a0

View File

@ -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 кред за единицу.