Просмотр файла element_auctions.php

Размер файла: 4.82Kb
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
	require_once './element_function/element_function_item.php';
	
	$count = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_auction` ORDER BY `lost_time` DESC"), 0);
	$wear_item = users_wear_item($user['lost_id']);
	$shoot_item = users_shoot_item($user['lost_id']); 
	
	if ($go == 'cancel' AND $id) {
		$item = cache_item($id);
		AuctionItemCancel($user['lost_id'], $shoot_item, $item, 'bag');
	}
	
	$title = 'Аукцион вещей';
	require_once './element_include/element_head.php';
	require_once './element_include/element_header_user_true.php';
	
	if ($go == 'shop' AND $id) {
		require_once './element_function/element_function_mail.php';
		$item = cache_item($id);
		if (isset($_GET['ok'])) {
			AuctionItemShop($user, $shoot_item, $item, '/auctions', true, '/', '/');
		} else AuctionItemShop($user, $shoot_item, $item, '/', false, '/auctions?go=shop&id='.$id.'&ok', '/auctions'); 
	}
	
	
	echo '<div class="nfl p5 mb5 small mt5 mlra">';
	echo '<div class="game-master cntr">Аукцион предназначен для торговли снаряжением<br/>Торговать можно только вещами следующего качества: <span class="yellow1">Дары Богов, Трофейные и Уникальные</span></div>';
	echo '<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_auction` ORDER BY `lost_time` DESC LIMIT $pagination[start], $pagination[num]");
	
		while ($myrrow = mysql_fetch_array($query)) {
		$item = cache_item($myrrow['lost_id']); 
		$bla = item_params_type($item['lost_mesto']);
		$quality = quality_item_name($item['lost_quality']);
		$enchants = item_enchants_quality($item['lost_enchants'], $bla[1]);
		$shoot = item_generation_params($item['lost_strlen'], $item['lost_heatpoints'], $item['lost_protection'], $item['lost_comparison']);
		
		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 '<div class="mb2">
				<table>
				<td>
				<img width="50" height="50" src="'.$item['lost_avatar'].'">
				</td>
				<td class="small" valign="top">
				<span class="lngreen ml2">'.$quality['image'].' <a class="yellow1 small" href="/item?id='.$item['lost_id'].'">'.$item['lost_name'].'</a> '.$item['lost_comparison'].' ур</span><br/>';
				echo '<span class="ml2 yellow1">'.(($enchants) ? '<span class="moderator">'.$enchants['image'].'+'.$enchants['params'].'</span> '.$enchants['name'].', </span>' : ''). $result.'</span><br/>';
				echo '<span class="ml2 yellow1">'.(($user['lost_id'] == $myrrow['lost_user']) ? '- Мой лот <a href="/auctions?go=cancel&id='.$myrrow['lost_id'].'">[Отменить]</a>' : '<a href="/auctions?go=shop&id='.$myrrow['lost_id'].'">[Купить за <img src="/images/icons/gold.png">'.$myrrow['lost_gold'].']</a>').'</span>';
				echo '</td>
				</table>
			  </div>';
		
		}
		echo '<div>'.pagination_echo($pagination['page'],$pagination['total'],'/auctions/?page=').'</div>';
	} else echo '<div class="cntr ccc">На аукционе нет вещей</div>';
	
	
	/*echo '<div class="hr mt5 mb5"></div>';
	echo '<form class="cntr" method="post" action="/auctions?go=search">';
	echo '<label class="bl mb5 ccc">Качество:<br>
			<select class="fdark  mb10 w60" name="set">
			<option value="3" selected>Дары Богов</option>
			<option value="4">Трофейное</option>
			<option value="5">Уникальное</option>
			</select>
			</label>';
	echo '<label class="bl mb5 ccc">Слот:<br>
			<select class="fdark mb10 w60" name="set">';
			
			foreach($array_type as $key => $value) {
				echo '<option value="'.$value.'">'.name_item_mesto($value).'</option>';
			}
			
	echo '</select>
			</label>';		
	echo '<span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Поиск"/></span><br/><br/>';		
	echo '</form>';*/
	
	
	echo '</div>';
	require_once './element_include/element_foot_user_true.php';
?>