<?php

require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
$page_title = 'Рейтинги';
require_once('conf/head.php');
if ((isset($_SESSION['id'])) and (isset($_SESSION['nick'])))  {
$user_id = abs(intval($_SESSION['id']));
$query_loc = "update users set location = 'rating' where id = '$user_id' limit 1";
$result_loc = mysqli_query($dbc, $query_loc) or die ('Ошибка передачи запроса к БД');
require_once('conf/top.php');
}
switch($_GET[tip]){
default:
?><br/>
<div id="main">
<div class="name2"><center>Рейтинги игроков</center></div>
<a href="?tip=1" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По опыту</a>
<a href="?tip=2" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По славе</a>
<a href="?tip=3" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По активности</a>
<?php 
if(empty($_GET['ar'])==1){echo'<a href="?ar=1" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>Арена...</a>';}
else {echo'<a href="rating" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>Аренa...</a>';}
  if(!empty($_GET['ar'])) {?>
<?php if (abs(intval($_GET['ar']))==1) {echo '<p style="border-top:1px solid #444e4f;"></p>
<a href="?tip=4" class="menu1"><img src="img/ico/arena_los.png" width="12" height="12"/> По поражениям</a>
<p style="border-top: dashed #444e4f 1px;">
<a href="?tip=5" class="menu1"><img src="img/ico/arena_win.png" width="12" height="12"/> По победам</a>
';}}
$query = "Select  * from users where id = '$user_id'  limit 1";
  $result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД6');
  $row = mysqli_fetch_array($result);

 ?>
<a href="ratingv" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По вооружению</a></span>
<a class="menu" href="?tip=6" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По поиску сокровищ </a></span>
<a class="menu" href="?tip=7" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По взлому сундука</a></span>
<a class="menu" href="?tip=8" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По выполненным заданиям</a></span>
<a class="menu" href="?tip=vip"><img src="img/ico/star.png" width="12" height="12"/></img><span class="gold">Vip-игроки</span></a></span>
<a class="menu" href="poisk.php" class="menu"><img src="img/ico/search.png" width="12" height="12" alt="."/><span class="bonus">Поиск</a></span>
<div class="stats">
<div class="name2"><center>Рейтинги отрядов</center></div>
<a href="createcompany.php" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>Создать Клан</a>
<a href="?tip=9" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По опыту</a>
<a href="?tip=10" class="menu"><img src="img/ico/link.png" width="12" height="12" alt="."/>По славе</a>
<?php

break;
case'1':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Рейтинг самых опытных игроков! <img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where 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); 
	?>
	<p class="foot">Всего игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by opit DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);
	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>

 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p class="foot">Опыт:<img src="/img/ico/star.png" width="12" height="12"> '.$row_us['opit'].' </p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=1');} //Навигация гг
	?>
	</div>
	<?php
break;
case'2':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Прославленные<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where 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); 
	?>
	<p class="foot">Всего игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by slava DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p class="foot">Слава:<img src="/img/ico/slava.png" width="12" height="12"> '.$row_us['slava'].' </p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=2');} //Навигация гг
	?>
	</div>
	<?php
break;
case'3':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Рейтинг активности игроков <img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where 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); 
	?>
	<p class="foot">Всего игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by activ DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p class="foot">Активность:<img src="/img/ico/point.png" width="12" height="12"> '.$row_us['activ'].' </p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=3');} //Навигация гг
	?>
	</div>
	<?php
break;
case'4':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Дуэлянты<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where 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); 
	?>
	<p class="foot">Всего игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by arena_los DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p class="foot">Поражения:<img src="/img/ico/arena_los.png" width="12" height="12"> '.$row_us['arena_los'].' </p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=4');} //Навигация гг
	?>
	</div>
	<?php
break;
case'5':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Лидеры дуэлей<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where 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); 
	?>
	<p class="foot">Всего игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by arena_pobed DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p class="foot">Победы:<img src="/img/ico/arena_win.png" width="12" height="12"> '.$row_us['arena_pobed'].' </p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=5');} //Навигация гг
	?>
	</div>
	<?php
break;
case'6':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Рейтинг по поиску сокровищ<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where 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); 
	?>
	<p class="foot">Всего игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by tainiki_rat DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p class="foot">Время:<img src="/img/ico/time.png" width="12" height="12"> '.$row_us['tainiki_rat'].' </p></tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=6');} //Навигация гг
	?>
	</div>
	<?php
break;
case'7':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Рейтинг по взлому cундука<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where 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); 
	?>
	<p class="foot">Всего игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by vzlom DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p class="foot">Взломов: <img src="/img/ico/clock.png" width="12" height="12"> '.$row_us['vzlom'].' </p></tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=7');} //Навигация гг
	?>
	</div>
	<?php
break;
case'8':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Рейтинг по выполненным заданиям<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where 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); 
	?>
	<p class="foot">Всего игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by zadaniya DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p class="foot">Задания: <img src="/img/ico/yes.png" width="12" height="12"> '.$row_us['zadaniya'].' </p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=8');} //Навигация гг
	?>
	</div>
	<?php
break;
case'9':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Рейтинг самых опытных кланов<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
     $query_num = "Select clan_id from clans where 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); 
	?>
	<p class="foot">Всего кланов <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM clans where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM clans where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
		  $query_us = "Select * from clans order by clan_opit DESC  limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $nick = $row_us['name'];
	    $id_us = $row_us['clan_id'];
		$gruppa = $row_us['gruppa'];
              $ava = $row_us['ava'];

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {?><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }
	  if ($gruppa == 'dolg') {?><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }
	  if ($gruppa == 'naemniki') {?><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }
	 if ($gruppa == 'renegat') {?><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }
          if ($gruppa == 'chistoenebo') {?><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
  <img src="/img/clan_av/'.$row_us['ava'].'" width="70" height="70" />
    <td width="3000" valign="top">
<p class="foot">Опыт:<img src="/img/ico/star.png" width="12" height="12"> '.$row_us['clan_opit'].' </p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Кланов нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=9');} //Навигация гг
	?>
	</div>
	<?php
break;
case'10':
?><br/>
 <p class="name">Самые престижные кланы<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
   <?php
     $query_num = "Select clan_id from clans where 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); 
	?>
	<p class="foot">Всего кланов <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM clans where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM clans where gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
		  $query_us = "Select * from clans order by slava  DESC  limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $nick = $row_us['name'];
	    $id_us = $row_us['clan_id'];
		$gruppa = $row_us['gruppa'];
              $ava = $row_us['ava'];

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
          if ($gruppa == 'svoboda') {?><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }
	  if ($gruppa == 'dolg') {?><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }
	  if ($gruppa == 'naemniki') {?><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }
	 if ($gruppa == 'renegat') {?><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }
          if ($gruppa == 'chistoenebo') {?><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
  <img src="/img/clan_av/'.$row_us['ava'].'" width="70" height="70" />
    <td width="3000" valign="top">
<p class="foot">Слава:<img src="/img/ico/slava.png" width="12" height="12"> '.$row_us['slava'].' </p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Отрядов нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=10');} //Навигация гг
break;
case'vip':
?><br/>
<div id="main">
<div class="stats">
 <p class="name">Рейтинг VIP игроков<img src="img/ico/patrul.png" width="16" height="16" alt="н"/></span>
       </div>
   <?php
    $query_num = "Select id from users where vip=1 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); 
	?>
	<p class="foot">Всего Vip игроков <?php echo "[ $total ]"; ?></p>
	<?php
   /////////////////////////////////
   ////////////////////////////////
$count=mysqli_num_rows(mysqli_query($dbc,"SELECT COUNT(*) FROM users where vip=1 and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"));
include_once 'nav_class.php';
//Эх подстраничная навигация нелезть:)
$nstr='10'; //Сообщений на страницу
$countQ=$dbc->query("SELECT * FROM users where vip=1 and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'"); #запрос в бд
$count=mysqli_num_rows($countQ); //Подсчёт строк
$pages = new Navigator($count,$nstr); #Вызов класса подстраничной навигации и расчёт страниц
$str = $pages -> start; //Сам хз что))
$i=1;
	  $query_us = "Select * from users where vip=1 and gruppa <> 'mytants' and gruppa <>'bandits' and gruppa <> 'zombie' and gruppa <> 'monolits'  order by opit DESC limit  $str,$nstr";
      $result_us = mysqli_query($dbc, $query_us) or die ('Ошибка передачи запроса к БД');
	  $now = (date("Y-m-d H:i:s"));
      $now = strtotime("$now");
	  while ($row_us = mysqli_fetch_array($result_us)) {
	    $lvl = $row_us['lvl'];
            $nick = $row_us['nick'];
	    $id_us = $row_us['id'];
		$gruppa = $row_us['gruppa'];
		$last_active = $row_us['last_active'];
        $last_active = strtotime("$last_active");
        $razn_last_act = ($now - $last_active);

	    ?>
<div style="background: url(/style/img/2.jpg);">
<?php echo "$i";?>.
<?php
      if ($gruppa == 'svoboda') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/svobodaon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'dolg') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/dolgon.png" width="12" height="12" alt="н"/><?php }}
	  if ($gruppa == 'naemniki') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/naemniki.png" width="12" height="12" alt="н"/><?php }}
	 if ($gruppa == 'renegat') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/renegat.png" width="12" height="12" alt="н"/><?php }}
          if ($gruppa == 'chistoenebo') {if ($razn_last_act < 300 ) {?><img src="img/ico/on.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php } else {?><img src="img/ico/off.png" width="12" height="12" alt="н"/><img src="img/ico/chistoenebo.png" width="12" height="12" alt="н"/><?php }}
   echo'['.$lvl.' ур]
         <a style="text-decoration:none;" href="user.php?id='.$id_us.'">'.$nick.'</a></p><b>
 <span class="white"><table width="370" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td width="170" valign="top"><img src="img/avatars/'.$row_us['avatar'].'" width="50" height="50" border="0"/></tr>
    <td width="3000" valign="top">
<p style="border-top: dashed #444e4f 1px;"></p>
</tr></tr></tbody></table></span></b></div>';
$i++;
	  }
if($count==0){echo'<p style="border-top: dashed #444e4f 1px;"></p>Игроков нет!<p style="border-top: dashed #444e4f 1px;"></p>';}
if($count>10){$pages->print_nav('&tip=vip');} //Навигация гг
	?>
	</div>
	<?php
break;
}
if ((isset($_SESSION['id'])) and (isset($_SESSION['nick'])))  {
  require_once('conf/navig.php');
}
require_once('conf/foot.php');
?>
</body>
</html>