<?php
require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
if ((!isset($_SESSION['id'])) or (!isset($_SESSION['nick'])))  {
  ?>
<!--1390114136-->
  <script type="text/javascript">
  document.location.href = "login.php";
  </script>
  <?php
  exit();
}
$page_title = 'Профиль';
require_once('conf/head.php');
$user_id = abs(intval($_GET['id']));
if ((isset($_SESSION['id'])) and (isset($_SESSION['nick'])))  {
  /////////////////////////////////
require_once('conf/top.php');

$query = "Select * from users where id = '$user_id' limit 1";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
$row = mysqli_fetch_array($result);
header('location: user.php?id='.$row['id'].'');
if ($row == 0) {
require_once('conf/nouser.php');
}
else {
$mentor_time = $row['mentor_time'];
$mentor_type = $row['mentor_type'];
$pistols_yron = 0;
$weapons_yron = 0;
$pistols_tochn = 0;
$weapons_tochn = 0;
$hp_cl = 0;
$prochn_cl = 0;
$last_active = $row['last_active'];
$last_active = strtotime("$last_active");
$now = (date("Y-m-d H:i:s"));
$now = strtotime("$now");
$razn_last_act = ($now - $last_active);
$usid = $_SESSION['id'];
$usst=$dbc->query("SELECT * FROM `users` WHERE`id`='$usid' LIMIT 1")->fetch_assoc();

?>
<?php if ($row['vip'] ==1) {?><script type="text/javascript" src="/js/snow.js"></script><?php }
?>
<center> <p class="profile" style="border-top:1px solid #000000; background-color:#000000;"> <span class="net"><?php
if ($row['gruppa'] == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/svoboda.png" width="12" height="12" alt="н"/><?php }}
if ($row['gruppa'] == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/dolg.png" width="12" height="12" alt="н"/><?php }}
if ($row['gruppa'] == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/odinochkion.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/odinochki.png" width="12" height="12" alt="н"/><?php }}
echo ' ' . $row['nick'];
?></span>
</a><span class="bonus">Id:
<?php
echo ' ' . $row['id'];
?></span>
</p></center>
<?php if ($row['vip'] == 1) {?><center><div style="background-color: #0B0B0B;"><img src="img/avatars/<?php echo $row['avatar']; ?>" width="150" height="210" border="0" class="upl" style="border: 3px outset gold;"/></a>
</center><?php }
?>
<?php if ($row['vip'] < 1) {?>
<center><div style="background-color: #0B0B0B;">
<img src="img/avatars/<?php echo $row['avatar']; ?>" width="150" height="210" border="0" /></a>
</center><p></span></p>
<?php }

if ($row['gruppa'] <> 'mytants' and $row['gruppa'] <> 'bandits' and $row['gruppa'] <> 'monolits' and $row['gruppa'] <> 'zombie') {


?><p style="border-top: solid 1px #444e4f"></p>
  <div id="main">
<?php
//STATUS

if($user_id==$_SESSION['id']){

if(isset($_POST['st'])){

$str=base64_encode($_POST['st']);
$dbc->query("UPDATE`users`SET`status_us`='$str' WHERE`id`='$user_id'")or die('SQL ERROR');
 header ('Location: settings.php?error=7');
  exit();
}
}
$stat=$dbc->query("SELECT `status_us` FROM`users` WHERE`id`='$user_id'")->fetch_assoc();
if(strlen($stat['status_us'])>2){
$status='<div style="color:#B5B5B5;
font-size:14px;
font-weight:bold;
margin-top: 4px;
margin-bottom: 4px;
background: url(/style/img/titles.png) 100% no-repeat;
background-size: cover;">
'.base64_decode(filter($stat['status_us'])).'</div>';
}else{$status='<div style="color:#B5B5B5;
font-size:18px;
font-weight:bold;
margin-top: 4px;
margin-bottom: 4px;
background: url(/style/img/titles.png) 100% no-repeat;
background-size: cover;">Мир S.T.A.L.K.E.R.</div>';}
echo $status;


//---------//


?>
<div style="background-color: #1E1E1E;">
<p style="border-top: solid 1px #444e4f"></p>

<?php
if ($row['gruppa'] == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/3862297.png" alt="Онлайн"/><?php } else {?><img src="img/3671300.png" alt="Не в сети"/><?php }}
if ($row['gruppa'] == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/3862297.png" alt="Онлайн"/><?php } else {?><img src="img/3671300.png" alt="Не в сети"/><?php }}
if ($row['gruppa'] == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/3862297.png" alt="Онлайн"/><?php } else {?><img src="img/3671300.png" alt="Не в сети"/><?php }}




$user_agent = $row['user_agent'];
$ipod = strpos($user_agent,"iPod");
$iphone = strpos($user_agent,"iPhone");
$android = strpos($user_agent,"Android");
$symb = strpos($user_agent,"Symbian");
$winphone = strpos($user_agent,"WindowsPhone");
$wp7 = strpos($user_agent,"WP7");
$wp8 = strpos($user_agent,"WP8");
$operam = strpos($user_agent,"Opera M");
$palm = strpos($user_agent,"webOS");
$berry = strpos($user_agent,"BlackBerry");
$mobile = strpos($user_agent,"Mobile");
$htc = strpos($user_agent,"HTC_");
$nokia = strpos($user_agent,"Profile/MIDP-2.1");
$fennec = strpos($user_agent,"Fennec/");
if ($ipod || $iphone || $android || $symb || $nokia || $winphone || $wp7 || $wp8 ||  $operam ||  $palm || $berry ||  $mobile ||  $htc || $fennec) {
echo '<span class="white">[<img src="img/mobilka.png" alt="моб. устройство"/>]</span>';
} else {
echo '<span class="white">[<img src="img/pc.png" alt="компьютер"/>]</span>';
}
?>
<p><span class="darkkhaki">
<img src="img/ico/clock.png" width="12" height="12" alt="н"/>Последняя активность:</span> <span class="white"><?php echo $row['last_active']; ?></span></p>
</p><span class="darkkhaki"><img src="img/ico/lvl.gif" width="12" height="12" alt="н"/>Уровень:</span><span class="white">
<?php

$query_lvl = "Select lvl, opit from opit order by lvl desc";
$result_lvl = mysqli_query($dbc, $query_lvl) or die ('Ошибка передачи запроса к БД');
$row_lvl = mysqli_fetch_array($result_lvl);
$big_next_lvl = $row_lvl['opit'];
$lvl=$row_lvl['lvl'];
while (($row['opit']/100)< $row_lvl['opit']) {
$next_lvl = $row_lvl['opit'];
$lvl=($lvl-1);
	  $row_lvl = mysqli_fetch_array($result_lvl);
	  }
	  if ($next_lvl == 0) {
	    $next_lvl = "$big_next_lvl" ;
	  } 
	  $inv2="$lvl";
echo "$lvl";
?></span>
	
	<p><span class="darkkhaki"><img src="img/ico/star.png" width="12" height="12"/>Опыт:</span><span class="white"> <?php 
	if ($lvl <=2) {
	$opit = $row['opit'];
	echo ($opit);  $next_lvl = ($next_lvl*100); echo " / $next_lvl";?></></p><?php
	} 
	else {
	$opit = ($row['opit']/100);
	$opit = round($opit,0);
	echo ($opit/100); ?>к<?php $next_lvl = ($next_lvl/100); echo " / $next_lvl";?>к</> </p>
	<?php
	}
        
	  ?></span>
   
 <p> <span class="darkkhaki"><img src="img/ico/slava.png" width="15" height="15"/>Слава: <span class="white"><?php echo $row['slava']; ?></></p>
 <p><span class="darkkhaki"><img src="img/ico/2.png" width="12" height="12" alt="н"/>Статус:</span><span class="red"><?php if ($row['ban'] == 1) {?>Заблокированный<?php } else {?><span class="bonus"> </span><?php }?></span>
<span class="bonus"><?php if ($row['id'] == 1) {?><?php } else {?><span class="bonus"> </span><?php }?>
<?php

if ($row['admin'] == 1) { echo '<span class="net">Администратор</span>';}
if ($row['admin'] == 2) { echo '<span class="red">Старший модератор</span>';}
if ($row['admin'] == 3) { echo '<span class="bonus">Модератор</span>';}
if ($row['admin'] == 0) { echo '<span class="white">Игрок';}
if ($row['vip'] == 1) { echo '<span class="gold"> (VIP)</span>';}
?><p> <?php if ($row['sex'] == male) {?><span class="darkkhaki"><img src="img/ico/man.png" width="12" height="12" alt="м"/>Пол:</span> <span class="white">Сталкер<?php } else {?><span class="darkkhaki"><img src="img/ico/women.png" width="12" height="12" alt="м"/>Пол:</span>  <span class="white">Сталкерша<?php }?></p>  

<span class="red"><?php if ($row['ban'] == 1) {?><span class="bonus">---</span><br/>
<span class="white">Причина:</span> <br/>
<?php echo $row['why_ban']; ?> <br/>
<span class="bonus">---</span><?php } else {?>
<span class="bonus"> </span><?php }?></span></p>


<?php
	if ($row['gruppa'] == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
if ($row['gruppa'] == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
if ($row['gruppa'] == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/odinochkion.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/odinochkion.png" width="12" height="12" alt="н"/><?php }}
?>
<span class="darkkhaki">Группировка: </span><span class="white"><?php
	 }///////Если не мутанты
	  if ($row['gruppa'] == 'mytants') { echo 'Мутанты';}
	  if ($row['gruppa'] == 'svoboda') { echo 'Свобода';}
	  if ($row['gruppa'] == 'dolg') { echo 'Долг';}
	  if ($row['gruppa'] == 'naemniki') { echo 'Одиночки';} 



	 ?></span>
	  </p>
	  <?php
	  $clan = $row['clan'];
	  $inv = $row['clan'];
	  if ($row['gruppa'] <> 'mytants') {
	  if (!empty($clan)) {
	  $query_clan = "select name, clan_id, mentor from clans where clan_id = '$clan' limit 1";
	  $result_clan = mysqli_query($dbc, $query_clan) or die ('Ошибка передачи запроса к БД');
	  $row_clan = mysqli_fetch_array($result_clan); 
	  $mentor_clan = $row_clan['mentor'];
	 ?>

</a></p><span class="darkkhaki"><img src="img/ico/flag.png" width="12" height="12" alt="н"/>Отряд:
 </span><?php
	  if ($row['clan_rang'] == '1') {?><img src="img/rangs/rekryton.png" width="12" height="12" alt="н"/><?php }
	  if ($row['clan_rang'] == '2') {?><img src="img/rangs/ryadovoyon.png" width="12" height="12"alt="р"/><?php }
	  if ($row['clan_rang'] == '3') {?><img src="img/rangs/serjanton.png" width="12" height="12" alt="с"/><?php }
	  if ($row['clan_rang'] == '4') {?><img src="img/rangs/leitenanton.png" width="12" height="12" alt="л"/><?php }
	  if ($row['clan_rang'] == '5') {?><img src="img/rangs/kapitanon.png" width="12" height="12" alt="к"/><?php }
	  if ($row['clan_rang'] == '6') {?><img src="img/rangs/mayoron.png" width="12" height="12" alt="м"/><?php }
	  if ($row['clan_rang'] == '7') {?><img src="img/rangs/polkovnikon.png" width="12" height="12" alt="п"/><?php }
	  if ($row['clan_rang'] == '8') {?><img src="img/rangs/generalon.png" width="12" height="12" alt="г"/><?php }
	  if ($row['clan_rang'] == '9') {?><img src="img/rangs/lideron.png" width="12" height="12" alt="л"/><?php } 
	  $rank = $row['clan_rang'];
	  ?> 
  <a style="text-decoration:none;" href="company.php?company_id=<?php echo $row_clan['clan_id'];?>"><?php echo $row_clan['name']; ?></a>
 <?php
	  if ($row['clan_rang'] == '1') {?>(Рекрут)<?php }
	  if ($row['clan_rang'] == '2') {?>(Рядовой)<?php }
	  if ($row['clan_rang'] == '3') {?>(Сержант)<?php }
	  if ($row['clan_rang'] == '4') {?>(Лейтенант)<?php }
	  if ($row['clan_rang'] == '5') {?>(Капитан)<?php }
	  if ($row['clan_rang'] == '6') {?>(Майор)<?php }
	  if ($row['clan_rang'] == '7') {?>(Полковник)<?php }
	  if ($row['clan_rang'] == '8') {?><span class="bonus">(Генерал)</span><?php }
	  if ($row['clan_rang'] == '9') {?><span class="yellow">(Лидер)</span><?php } 
	  $rank = $row['clan_rang'];
	  ?> 
  <?php
}
?></div><p style="border-top: solid 1px #444e4f"></p>


<div style="background-color: #000000;"> 
<?php if ($row['gruppa'] <> 'mytants' and $row['gruppa'] <> 'bandits' and $row['gruppa'] <> 'monolits' and $row['gruppa'] <> 'zombie') { ?>

<center><p class="profile">Амуниция</p></center>

<p class="net">Награды:</p>
<div style="background-color: #1E1E1E;">
<p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"></p>
<?php
      if ($row['nagrada'] == '0') { echo 'Нет наград';}
	if ($row['nagrada']  == '1') { echo '<img src="img/images.jpeg" width="50" height="75" />';}
          if ($row['nagrada'] == '2') { echo '<img src="img/nagrads/okulist.png" width="50" height="55" />';}
          if ($row['nagrada'] == '3') { echo '<img src="img/nagrads/vremya_jatvi.png" width="50" height="55" />';}
?>
 <p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"></p>
</div>
    <p>
	<?php
$query_cl = "Select inf_id from things where user_id = '$user_id' and type = '4' and place = 2 limit 1";
	$result_cl = mysqli_query($dbc, $query_cl) or die ('Ошибка передачи запроса к БД');
	$row_cl = mysqli_fetch_array($result_cl);
	if ($row_cl != 0) {
	$shlem_id = $row_cl['inf_id'];
	$query_ch = "Select screen from shlem where shlem_id = '$shlem_id' limit 1";
	$result_ch = mysqli_query($dbc, $query_ch) or die ('Ошибка передачи запроса к БД');
	$row_ch = mysqli_fetch_array($result_ch);
	?><span class="cloth"><center><img src="img/shlem/<?php echo $row_ch['screen'];?>" width="55" height="55" /></span></center><?php }else{?><center><img src="img/shlem/0.png" alt="Слот 4" width="55" height="55" /></center><?php }
	////////////////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////////////////
	$query_cl = "Select inf_id from things where user_id = '$user_id' and type = '1' and place = 2 limit 1";
	$result_cl = mysqli_query($dbc, $query_cl) or die ('Ошибка передачи запроса к БД');
	$row_cl = mysqli_fetch_array($result_cl);
	if ($row_cl != 0) {
	$clothes_id = $row_cl['inf_id'];
	$query_cl = "Select screen from clothes where clothes_id = '$clothes_id' limit 1";
	$result_cl = mysqli_query($dbc, $query_cl) or die ('Ошибка передачи запроса к БД');
	$row_cl = mysqli_fetch_array($result_cl);
	?><span class="cloth"><center><img src="img/clothes/<?php echo $row_cl['screen'];?>" width="70" height="90" /></center></span><?php }else{?><center><img src="img/clothes/0.png" alt="Слот ІІІ1" width="50" height="50" /></center><?php }
	////////////////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////////////////
	$query_cl = "Select inf_id from things where user_id = '$user_id' and type = '2' and place = 2 limit 1";
	$result_cl = mysqli_query($dbc, $query_cl) or die ('Ошибка передачи запроса к БД');
	$row_cl = mysqli_fetch_array($result_cl);
	if ($row_cl != 0) {
	$pistols_id = $row_cl['inf_id'];
	$query_p = "Select screen from pistols where pistols_id = '$pistols_id'";
	$result_p = mysqli_query($dbc, $query_p) or die ('Ошибка передачи запроса к БД');
	$row_p = mysqli_fetch_array($result_p);
	?><p><span class="cloth"><center><img src="img/weapons/<?php echo $row_p['screen'];?>" width="50" height="50" /></span></center><?php }else{?> <span class="cloth"><center><img src="img/weapons/0pistol.png" width="50" height="50" /></span></center><?php }
	//////////////////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////////////////
$query_cl = "Select inf_id from things where user_id = '$user_id' and type = '6' and place = 2 limit 1";
$result_cl = mysqli_query($dbc, $query_cl) or die('Ошибка передачи запроса кБД');
$row_cl =mysqli_fetch_array($result_cl);
if ($row_cl != 0) {
$artefact_id = $row_cl['inf_id'];
$query_art = "Select screen from artefact where artefact_id ='$artefact_id'"; 
$result_art = mysqli_query($dbc, $query_p) or die('Ошибка передачи запроса кБД');
$row_art =mysqli_fetch_array($result_p); 

?><p><?php echo''.$row_art['screen'].'';?><span class="cloth"><center><img src="img/artefact/<?php echo''.$row_art['screen'].'';?>" width="50" height="50" /></span></center><?php }else{?><center><img src="img/clothes/0.png" alt="Слот ІІ" width="50" height="50" /></center><?php }
///////////////////////////////////////////////////////////////////////////
	$query_cl = "Select inf_id from things where user_id = '$user_id' and type = '3' and place = 2 limit 1";
$result_cl = mysqli_query($dbc, $query_cl) or die ('Ошибка передачи запроса к БД');
$row_cl = mysqli_fetch_array($result_cl);
if ($row_cl != 0) {
$weapons_id = $row_cl['inf_id'];
$query_w = "Select screen from weapons where weapons_id = '$weapons_id'";
$result_w = mysqli_query($dbc, $query_w) or die ('Ошибка передачи запроса к БД');
$row_w = mysqli_fetch_array($result_w);
?><p><span class="cloth"><center><img src="img/weapons/<?php echo $row_w['screen'];?>" /></span></p></center><?php } else { ?><p><span class="cloth"><center><img src="img/weapons/0weapon.png" width="145" height="50"/></span></p></center><?php } ?>
</center>

<p class="link"<p><img src="img/ico/shield.png" width="12" height="12"/> <a style="text-decoration:none;" href="clothes.php?id=<?php echo $row['id']; ?>">Снаряжение</a></p>
<p class="link"<p><img src="img/ico/dos.png"  alt="п"width="12" height="12"/> <a style="text-decoration:none;" href="profile.php?id=<?php echo $row['id']; ?>&vid=dos">Достижения</a></p>

<?php if(!empty($_GET['vid'])) {?><p>
   <?php if ($_GET['vid']==dos) {echo '
<p><img src="img/ico/arena_win.png"/> Побед: <span class="white">'.$row['arena_pobed'].'</span></p>
<p><img src="img/ico/arena_los.png"/> Поражений: <span class="white">'.$row['arena_los'].'</span></p>
<p><img src="img/ico/yes.png"/> Выполнено заданий: <span class="white">'.$row['zadaniya'].'</span></p>
<p><img src="img/ico/clock.png"/> Взломов сейфа: <span class="white">'.$row['vzlom'].'</span></p>
<p class="podmenu" style="border-top:1px solid #444e4f; background-color:#1c252f;"></p>
<a style="text-decoration:none;" class="menu" href="profile.php?id='.$row['id'].'"><img src="img/reload.gif" width="15" height="15"/> Скрыть</a>
';}?>
      </div><?php } ?>

<?php
$id = abs(intval($_SESSION['id']));

$query_lvll = "Select lvl, opit from opit order by lvl desc";
$result_lvll = mysqli_query($dbc, $query_lvll) or die ('Ошибка передачи запроса к БД');
$row_lvll = mysqli_fetch_array($result_lvll);
$big_next_lvll = $row_lvll['opit'];
$lvl=$row_lvll['lvl'];
$inv2="$lvl";



$query = "Select admin, id, gruppa from users where id = '$id' limit 1";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
$row2 = mysqli_fetch_array($result);
if ((isset($_SESSION['id'])) and (isset($_SESSION['nick'])))  {
if ($row2['admin'] == 0) {
if ($row['admin'] <> 1 and $row['admin'] <> 2 and $row['admin'] <> 3 and $row['admin'] <> 4 and $row['admin'] <> 5) {
if (($id != $user_id)) {
?>
<p class="link"<p><img src="img/ico/letter.png"  alt="п"width="12" height="12"/> <a style="text-decoration:none;" href="mes.php?act=dialog&id=<?php echo "$user_id"?>">Отправить сообщение</a></p>
<?php
}
}
else {
?>
<p class="link"<p><img src="img/ico/letter.png"  alt="п"width="12" height="12"/> <a style="text-decoration:none;" href="mes.php?act=dialog&id=<?php echo "$user_id"?>">Отправить сообщение</a></p>
<?php
}
}
else {
if ($id != $user_id) {
?>
<p class="link"<p><img src="img/ico/letter.png"  alt="п"width="12" height="12"/> <a style="text-decoration:none;" href="mes.php?act=dialog&id=<?php echo "$user_id"?>">Отправить сообщение</a></p>
<?php if ($row2['admin'] == 1 or $row2['admin'] == 4) {?>Выдать бан:<p class="link"><a  style="text-decoration:none;" href="us_ban.php?usid=<?php echo "$user_id"; ?>&type=4""><img src="img/ico/mail.png"  alt=""width="12" height="12"/>На Почту</a>  |  <a style="text-decoration:none;" href="us_ban.php?usid=<?php echo "$user_id"; ?>&type=1""><img src="img/ico/ban_chat.png"  alt=""width="12" height="12"/><span class="red">На чат</span></a>  |  <a  style="text-decoration:none;" href="us_ban.php?usid=<?php echo "$user_id"; ?>&type=2""><img src="img/ico/forum.png"  alt=""width="12" height="12"/><span class="blue">На форум</a></span></p> <?php if ($row['ban'] == 0) {?>
<p class="link">[<a style="text-decoration:none;" href="moderator.php?profile=<?php echo "$user_id"; ?>&type=8">На игру</a><?php } else {?><span class="red">Забанен</span><?php }?>]
[<a  style="text-decoration:none;" href="us_ban.php?usid=<?php echo "$user_id"; ?>&type=3"">Забанить на IP</a>]</p><?php }
	  ?>
<?php if ($row2['admin'] == 2 or $row2['admin'] == 3 or $row2['admin'] == 5) {?>Выдать бан:<p class="link"><a  style="text-decoration:none;" href="us_ban.php?usid=<?php echo "$user_id"; ?>&type=4""><img src="img/ico/mail.png"  alt=""width="12" height="12"/>На Почту</a>  |  <a style="text-decoration:none;" href="us_ban.php?usid=<?php echo "$user_id"; ?>&type=1""><img src="img/ico/ban_chat.png"  alt=""width="12" height="12"/><span class="red">На чат</span></a>  |  <a  style="text-decoration:none;" href="us_ban.php?usid=<?php echo "$user_id"; ?>&type=2""><img src="img/ico/forum.png"  alt=""width="12" height="12"/>На форум</a></p><?php }
  }
}
}
	  if ((empty($inv)) and ($row['gruppa'] == $row2['gruppa']) and ($inv2 >= 10)) {
	  $inv_id = $_SESSION['id'];
	  $query_inv = "Select clan, clan_rang from users where id = '$inv_id'";
      $result_inv = mysqli_query($dbc, $query_inv) or die ('Ошибка передачи запроса к БД'); 
      $row_inv = mysqli_fetch_array($result_inv);
	  $rank = $row_inv['clan_rang'];
	  $clan_inv = $row_inv['clan'];
	    if ((!empty($clan_inv)) and ($rank > 5)) {
	      ?>
    <p class="link"<p><img src="img/ico/point.png"  alt=""width="12" height="12"/> <a style="text-decoration:none;" href="invite.php?set_id=<?php echo "$user_id";?>">Пригласить в отряд</a></p>
	      <?php
	    }
      } 
}

$now = (date("Y-m-d H:i:s"));
$now = strtotime("$now");
$mentor_time = strtotime("$mentor_time");
$razn_mentor_user = ($now - $mentor_time);
if ($razn_mentor_user < 3600) {
$mentor_flag = 1;
  if ($mentor_type == 1) { 
    $mentor_clan = ($mentor_clan/2);
  }
}
else {
$mentor_flag = 0;
}
?>

<?php if ($row['gruppa'] <> 'mytants' and $row['gruppa'] <> 'bandits' and $row['gruppa'] <> 'monolits' and $row['gruppa'] <> 'zombie') { ?>

    </center><center><p class="profile" style="border-top:1px solid #444e4f; background-color:#1c252f;">Одежда</p></center>
<p style="border-top: dashed #444e4f 1px;"></p>
<div style="background-color:#0B0B0B;">
  <p><img src="img/ico/life.png" width="12" height="12"/> здоровье: 
  <?php if ($mentor_flag == 0) {?><span class="white"><?php echo $row['max_hp']; ?></span><?php } else {$max_hp = ($row['max_hp']+$row['max_hp']/100*$mentor_clan); $max_hp = round($max_hp);?><span class="bonus"><?php echo "$max_hp";?></span><?php }?></p>
  <p><img src="img/ico/shield.png" width="12" height="12"/> броня:
  <?php if ($mentor_flag == 0) {?><span class="white"><?php echo $row['bronya']; ?></span><?php } else {$bronya = ($row['bronya']+$row['bronya']/100*$mentor_clan); $bronya = round($bronya);?><span class="bonus"><?php echo "$bronya";?></span><?php }?></p>
  <p><img src="img/ico/shield.png" width="12" height="12"/> прочность:
  <?php if ($mentor_flag == 0) {?><span class="white"> <?php echo $row['razriv_cl']; ?></span><?php } else {$razriv_cl = ($row['razriv_cl']+$row['razriv_cl']/100*$mentor_clan); $razriv_cl = round($razriv_cl);?><span class="bonus"> <?php echo "$razriv_cl";?></span><?php }?></p>
  <p><img src="img/ico/goodrad.png" width="12" height="12"/> рад.защита:
  <?php if ($mentor_flag == 0) {?><span class="white"> <?php echo $row['radiation']; ?></span><?php } else {$radiation = ($row['radiation']+$row['radiation']/100*$mentor_clan); $radiation = round($radiation);?><span class="bonus"> <?php echo "$radiation";?></span><?php }?></p>
     <p><img src="img/ico/regen.gif" width="12" height="12"/> регенерация:
  <?php if ($mentor_flag == 0) {?><span class="white"> <?php echo $row['regen']; ?></span><?php } else {$regen = ($row['regen']+$row['regen']/100*$mentor_clan); $radiation = round($regen);?><span class="bonus"> <?php echo "$regen";?></span><?php }?></p>
 </div>
    <div class="stats"></div>

    <center><p class="profile" style="border-top:1px solid #444e4f; background-color:#1c252f;">Оружие</p></center>
<p style="border-top: dashed #444e4f 1px;"></p>
<div style="background-color:#0B0B0B;">
  <p><img src="img/ico/to4nost.png" width="12" height="12"/> урон: <?php if ($mentor_flag == 0) {?><span class="white"> <?php echo $row['yron_p']; ?></span><?php } else {$yron_p = ($row['yron_p']+$row['yron_p']/100*$mentor_clan); $yron_p = round($yron_p);?><span class="bonus"> <?php echo "$yron_p";?></span><?php }?> ||
 <?php if ($mentor_flag == 0) {?><span class="white"> <?php echo $row['yron_w']; ?></span><?php } else {$yron_w = ($row['yron_w']+$row['yron_w']/100*$mentor_clan); $yron_w = round($yron_w);?><span class="bonus"> <?php echo "$yron_w";?></span><?php }?></p>
  <p><img src="img/ico/to4nost.png" width="12" height="12"/> точность: <?php if ($mentor_flag == 0) {?><span class="white"> <?php echo $row['tochn_p']; ?></span><?php } else {$tochn_p = ($row['tochn_p']+$row['tochn_p']/100*$mentor_clan); $tochn_p = round($tochn_p);?><span class="bonus"> <?php echo "$tochn_p";?></span><?php }?> || 
  <?php if ($mentor_flag == 0) {?><span class="white"> <?php echo $row['tochn_w']; ?></span><?php } else {$tochn_w = ($row['tochn_w']+$row['tochn_w']/100*$mentor_clan); $tochn_w = round($tochn_w);?><span class="bonus"> <?php echo "$tochn_w";?></span><?php }?></p> 
  <p><img src="img/ico/to4nost.png" width="12" height="12"/> надёжность: <span class="white"><?php echo $row['safety_p'];?> </span> || <span class="white"><?php echo $row['safety_w']; ?>%</span></p>
  <p><img src="img/ico/to4nost.png" width="12" height="12"/> скорострельность: <span class="white"><?php echo $row['speed_p'];?> </span>|| <span class="white"><?php echo $row['speed_w']; ?></span></p>
  <?php
  if ($mentor_flag == 1) {
  ?>
  <p><img src="img/ico/point.png" width="12" height="12"/> Наставник: <span class="bonus"><?php 
  echo "$mentor_clan";
 ?>%</span> 


  <?php
  $time = (date("Y-m-d H:i:s"));
  $time = strtotime("$time");
  $mentor_time = ($time - $mentor_time);
  if ($mentor_time <= 3600) {

  $echo_time = (3600 - $mentor_time);

  $hours_time = ($echo_time/3600);


  $hours_time = floor($hours_time);
  $minutes_time = ($echo_time - (3600 * $hours_time));



  $minutes_time = ($minutes_time/60);


  $minutes_time = floor($minutes_time);
  $seconds = ($echo_time - ($hours_time*3600) - ($minutes_time*60));





  }
  ?><span class="bonus">[<?php echo "$hours_time:$minutes_time:$seconds";?>]</span></p>

<?php
  }
}
}
}
	?>
  </div>
  <?php
    ///ecли не мутанты
  require_once('conf/navig.php');
  }
    require_once('conf/foot.php');
	mysqli_close($dbc);
  ?>
</body>
</html>