<?
echo "<div class='event'><h1>Фермеры</h1></div>";
echo "<div class='content'>";
echo "<div class='block'>";
if(isset($_GET['status']) && ($ank['status']>0))
{
$sort='status';
$sort2='&status';
}
elseif(isset($_GET['onl']))
{
$sort='time';
$sort2='&onl';
}
elseif(isset($_GET['avto']))
{
$sort='pop';
$sort2='&avto';
}
elseif(isset($_GET['teh']))
{
$sort='tehnika';
$sort2='&teh';
}
elseif(isset($_GET['dost']))
{
$sort='dostig';
$sort2='&dost';
}
else
{
$sort='level';
$sort2=NULL;
}
$k_post = mysql_result(mysql_querll('SELECT COUNT(*) FROM `kolhoz_user`'),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$num=($page-1)*$set['p_str'];

$q=mysql_querll('SELECT * FROM `kolhoz_user` ORDER BY '.$sort.' DESC, `rating` DESC LIMIT '.$start.', '.$set['p_str'].'');
echo "<ul>";
while($post=mysql_fetch_array($q))
{
$num++;
echo '<div class="block"><span class="minor"><span>'.$num.'.</span></span>';
echo "".on_k($post['id'])."";
echo " <a class='' href='?user=$post[id]'>".nc($post['id'])."</a>";
echo " ".med($post['id'])."";
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `id` = '$post[id]' AND `date_last` > '".(time()-600)."' LIMIT 1"),0)==1)
echo " <img src='img/icons/online.gif' alt='' class='*'/> ";
echo "<span class='title'>".rating($post[$sort])."</span></div>";

}
echo "</ul>";
if ($k_page>1)str("?rating$sort2&",$k_page,$page); // Вывод страниц
echo "<h3>Рейтинг по:</h3>";
echo "<ul>";
echo "<li><img width='16' height='16' src='img/icons/rating.png' alt='o'> <a href='?rating'>Опыту</a></li>";
echo "<li><img width='16' height='16' src='img/icons/rating.png' alt='o'> <a href='?rating&dost'>Достижениям</a></li>";
echo "<li><img width='16' height='16' src='img/icons/rating.png' alt='o'> <a href='?rating&teh'>Механизации</a></li>";
echo "<li><img width='16' height='16' src='img/icons/rating.png' alt='o'> <a href='?rating&onl'>Онлайну</a></li>";
echo "<li><img width='16' height='16' src='img/icons/rating.png' alt='o'> <a href='?rating&avto'>Авторитету</a></li>";

echo "</ul>";
echo "</div>";
include_once 'inc/foot.php';
?>