Файл: public_html/transfer_item.php
Строк: 92
<?php
require_once './element_options/element_options.php';
if (!$user or empty($_GET['user']) or ! is_numeric($_GET['user'])) { header('Location: /'); exit; }
require_once './element_function/element_function_item.php';
$wear_item = users_wear_item($user['lost_id']);
$shoot_item = users_shoot_item($user['lost_id']); // Массив с вещами в рюкзаке
$count_item = count($shoot_item);
$title = 'Передача вещей ('.$count_item.' / 20)';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
if ($_GET['user'] == $user['lost_id']) { header('Location: /'); exit; }
if ($id && cache_user($_GET['user']))
{
$item = cache_item($id);
if ($item && $item['lost_user'] == $user['lost_id'])
{
if ($go == 'ok' && $user['lost_money_gold'] >= 5)
{
$item['lost_user'] = $_GET['user'];
mysql_query("UPDATE `element_item` SET `lost_user`='".mysql_real_escape_string($_GET['user'])."' WHERE `lost_id` = '$id' LIMIT 1");
update_money_exp($user, 0, 0, 0, -5);
unset($shoot_item[$id]);
writecache('element_shoot_item_user_id'.$user['lost_id'], $shoot_item);
$shoot_item = users_shoot_item($_GET['user']);
$shoot_item[$id] = $item['lost_id'];
writecache('element_shoot_item_user_id'.$_GET['user'], $shoot_item);
header("Location: ?user=".$_GET['user']);
die;
}
else
{
echo '<div class="nfl p5 mb5 mt5 small white cntr mlra">';
echo 'Подтвердите что вы хотите передать эту вещь? это стоит 5 золота';
echo '<div class="mt5"><a class="button w30 mr2" href="?user='.$_GET['user'].'&go=ok&id='.$id.'">Да</a> <a class="button w30 ml2" href="?user='.$_GET['user'].'">Нет</a></div>';
echo '</div>';
}
}
}
echo '<div class="nfl p5 mb5 mt5 small mlra">';
if ($count_item == 0) {
echo '<div class="white cntr">В вашем рюкзаке, вещей не найдено</div>';
} else {
$as = 0;
echo '<table>';
foreach($shoot_item as $item) {
$item_id = cache_item($item);
$quality = quality_item_name($item_id['lost_quality']);
$item_new = ($item_id['lost_new'] == 0) ? 'Новый' : '<span class="ccc">Личный</span>';
$shoot = item_generation_params($item_id['lost_strlen'], $item_id['lost_heatpoints'], $item_id['lost_protection'], $item_id['lost_comparison']);
$bla = item_params_type($item_id['lost_mesto']);
$enchants = item_enchants_quality($item_id['lost_enchants'], $bla[1]);
if (isset($wear_item[$item_id['lost_mesto']])) {
$my_item = cache_item($wear_item[$item_id['lost_mesto']]);
$wear = item_generation_params($my_item['lost_strlen'], $my_item['lost_heatpoints'], $my_item['lost_protection'], $my_item['lost_comparison']);
if ($wear['summa'] > $shoot['summa']) $result = ', <span class="red">Хуже: -'.($wear['summa'] - $shoot['summa']).'</span>';
else if ($wear['summa'] < $shoot['summa']) $result = ', <span class="lngreen">Лучше: +'.($shoot['summa'] - $wear['summa']).'</span>';
else $result = '';
} else $result = ', <span class="lngreen">Лучше: +'.($shoot['summa']).'</span>';
echo '<tr><td><img width="50" height="50" src="'.$item_id['lost_avatar'].'"></td>';
echo '<td class="small" valign="top">';
echo '<span class="ml2 small">'.$quality['image'].' <a class="yellow1" href="/item?id='.$item.'">'.$item_id['lost_name'].'</a> '.(($enchants) ? $enchants['image'] : '').'</span><br/>';
echo '<span class="ml2 small white">'.$item_new.$result.'</span><br/>';
echo '<span class="ml2 small white"><a class="moderator" href="?user='.$_GET['user'].'&id='.$item.'">Передать за 5 золота</a></span>';
echo '</tr>';
}
echo '</table>';
}
echo '</div>';
require_once './element_include/element_foot_user_true.php';
?>