<?php
 include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
$set['title']='Рыбалка онлайн';
include_once '../sys/inc/thead.php';
title();
aut();

if(!isset($user)){
  header("Location:/index.php");
  exit;
}





include_once 'inc/start.php';

$posts=array();
if(!isset($_GET['r']) || !is_numeric($_GET['r']) || $_GET['r']>5 || $_GET['r']<=0){
$posts[]=array('title'=>'Сортировать по<br/>', 'post'=>"Весу|<a href='rate.php?r=1'>Уровню</a>|<a href='rate.php?r=2'>Опыту</a>|<a href='rate.php?r=3'>Деньгам</a>|<a href='rate.php?r=4'>Рубинам</a>|<a href='rate.php?r=5'>Победам</a>");
$count=mysql_query("SELECT * FROM `fish_u` WHERE `max_ves`>'0' ORDER BY `max_ves` DESC LIMIT 10");
if(mysql_num_rows($count)==0)
$posts[]=array('title'=>'Участников нет');
else
{
while($arr=mysql_fetch_array($count)){
$ank=new_user($arr['id_u']);
$posts[]=array('title'=>'<a href="/info.php?id='.$ank['id'].'">'.$ank['nick'].'</a><br/>',
'post'=>$arr["max_kogo"].' - '.$arr["max_ves"].' кг');
}
}
}
elseif($_GET['r']==1){
$posts[]=array('title'=>'Сортировать по<br/>', 'post'=>"<a href='rate.php?'>Весу</a>|Уровню|<a href='rate.php?r=2'>Опыту</a>|<a href='rate.php?r=3'>Деньгам</a>|<a href='rate.php?r=4'>Рубинам</a>|<a href='rate.php?r=5'>Победам</a>");
$count=mysql_query("SELECT * FROM `fish_u` WHERE `level`>'0' ORDER BY `level` DESC LIMIT 10");
if(mysql_num_rows($count)==0)
$posts[]=array('title'=>'Подходящих участников нет');
else
{
while($arr=mysql_fetch_array($count)){
$ank=new_user($arr['id_u']);
$posts[]=array('title'=>'<a href="/info.php?id='.$ank['id'].'">'.$ank['nick'].'</a><br/>',
'post'=>'  Уровень: '.$arr["level"].'');
}
}

}
elseif($_GET['r']==2){
$posts[]=array('title'=>'Сортировать по<br/>', 'post'=>"<a href='rate.php?'>Весу</a>|<a href='rate.php?r=1'>Уровню</a>|Опыту|<a href='rate.php?r=3'>Деньгам</a>|<a href='rate.php?r=4'>Рубинам</a>|<a href='rate.php?r=5'>Победам</a>");
$count=mysql_query("SELECT * FROM `fish_u` WHERE `exp`>'0' ORDER BY `exp` DESC LIMIT 10");
if(mysql_num_rows($count)==0)
$posts[]=array('title'=>'Подходящих участников нет');
else
{
while($arr=mysql_fetch_array($count)){
$ank=new_user($arr['id_u']);
$posts[]=array('title'=>'<a href="/info.php?id='.$ank['id'].'">'.$ank['nick'].'</a><br/>',
'post'=>' Опыт: '.$arr["exp"].'');
}
}

}
elseif($_GET['r']==3){
$posts[]=array('title'=>'Сортировать по<br/>', 'post'=>"<a href='rate.php?'>Весу</a>|<a href='rate.php?r=1'>Уровню</a>|<a href='rate.php?r=2'>Опыту</a>|Деньгам|<a href='rate.php?r=4'>Рубинам</a>|<a href='rate.php?r=5'>Победам</a>");
$count=mysql_query("SELECT * FROM `fish_u` WHERE `balls`>'0' ORDER BY `balls` DESC LIMIT 10");
if(mysql_num_rows($count)==0)
$posts[]=array('title'=>'Подходящих участников нет');
else
{
while($arr=mysql_fetch_array($count)){
$ank=new_user($arr['id_u']);
$posts[]=array(
'title'=>'<a href="/info.php?id='.$ank['id'].'">'.$ank['nick'].'</a><br/>',
'post'=>'<img src="d.png" /> '.$arr["balls"]);
}
}

}
elseif($_GET['r']==4){
$posts[]=array('title'=>'Сортировать по<br/>', 'post'=>"<a href='rate.php?'>Весу</a>|<a href='rate.php?r=1'>Уровню</a>|<a href='rate.php?r=2'>Опыту</a>|<a href='rate.php?r=3'>Деньгам</a>|Рубинам|<a href='rate.php?r=5'>Победам</a>");
$count=mysql_query("SELECT * FROM `fish_u` WHERE `rub`>'0' ORDER BY `rub` DESC LIMIT 10");
if(mysql_num_rows($count)==0)
$posts[]=array('title'=>'Подходящих участников нет');
else
{
while($arr=mysql_fetch_array($count)){
$ank=new_user($arr['id_u']);
$posts[]=array(
'title'=>'<a href="/info.php?id='.$ank['id'].'">'.$ank['nick'].'</a><br/>',
'post'=>'<img src="rubi.png" /> '.$arr["rub"]);
}
}

}
elseif($_GET['r']==5){
$posts[]=array('title'=>'Сортировать по<br/>', 'post'=>"<a href='rate.php?'>Весу</a>|<a href='rate.php?r=1'>Уровню</a>|<a href='rate.php?r=2'>Опыту</a>|<a href='rate.php?r=3'>Деньгам</a>|<a href='rate.php?r=4'>Рубинам</a>|Победам");
$count=mysql_query("SELECT * FROM `fish_u` WHERE `win`>'0' ORDER BY `win` DESC LIMIT 10");
if(mysql_num_rows($count)==0)
$posts[]=array('title'=>'Подходящих участников нет');
else
{
while($arr=mysql_fetch_array($count)){
$ank=new_user($arr['id_u']);
$posts[]=array(
'title'=>'<a href="/info.php?id='.$ank['id'].'">'.$ank['nick'].'</a><br/>',
'post'=>'<img src="cup.png" /> '.$arr["win"]);
}
}

}


$count=count($posts);
for($i=0;$i<$count;$i++){
if($i%2)
echo "<div class='p_m'><table><tr>".implode($posts[$i])."</tr></table></div>";
else
echo "<div class='p_t'><table><tr>".implode($posts[$i])."</tr></table></div>";
}
ret('В игру','index.php');
include_once '../sys/inc/tfoot.php';
?>
