Файл: DARK WARS/dark_war/hunting_shop/sell.php
Строк: 24
<?php
include_once '../start.php';
$doc = new document();
$doc->title('Продажа');
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
$doc->err('Ошибка, не выбрано оружие');
exit();
}
$id = (int)$_GET['id'];
$q = mysql_query("SELECT * FROM `dark_war_hshop_u` WHERE id='$id' AND `id_player` = '$player->id' LIMIT 1");
if (!mysql_num_rows($q)) {
$doc->err('У вас нет такого артифакиа');
exit();
}
$ar = mysql_fetch_assoc($q);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_hshop_u` WHERE `id` = '$id' AND `active` = '1'"),0)>0) {
$doc->err('Данная вещь установлена, снимите ее');
exit();
}
if (isset($_GET['yes'])) {
$gold = $ar['gold'] / 2;
mysql_query("UPDATE `dark_war_users` SET `gold` = (`gold` + '$gold'), `hchance` = (`hchance` - '$ar[chance]') WHERE `id` = '$player->id'");
mysql_query("DELETE FROM `dark_war_hshop_u` WHERE `id` = '$id' AND `id_player` = '$player->id' LIMIT 1");
$doc->msg('Вы продали артефакт');
}
$img = "<img src='/dark_war/all_img/hunting_shop/$ar[img].png' alt='!' />";
$title = "Вы продаете товар";
$request[] = "Ваш доход с продажы составит";
$request[] = "Золото: + " . $ar['gold'] / 2;
$action[] = array('link' => "sell.php?id=$id&yes".(isset($_GET['page'])?'&page='.$_GET['page'].'' : '')."", 'name' => 'Продать');
$list = array('img' => $img, 'title' => $title, 'request' => $request, 'action' => $action);
$doc->assign('list', $list);
$doc->display('view_info.tpl');
$doc->ret("my_huntin.php".(isset($_GET['page'])?'?page='.$_GET['page'].'' : '')."", 'Мои вещи');
$doc->ret("my_info.php?id=$id".(isset($_GET['page'])?'?page='.$_GET['page'].'' : '')."", 'Информация');
?>