<?
echo "<div class='event'><h1>Фермеры</h1></div>";
echo "<div class='content'>";
echo "<div class='block'>";
if(isset($_GET['teh']))
{
$sort='tehnika';
$sort2='&teh';
}
elseif(isset($_GET['dost']))
{
$sort='dostig';
$sort2='&dost';
}
elseif(isset($_GET['rub']))
{
$sort='rubies';
$sort2='&rub';
}
elseif(isset($_GET['money']))
{
$sort='money';
$sort2='&money';
}
elseif(isset($_GET['kulinar']))
{
$sort='cook_mas';
$sort2='&kulinar';
}
elseif(isset($_GET['sadovod']))
{
$sort='sadovod';
$sort2='&sadovod';
}
elseif(isset($_GET['level']))
{
$sort='level';
$sort2='&level';
}
elseif(isset($_GET['al']))
{
$sort='kristal';
$sort2='&al';
}
else
{
$sort='rating';
$sort2=NULL;
}
$k_post = mysql_result(mysql_query("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_query("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 "<li><span class='minor'><span>$num.</span></span> <span>";
echo "".on_k($post['id'])."";
echo " <a class='' href='?user=$post[id]'>".nc($post['id'])."</a> ";
if($post['coll']==0)
{
echo "<img alt='o' width='16' height='16' src='images/nocollective.png'>";
}
echo "<span class='title'>$post[$sort]</span></span></li>";
}
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='images/icons/rating.png' alt='o'> <a href='?rating'>Опыту</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?rating&level'>Уровню</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?rating&dost'>Достижениям</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?rating&teh'>Механизации</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?rating&rub'>Рубинам</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?rating&al'>Кристалам</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?rating&money'>Монетам</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?rating&kulinar'>Кулинарному мастерству</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?rating&sadovod'>Cадоводческому мастерству</a></li>";
echo "</ul>";
echo "</div>";
include_once 'inc/foot.php';
?>