Файл: public_html/town_bag.php
Строк: 84
<?php
require_once './element_options/element_options.php';
if (!$user or $user['lost_town'] < 1) { header('Location: /'); exit; }
require_once './element_function/element_function_item.php';
$shoot_item = town_items($user_town['lost_id']);
$count_item = count($shoot_item);
$_user_drop = false;
$exp_town_set = explode(':', $user['lost_town_other']);
if (isset($_GET['user']) && is_numeric($_GET['user']))
{
if ($exp_town_set[0] < 2)
{
$_user_drop = cache_user($_GET['user']);
if (is_array($_user_drop) && $_user_drop['lost_town'] == $user['lost_town'])
{
$_user_drop = $_user_drop['lost_id'];
}
}
}
$title = 'Склад города ('.$count_item.' из 50)';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
if ($go == 'add' AND $_user_drop && $exp_town_set[0] < 2 && sizeof(users_shoot_item($_user_drop)) < 20)
{
$item = cache_item($id);
if ($item['lost_bag'] == -$user['lost_town'] && isset($shoot_item[$id]))
{
mysql_query("UPDATE `element_item` SET `lost_bag`='0' WHERE `lost_id` = '$id' LIMIT 1");
unset($shoot_item[$id]);
writecache('town_items_town_id'.$user['lost_town'], $shoot_item);
$box_i = users_shoot_item($_user_drop);
$box_i[$id] = $id;
writecache('element_shoot_item_user_id'.$_user_drop, $box_i);
header('Location: ?user='.$_user_drop);
exit;
}
}
if ($go == 'drop_item' && $id && $count_item < 50)
{
$item = cache_item($id);
if ($item['lost_user'] == $user['lost_id'] AND ! isset($shoot_item[$id]) && $item['lost_bag'] == '0')
{
mysql_query("UPDATE `element_item` SET `lost_bag`='-{$user['lost_town']}' WHERE `lost_id` = '$id' LIMIT 1");
$user_ioi = users_shoot_item($user['lost_id']);
unset($user_ioi[$id]);
writecache('element_shoot_item_user_id'.$user['lost_id'], $user_ioi);
$shoot_item[$id] = $id;
writecache('town_items_town_id'.$user['lost_town'], $shoot_item);
}
header("Location: /bag");
exit;
}
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>';
$bla = item_params_type($item_id['lost_mesto']);
$enchants = item_enchants_quality($item_id['lost_enchants'], $bla[1]);
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.'</span><br/>';
if ($_user_drop)
{
echo '<span class="ml2 small white"><a class="moderator" href="?go=add&id='.$item.'&user='.$_user_drop.'">[Передать]</a></span>';
}
echo '</tr>';
}
echo '</table>';
}
echo '</div>';
//echo '<div class="nfl p5 mb5 mt5 small mlra">';
//echo '<a href="/bag">Положить шмотку</a>';
//echo '</div>';
require_once './element_include/element_foot_user_true.php';
?>