<?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');
$usid = $_SESSION['id'];
$usst=$dbc->query("SELECT * FROM `users` WHERE`id`='$usid' LIMIT 1")->fetch_assoc();
$user_id = abs(intval($_GET['id']));
$user_id = mysqli_real_escape_string($dbc, trim($user_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);
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);
?><br/>
<div class="stats">
<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/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
if ($row['gruppa'] == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
if ($row['gruppa'] == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
echo ' '.$row['nick'].'</span></a><span class="bonus"> Id :'.$row['id'].'</span></p></center>';
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 }
 if ($row['vip'] == 0) {?>
<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 }
?>
  </div>
  <?php
if ($row['gruppa'] <> 'mytants' and $row['gruppa'] <> 'bandits' and $row['gruppa'] <> 'monolits' and $row['gruppa'] <> 'zombie') {




$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(htmlspecialchars($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;">Возрождение Тьмы</div>';}
echo $status;


//---------//
?>
<div class="r6">
<?php
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");
$samsung= strpos($user_agent,"S5230XEII4 SHP");
$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 || $samsung || $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>';
}
if($usid <> abs(intval($_GET['id']))){
?>
<p><span class="darkkhaki">
<img src="img/ico/clock.png" width="12" height="12" alt="н"/>Последние действия:</span> <span class="white"><?php
require_once('conf/time.php');echo' назад </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 * 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";

$per=($next_lvl*100)-($row_lvl['opit']*100);
$optmy=$row[opit]-($row_lvl['opit']*100);
$exp1 = $optmy/$per;
$exp=$exp1*100;
$exp=round($exp);
echo'<span class="net"> ('.$exp.'%)</span></p>';
	  ?></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>';}
?></span><br/>  <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/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
if ($row['gruppa'] == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
if ($row['gruppa'] == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/chistoenebo.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 'Воины Ада';} 
          if ($row['gruppa'] == 'renegat') { echo 'Ренегаты';}
	  if ($row['gruppa'] == 'chistoenebo') { 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
}
echo'</div>';	
switch($_GET[vid]){
default:
if ($row['gruppa'] <> 'mytants' and $row['gruppa'] <> 'bandits' and $row['gruppa'] <> 'monolits' and $row['gruppa'] <> 'zombie') {
$query = "Select * from anketa where id_us = '$user_id' limit 1";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
$anka = mysqli_fetch_array($result);
echo'<div class="r6"><div class="dot"><a style="text-decoration:none;" href="user.php?id='.$row['id'].'&vid=stats"><img src="img/ico/shield.png" width="12" height="12"/> Характеристики</a></div>';
if($anka[id_us]== $row['id'] and !empty($anka[name])){
echo'<div class="dot"><a  style="text-decoration:none;" href="anketa.php?id='.$row['id'].'"><img src="img/anketa.png" width="12" height="12"/> Анкета</a></div>';}
echo'<div class="dot"><a  style="text-decoration:none;" href="user.php?id='.$row['id'].'&vid=static"><img src="img/ico/dos.png" width="12" height="12"/> Статистика</a></div>';

$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";



$row2=$dbc->query("Select * from users where id = '$id' limit 1")->fetch_assoc();
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)) {
?>
<div class="dot"><a  style="text-decoration:none;" href="mes.php?act=dialog&id=<?php echo "$user_id"?>"><img src="img/ico/letter.png"  alt="п"width="12" height="12"/> Отправить сообщение</a></div>
<?php
}
}
else {
?>
<div class="dot"><a  style="text-decoration:none;" href="mes.php?act=dialog&id=<?php echo "$user_id"?>"><img src="img/ico/letter.png"  alt="п"width="12" height="12"/> Отправить сообщение</a></div>
<?php
}
}
else {
if ($id != $user_id) {
?>
<div class="dot"><a  style="text-decoration:none;"  href="mes.php?act=dialog&id=<?php echo "$user_id"?>"><img src="img/ico/letter.png"  alt="п"width="12" height="12"/> Отправить сообщение</a></div>
<?php
    }
      } 
  if ((empty($inv)) and ($row['gruppa'] == $row2['gruppa']) and ($inv2 >= 10)) {
	  $inv_id = $_SESSION['id'];
	  $query_inv = "Select * 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)) {
	      ?>
<div class="dot"><a  style="text-decoration:none;" href="invite.php?set_id=<?php echo "".$row['id']."";?>">  <img src="img/ico/flag.png"  alt=""width="12" height="12"/> Пригласить в отряд</a></div>
	      <?php
	  }
}
 if ($row2['admin'] >0 ) {echo'<div class="dot"><a  style="text-decoration:none;" href="user.php?id='.$row['id'].'&vid=mod"><img src="/img/mod.png" width="12" height="12"/> Модер-панель</a></div>';}
 if ($row2['admin'] == 1 ) {echo'<div class="dot"><a  style="text-decoration:none;" href="user.php?id='.$row['id'].'&vid=adm"><img src="/img/adm.png" width="12" height="12"/> Админ-панель</a></div>';}
echo'</div>';
}
}
break;
case 'adm':
if($usst[admin]<>'1' ){header('location: user.php?id='.$row['id'].'');}
$ip=$row['uip'];
$query_num = "Select * from users where ban= '0' and uip = '$ip' and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'" ;
	$result_num = mysqli_query($dbc, $query_num) or die ('Ошибка передачи запроса к БД');
	$total = mysqli_num_rows($result_num); 
echo'<p class="podmenu" style="border-top:1px dashed #444e4f; background-color:#1c252f;"></p>
<center><span class="yellow">Персонажи </span><span class="white">('.$total.')</span> <span class="darkkhaki">(Ip='.$row['uip'].'): </span></p>';
	  $query_us = "Select *  from users where ban= '0' and uip = '$ip' and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits' order by  uip = '$ip' and  last_active > NOW()-(300*5) DESC ";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  while ($row_us = mysqli_fetch_array($result_us)) {
	  $lvl = $row_us['lvl'];
          $ip=$row_us['uip'];
	  $g = $row_us['gruppa'];
		echo'<center>';
if($g=='dolg'){$gruppa='<img src="/img/ico/dolg.png" height="12" width="12"/>';}elseif($g=='chistoenebo'){$gruppa='<img src="/img/ico/chistoenebo.png" height="12" width="12"/>';}elseif($g=='renegat'){$gruppa='<img src="/img/ico/renegat.png" height="12" width="12"/>';}elseif($g=='naemniki'){$gruppa='<img src="/img/ico/naemniki.png" height="12" width="12"/>';}elseif($g=='svoboda'){$gruppa='<img src="/img/ico/svoboda.png" height="12" width="12"/>';}
$last_active = $row_us['last_active'];$last_active = strtotime("$last_active");$now = (date("Y-m-d H:i:s"));$now = strtotime("$now");$ont = ($now - $last_active);
if($ont<300){$onl='<img src="/img/ico/on.png" height="12" width="12"/>';}else{$onl='<img src="/img/ico/off.png" height="12" width="12"/>';}
echo' '.$onl.' '.$gruppa.' <span class="white">['.$lvl.' ур] </span><a style="text-decoration:none;" href="user.php?id='.$row_us['id'].'">'.$row_us['nick'].'</a></p></b></center><span class="white">';
}
echo'<center><span class="bonus">-----</span></center>';
$user_agent=$row['user_agent'];
$query_num = "Select * from users where ban= '0' and user_agent = '$user_agent' and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'" ;
	$result_num = mysqli_query($dbc, $query_num) or die ('Ошибка передачи запроса к БД');
	$total = mysqli_num_rows($result_num); 
echo'<p class="podmenu" style="border-top:1px dashed #444e4f; background-color:#1c252f;"></p>
<center><span class="yellow">Персонажи </span><span class="white">('.$total.')</span> <span class="darkkhaki">Код браузера:</span> <span class="net">( '.$row['user_agent'].' ): </span></p>';
	  $query_us = "Select *  from users where ban= '0' and user_agent = '$user_agent' and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits' order by  user_agent = '$user_agent' and  last_active > NOW()-(300*5) DESC ";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  while ($row_us = mysqli_fetch_array($result_us)) {
	  $lvl = $row_us['lvl'];
          $ip=$row_us['uip'];
	  $g = $row_us['gruppa'];
		echo'<center>';
if($g=='dolg'){$gruppa='<img src="/img/ico/dolg.png" height="12" width="12"/>';}elseif($g=='chistoenebo'){$gruppa='<img src="/img/ico/chistoenebo.png" height="12" width="12"/>';}elseif($g=='renegat'){$gruppa='<img src="/img/ico/renegat.png" height="12" width="12"/>';}elseif($g=='naemniki'){$gruppa='<img src="/img/ico/naemniki.png" height="12" width="12"/>';}elseif($g=='svoboda'){$gruppa='<img src="/img/ico/svoboda.png" height="12" width="12"/>';}
$last_active = $row_us['last_active'];$last_active = strtotime("$last_active");$now = (date("Y-m-d H:i:s"));$now = strtotime("$now");$ont = ($now - $last_active);
if($ont<300){$onl='<img src="/img/ico/on.png" height="12" width="12"/>';}else{$onl='<img src="/img/ico/off.png" height="12" width="12"/>';}
echo' '.$onl.' '.$gruppa.' <span class="white">['.$lvl.' ур] </span><a style="text-decoration:none;" href="user.php?id='.$row_us['id'].'">'.$row_us['nick'].'</a></p></b></center><span class="white">';
}
echo'<p class="podmenu" style="border-top:1px dashed #444e4f; background-color:#1c252f;"></p><center><a class="prof" style="text-decoration:none;" href="ban.php?id='.$user_id.'">Забанить</a></center></center>
<center><span class="bonus">-----</span></center>
<p class="podmenu" style="border-top:1px dashed #444e4f; background-color:#1c252f;"></p><a class="prof" style="text-decoration:none;" href="red.php?id='.$user_id.'">Редактировать</a></center>
</center>
<div class="forlink"><a class="link" style="text-decoration:none;" href="ref_adm.php?id='.$user_id.'">Список приглашенных</a></div>
<div class="r2"><img src="img/reload.gif" width="15" height="15"/><a style="text-decoration:none;"  href="user.php?id='.$row['id'].'"> Назад</div></a>';
break;
case 'mod':
if($usst[admin]<='0' ){header('location: user.php?id='.$row['id'].'');}
$ip=$row['uip'];
$query_num = "Select * from users where ban= '0' and uip = '$ip' and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'" ;
	$result_num = mysqli_query($dbc, $query_num) or die ('Ошибка передачи запроса к БД');
	$total = mysqli_num_rows($result_num); 
echo'<p class="podmenu" style="border-top:1px dashed #444e4f; background-color:#1c252f;"></p><center><span class="yellow">Персонажи </span><span class="white">('.$total.')</span> <span class="darkkhaki">(Ip='.$row['uip'].'): </span></p>';
	  $query_us = "Select *  from users where ban= '0' and uip = '$ip' and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits' order by  uip = '$ip' and  last_active > NOW()-(300*5) DESC ";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  while ($row_us = mysqli_fetch_array($result_us)) {
	  $lvl = $row_us['lvl'];
          $ip=$row_us['uip'];
	  $g = $row_us['gruppa'];
		echo'<center>';
if($g=='dolg'){$gruppa='<img src="/img/ico/dolg.png" height="12" width="12"/>';}elseif($g=='chistoenebo'){$gruppa='<img src="/img/ico/chistoenebo.png" height="12" width="12"/>';}elseif($g=='renegat'){$gruppa='<img src="/img/ico/renegat.png" height="12" width="12"/>';}elseif($g=='naemniki'){$gruppa='<img src="/img/ico/naemniki.png" height="12" width="12"/>';}elseif($g=='svoboda'){$gruppa='<img src="/img/ico/svoboda.png" height="12" width="12"/>';}
$last_active = $row_us['last_active'];$last_active = strtotime("$last_active");$now = (date("Y-m-d H:i:s"));$now = strtotime("$now");$ont = ($now - $last_active);
if($ont<300){$onl='<img src="/img/ico/on.png" height="12" width="12"/>';}else{$onl='<img src="/img/ico/off.png" height="12" width="12"/>';}
echo' '.$onl.' '.$gruppa.' <span class="white">['.$lvl.' ур] </span><a style="text-decoration:none;" href="user.php?id='.$row_us['id'].'">'.$row_us['nick'].'</a></p></b></center><span class="white">';
}
echo'<p class="podmenu" style="border-top:1px dashed #444e4f; background-color:#1c252f;"></p><center><a class="prof" style="text-decoration:none;" href="ban.php?id='.$user_id.'">Забанить</a></center>';
echo'</b></center>
<div class="forlink"><a class="link" style="text-decoration:none;" href="ref_mod.php?id='.$user_id.'">Список приглашенных</a></div>
<div class="r2"><img src="img/reload.gif" width="15" height="15"/><a style="text-decoration:none;"  href="user.php?id='.$row['id'].'"> Назад</div></a>';
break;
case 'stats':
  ?>
<div style="background-color: #000000;"> 
<center><p class="profile">Амуниция</p></center>
<p style="border-top: dashed #444e4f 1px;"></p>
 <div class="foot"> 
<center><?php if ($row['gruppa'] <> 'mytants' and $row['gruppa'] <> 'bandits' and $row['gruppa'] <> 'monolits' and $row['gruppa'] <> 'zombie') { ?>
  <div id="clothes">
    <p>
	<?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"><img src="img/clothes/<?php echo $row_cl['screen'];?>" width="70" height="90" /></span><?php }else{?><img src="img/clothes/0.png" alt="Слот ІІІ1" width="50" height="50" /><?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"><img src="img/weapons/<?php echo $row_p['screen'];?>" width="50" height="50" /></span><?php }else{?> <span class="cloth"><img src="img/clothes/0.png" width="50" height="50" /></span><?php }
	//////////////////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////////////////
$query_cl = "Select inf_id
from things where user_id =
'$user_id' and type = '6' and
place = 6 limit 1";
$result_cl = mysqli_query
($dbc, $query_cl) or die
('Ошибка передачи запроса к
БД');
$row_cl =
mysqli_fetch_array($result_cl);
if ($row_cl != 0) {
$artfs_id = $row_cl
['inf_id'];
$query_p = "Select screen
from artfs where artfs_id =
'$pistols_id'"; 
$result_p = mysqli_query
($dbc, $query_p) or die
('Ошибка передачи запроса к
БД');
$row_p =
mysqli_fetch_array($result_p); 

?><p><span class="cloth"><img src="img/clothes/<?php echo $row_cl['screen'];?>" width="50" height="50" /></span><?php }else{?><img src="img/clothes/0.png" alt="Слот ІІ" width="50" height="50" /><?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"><img src="img/weapons/<?php echo $row_w['screen'];?>" /></span></p><?php } else { ?><p><span class="cloth"><img src="img/clothes/0.png" width="145" height="50"/></span></p><?php } ?>
</center>

<?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;">
<div class="foot">
  <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>

    <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;">
<div class="foot">
  <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
 }
echo'<div class="r2"><img src="img/reload.gif" width="15" height="15"/><a style="text-decoration:none;"  href="user.php?id='.$row['id'].'"> Назад</div></a>';
}
break;
case 'static':

$timegame=($now-strtotime($row['timereg']));
  ?><div class="r6">
<p><img src="img/ico/arena_win.png"/> Дата регистрации: <span class="bonus"><?php echo $row['timereg']; ?></span></p>
<p class="zx"></p>
<p><img src="img/ico/arena_win.png"/> В игре: <span class="net"><?php
require_once('conf/timegame.php');

?></span></p>
<p class="zx"></p>
<p><img src="img/ico/arena_win.png"/> Побед: <span class="white"><?php echo $row['arena_pobed']; ?></span></p>
<p><img src="img/ico/arena_los.png"/> Поражений: <span class="white"><?php echo $row['arena_los']; ?></span></p>
<p><img src="img/ico/yes.png"/> Выполнено заданий: <span class="white"><?php echo $row['zadaniya']; ?></span></p>
<p><img src="img/ico/clock.png"/> Взломов у Старика: <span class="white"><?php echo $row['vzlom']; ?></span></p>
<p><img src="img/ico/clock.png"/> Время у Шамана: <span class="white"><?php echo $row['tainiki_rat']; ?></span> секунд</p>

<div class='r2'><img src="img/reload.gif" width="15" height="15"/><a style="text-decoration:none;"  href="user.php?id=<?php echo $row['id']; ?>"> Назад</div></a></div>
 

<?php
}
}
}
}
//////////////////////////////////////

require_once('conf/navig.php');
require_once('conf/foot.php');
?>
</body>
</html>