	<?php
	
	if (@$user)
	{
		
		$levelupexp=	(include __DIR__ . '/_exp.php');
		
		@$exp	=	$levelupexp[ $user['level'] + 1 ];
		@$progress = min(100, ceil(100 / ($exp / $user['exp'])));
		
	?>
		
		<div class='header' onclick='location.href="/"'>
	<?php
		
		$all_hp	=	$user['life']	*	2;
		$hp_part_4	=	ceil($all_hp	/	4);
		
		if ($user['hp'] <=	$hp_part_4)
		{
	?>
			<img src='/images/icon/health.png' alt=''/> <span class='c_red'><?=$user['hp']?></span>
	<?php	
		}
		else
		{
	?>
			<img src='/images/icon/health.png' alt=''/> <?=$user['hp']?>
	<?php
		}
	?>
			|
			
			<img src='/images/icon/mana.png' alt=''/> <?=$user['mp']?>
			
		</div>
		
		<!-- EXP progressbar -->
		<div style='background-color:	#707070;
					height:	2px;'>
			<div style='background-color:	#60c060;
						height:	2px;
						width:	<?=$progress?>%;'></div>
		</div>
	
	<?php
		
		if ($user['level'] != 60)
		{
			
			if ($user['exp'] >= $exp)
			{
				
				$award_gold	=	10 * ($user['level'] + 1);
				
				@mysql_query(sprintf(
					'UPDATE
							`users`
						SET
							`level`	=	`level`	+	1,
							`exp`	=	`exp`	-	%d,
							`gold`	=	`gold`	+	%d
						WHERE
							`id`	=	%d',
					$exp,
					$award_gold,
					$user['id']
				));
				
				
	?>
		
		<div class='box'>
			
			Вы получили новый уровень!
			
			<div class='spr'></div>
			Награда:	<img src='/images/icon/gold.png' alt='' /> <?=$award_gold?> золота
			
		</div>
		
	<?php
			
			}
			
		}
		
		if (@mysql_num_rows(@mysql_query(sprintf(
			'SELECT
					*
				FROM
					`mail`
				WHERE
					`to`	=	%d
						AND
					`read`	=	0',
			$user['id']
		))) != 0)
		{
	?>
	<ul class='list'>
		<li><a href='/mail/'><img src='/images/icon/mail.png' alt='' /> Почта <span class='c_green'>(+)</span></a></li>
	</ul>
	
	<div class='l'></div>
	<?php
		}
	
	}
	
	?>