Файл: element_profile_basket.php
Строк: 193
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
if ($user['lost_privilege'] != 3) { header('Location: /'); exit; }
if (!$id) {
$title = 'Ошибка';
$error1 = '<span class="small">Произошла какая-то ошибка</span>';
require_once 'element_error_page.php';
exit;
}
$profile = (($id == $user['lost_id']) ? $user : cache_user($id));
if (!$profile) {
$title = 'Ошибка';
$error1 = '<span class="small">Произошла какая-то ошибка</span>';
require_once 'element_error_page.php';
exit;
}
require_once './element_function/element_function_item.php';
function CountItemUser($type, $user) {
return mysql_result(mysql_query("SELECT COUNT(`lost_id`) FROM `element_item` WHERE `lost_bag` = '$type' AND `lost_user` = '$user'"), 0);
}
$item = (isset($_GET['item']) AND is_numeric($_GET['item'])) ? (int)$_GET['item'] : false;
// Одетые вещи
if ($go == 'wear') {
if ($item) {
$item_id = mysql_fetch_array(mysql_query("SELECT `lost_id` FROM `element_item` WHERE `lost_id` = '$item' AND `lost_bag` = '1' AND `lost_user` = '$id' LIMIT 1"));
if ($item_id) {
shoot_item($user, $item, $shoot, $wear, $header);
mysql_query("UPDATE `element_item` SET `lost_bag` = '0' WHERE `lost_id` = '$item' LIMIT 1");
header('Location: /basket?id='.$id);
exit;
}
}
$count = CountItemUser(1, $id);
$title = 'Одетые "'.$profile['lost_login'].'"';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 yellow1 small mlra">';
echo '<div class="mb5 cntr yellow1">Одетые вещи персонажа. Можно снять.</div>';
echo '<div class="mb5 cntr">Вещи: ';
echo '<span class="white">Одетые</span> | ';
echo '<a class="game-master" href="/basket?id='.$id.'&go=shoot">Рюкзак</a> | ';
echo '<a class="game-master" href="/basket?id='.$id.'">Разобранные</a>';
echo '</div><div class="hr mt5 mb5"></div>';
if ($count > 0) {
require_once './element_function/element_function_pagination.php';
$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
$pagination = pagination(10, $page, $count);
$query = mysql_query("SELECT * FROM `element_item` WHERE `lost_bag` = '1' AND `lost_user` = '$id' LIMIT $pagination[start], $pagination[num]");
while ($myrrow = mysql_fetch_array($query)) {
$quality = quality_item_name($myrrow['lost_quality']);
$bla = item_params_type($myrrow['lost_mesto']);
$enchants = item_enchants_quality($myrrow['lost_enchants'], $bla[1]);
echo '<table>';
echo '<tr><td><img width="50" height="50" src="'.$myrrow['lost_avatar'].'"></td>';
echo '<td class="small" valign="top">';
echo '<span class="ml2 small yellow1">'.$quality['image'].' '.$myrrow['lost_name'].' <span class="moderator">+'.$myrrow['lost_comparison'].'</span></span><br/>';
echo '<span class="ml2 small moderator">'.(($enchants) ? $enchants['image'].' +'.$enchants['params'].' '.$enchants['name'] : 'чара не установлена').'</span><br/>';
echo '<span class="ml2 small"><img src="/images/icons/1.gif"> <a class="error1" href="/basket?id='.$id.'&item='.$myrrow['lost_id'].'">Снять вещь</a></span>';
echo '</td></tr>';
echo '</table>';
}
echo pagination_echo($pagination['page'],$pagination['total'],'/basket?id='.$id.'&go=wear&page=');
} else echo '<div class="mb5 cntr error1">Разобраных вещей нет</div>';
echo '</div>';
require_once './element_include/element_foot_user_true.php';
// Вещи с рюкзака
} else if ($go == 'shoot') {
// Вещи на аукционе
} else if ($go == 'auction') {
} else {
// Иначе удаленные вещи, выше дары богов
if ($go == 'bag' AND $item) {
$item_id = mysql_fetch_array(mysql_query("SELECT `lost_id` FROM `element_item` WHERE `lost_id` = '$item' AND `lost_bag` = '2' AND `lost_user` = '$id' LIMIT 1"));
if ($item_id) {
mysql_query("UPDATE `element_item` SET `lost_bag` = '0' WHERE `lost_id` = '$item' LIMIT 1");
header('Location: /basket?id='.$id);
exit;
}
}
$count = CountItemUser(2, $id);
$title = 'Корзина "'.$profile['lost_login'].'"';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 yellow1 small mlra">';
echo '<div class="mb5 cntr yellow1">В корзине хранятся разобранные вещи, качества трофейные, уникальные</div>';
echo '<div class="mb5 cntr">Вещи: ';
echo '<a class="game-master" href="/basket?id='.$id.'&go=wear">Одетые</a> | ';
echo '<a class="game-master" href="/basket?id='.$id.'&go=shoot">Рюкзак</a> | ';
echo '<span class="white">Разобранные</span>';
echo '</div><div class="hr mt5 mb5"></div>';
if ($count > 0) {
require_once './element_function/element_function_pagination.php';
$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
$pagination = pagination(10, $page, $count);
$query = mysql_query("SELECT * FROM `element_item` WHERE `lost_bag` = '2' AND `lost_user` = '$id' LIMIT $pagination[start], $pagination[num]");
while ($myrrow = mysql_fetch_array($query)) {
$quality = quality_item_name($myrrow['lost_quality']);
$bla = item_params_type($myrrow['lost_mesto']);
$enchants = item_enchants_quality($myrrow['lost_enchants'], $bla[1]);
echo '<table>';
echo '<tr><td><img width="50" height="50" src="'.$myrrow['lost_avatar'].'"></td>';
echo '<td class="small" valign="top">';
echo '<span class="ml2 small yellow1">'.$quality['image'].' '.$myrrow['lost_name'].' <span class="moderator">+'.$myrrow['lost_comparison'].'</span></span><br/>';
echo '<span class="ml2 small moderator">'.(($enchants) ? $enchants['image'].' +'.$enchants['params'].' '.$enchants['name'] : 'чара не установлена').'</span><br/>';
echo '<span class="ml2 small"><img src="/images/icons/1.gif"> <a class="error1" href="/basket?id='.$id.'&go=bag&item='.$myrrow['lost_id'].'">Восстановить</a></span>';
echo '</td></tr>';
echo '</table>';
}
echo pagination_echo($pagination['page'],$pagination['total'],'/basket?id='.$id.'&page=');
} else echo '<div class="mb5 cntr error1">Разобраных вещей нет</div>';
echo '</div>';
require_once './element_include/element_foot_user_true.php';
}
?>