<?
defined('PROTECTOR') or die('Error: restricted access');

///////
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header('Content-type: text/html; charset=UTF-8');
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo "\n" . '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">';
echo "\n" . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">';
echo "\n" . '<head><meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>';
echo "\n" . '<title>' . $textl . '</title>';
echo "\n" . '<link rel="stylesheet" href="../theme/standart/style.css" type="text/css" />';
echo "\n" . '</head><body>';

if ($user_id=='1'){
if(empty($header)){
////////////////////////////////////////////////////////

$t=time();

$req = mysql_query("SELECT * FROM `ban` WHERE `usr` = '$log' LIMIT 1");
// //////////////////////////
$avto = mysql_num_rows($req);
if ($avto == 1) {
$ban = mysql_fetch_array($req);

if($ban[ban_time]<$t){
mysql_query("DELETE FROM `ban` WHERE `usr` = '$log'");
}else{
echo"Вы находитесь в бане! Причина: $ban[text]! Осталось: ";

$ban[ban_time]=$ban[ban_time]-time();
if($ban[ban_time]<60){
echo "$ban[ban_time] сек.";
}elseif($ban[ban_time]>60 and $ban[ban_time]<3600){
$ban[ban_time]=round($ban[ban_time]/60);
echo "$ban[ban_time] мин.";
}else{
$ban[ban_time]=round($ban[ban_time]/3600);
echo "$ban[ban_time] часов";
}
include('../files/end.php');exit;
}
}

//////////////////////////
/////////////////////
include('../files/lvl.php');
include('../files/opit.php');
echo'<div class="head"><div align ="left">';
echo'<img src="../pic/main/'.$udata[storona].'.png"  height="11px" width="11px"  alt="*"/><a href="../pers.php?"><font color="#e4b214"><b>'.$log.'</b></font></a>
<img src="../pic/up.png" height="11px" width="11px" />'.$udata[lvl].' (<b>'.$exp.'%</b>)
<img src="../pic/hp.png" height="11px" width="11px" />'.$udata[hp].'
<img src="../pic/mp.png" height="11px" width="11px" />'.$udata[mp].'
<img src="../pic/main/gold1.png" height="11px" width="11px" />'.$udata[money].'
<img src="../pic/main/almaz.png" height="11px" width="11px" /><a href="http://m.xsolla.com/?id_project=7125">'.$udata[almaz].'</a> ';
echo'<img src="../pic/main/fp.png" height="11px" width="11px" /><a href="../fp.php">'.$udata[fp].'</a> ';

$req = mysql_query("SELECT * FROM `regfight` WHERE `usr` = '$log'");
$avto=mysql_num_rows($req);
if($udata[fp]<$udata[fpall]){
$aro = mysql_fetch_array($req);
$aro[last]=300-(time()-$aro[last]);
if($aro[last]<60){
echo "($aro[last] с)";
}else{
$aro[last]=round($aro[last]/60);
echo "($aro[last] м)";
}
}






$req_r = mysql_query("SELECT * FROM `rydnik` where `usr`='$log'");
$avto_r=mysql_num_rows($req_r);
if($avto_r==1){
$rydnik = mysql_fetch_array($req_r);
}
if(!empty($rydnik[usr])){
$rydnik[over]=$rydnik[over]-time();
if($rydnik[over]<60){
echo "<img src='http://haos.mobi/pic/main/portal.gif'><a href='http://haos.mobi/rydnik.php'>$rydnik[over] сек.</a><br/>";
}
elseif($rydnik[over] <1){
echo "<img src='http://haos.mobi/pic/main/portal.gif'><a href='http://haos.mobi/rydnik.php'>0 сек.</a><br/>";}
elseif($rydnik[over]>60 and $rydnik[over]<3600){
$rydnik[over]=round($rydnik[over]/60);
echo "<img src='http://haos.mobi/pic/main/portal.gif'><a href='http://haos.mobi/rydnik.php'>$rydnik[over] мин.</a><br/>";
}
 }


echo'</div><br/>';

$req_r = mysql_query("SELECT * FROM `shakta` where `usr`='$log'");
$avto_r=mysql_num_rows($req_r);
if($avto_r>=1){
$rydnik = mysql_fetch_array($req_r);
}
if(!empty($rydnik[usr])){
$rydnik[over]=$rydnik[over]-time();
if($rydnik[over]<60){
echo "<div class='info' align='center'>Шахта: <a href='http://haos.mobi/shakta.php'>$rydnik[over] сек.</a></div>";
}
elseif($rydnik[over] <1){
echo "<div class='info' align='center'>Шахта: <a href='http://haos.mobi/shakta.php'>0 сек.</a></div>";}
elseif($rydnik[over]>60 and $rydnik[over]<3600){
$rydnik[over]=round($rydnik[over]/60);
echo "<div class='info' align='center'>Шахта: <a href='http://haos.mobi/shakta.php'>$rydnik[over] мин.</a></div>";
}
 }

if($udata['info_news'] == 1){
echo'<div class="info" align="center">';
echo"<a href=\"../news.php?\"><b>Произошло обновление</b></a>";
echo'</div>';
}

if($inpk=='1' and $headmod != 'pk'){
echo'<div class="info" align="center">';
echo"<a href=\"../pk.php?\"><b>В бой</b></a>";
echo'</div>';
}

if($inar=='1' and $headmod != 'combat'){
echo'<div class="info" align="center">';
echo"<a href=\"../combat.php?\"><b>В бой</b></a>";
echo'</div>';
}
$q = mysql_query("SELECT COUNT(*) FROM `msg_r` WHERE `user_to` = '$log' AND `read` = '1';");
$new_mail = mysql_result($q, 0);if($new_mail > 0){
echo'<div class="info" align="center">';
echo"<a href=\"../msg.php?mod=read\"><b>Почта($new_mail)</b></a>";
echo"</div>";}
$q = mysql_query("SELECT COUNT(*) FROM `otchet` WHERE `user_to` = '$log' AND `read` = '1';");
$new_mail = mysql_result($q, 0);if($new_mail > 0){
echo'<div class="info" align="center">';
echo"<a href=\"../otchet.php?mod=read\"><b>Боевой отчет($new_mail)</b></a>";
echo"</div>";}
$req = mysql_query("SELECT * FROM `item_aura` WHERE `usr` = '$log' and `status`='1'");
$avto=mysql_num_rows($req);
if($avto==1){
$aur = mysql_fetch_array($req);

$req = mysql_query("SELECT * FROM `aurs` WHERE `usr`='$log'");
////////////////////////////
$avto=mysql_num_rows($req);
$aro = mysql_fetch_array($req);



echo'<div class="info">';
echo"<b>Аура:</b> $aur[name] ";

$aro[actimer]=$aro[actimer]-time()-30;
if($aro[actimer]<60){
echo "осталось: $aro[actimer] сек.";
}else{
$aro[actimer]=round($aro[actimer]/60);
echo "осталось: $aro[actimer] мин.";
}
echo'</div>';
}
$req = mysql_query("SELECT * FROM `out` WHERE `usr` = '$log'");
$avto=mysql_num_rows($req);
if($avto==1){
////////////////////////////
$aro = mysql_fetch_array($req);

echo'<div class="info">';
echo"<b>Отдых(замок):</b> ";

$aro[timeout]=$aro[timeout]-time();
if($aro[timeout]<60){
echo "осталось: $aro[timeout] сек.";
}else{
$aro[timeout]=round($aro[timeout]/60);
echo "осталось: $aro[timeout] мин.";
}
echo'</div>';
}

//Приглашения в клан

$req = mysql_query("SELECT * FROM `invite` WHERE `usr` = '$log'");
////////////////////////////
$avto=mysql_num_rows($req);
if(empty($_GET[id])){

if($avto>=1){
While($inv = mysql_fetch_array($req))
{
$req = mysql_query("SELECT `name` FROM `clan` WHERE `lider` = '$inv[clan]'");
$clan = mysql_fetch_array($req);
echo'<div class="info">';
echo" <a href=\"../index.php?mod=inv&amp;id=$inv[id]\">Вас приглашают в клан: $clan[name]</a>";
echo'</div>';
}}}

//Приглашения в клан

//Анкета

$req = mysql_query("SELECT * FROM `anketa` WHERE `usr` = '$log' LIMIT 1");
// //////////////////////////
$avto = mysql_num_rows($req);
if ($avto == NULL) {
echo'<div class="info">';
echo" <a href=\"http://haos.mobi/anketa.php?mod=yes\">У вас не заполнена анкета</a>";
echo'</div>';
}

function nav2($link, $link_name){
	echo '<br/><a href="'.$link.'">'.$link_name.'</a>';
}
function sec($sec){
	$sec = htmlspecialchars(mysql_real_escape_string($sec));
	return $sec;
}
function navig($page, $link, $pages){
	if($pages > 1){
		echo 'cтраницы:<br/>';
		for($i = 1; $i <= $pages; $i++){
			if($i != $page){
				echo '<a href="'.$link.'page='.$i.'">'.$i.'</a> ';
			}else{
				echo '<u>'.$i.'</u> '; // выводим активую страницу текстом
			}
		}
		echo '<br/>';
	}else{
		echo 'cтраницы:<br/><u>1</u><br/>';
	}	
}

//Анкета
//Загс
$req = mysql_query("SELECT * FROM `zamuj` WHERE `usr` = '$log'");
////////////////////////////
$avto=mysql_num_rows($req);

if($avto>=1){
While($inv = mysql_fetch_array($req))
{
$req = mysql_query("SELECT `name` FROM `clan` WHERE `lider` = '$inv[clan]'");
$clan = mysql_fetch_array($req);

$nickas = strip_tags($inv[clan]);
$req = mysql_query("SELECT `storona` FROM `users` WHERE `usr` = '$nickas'");
$pic = mysql_fetch_array($req);

echo'<div class="info">';
echo"<a href=\"../index.php?mod=zayavka&id=$inv[id]\">Предложение от игрока</a>"; echo' <img src="pic/main/'.$pic['storona'].'.png" alt="#"/>'; echo" <a href=\"search.php?nick=$inv[clan]&go=go\">$inv[clan]</a><br/>";
echo'</div>';
}}
//Загс


}}
else
{
echo "Ошибка!Вы не авторизованы!<a href='../index.php'>Авторизуйтесь</a>";include('../files/end.php');exit;
}
?>
