<?
echo "<div class='input_button'><center>Фермеры</center></div>";
echo "<div class='content'>";
echo "<div class='block'>";
echo '<div class="content"><table style="width:100%;"><tr></a></td>';
echo '<td class="img_obj"  style="background:url(style/pesok2.gif);padding:4px;text-align:center;;"><a href="?rating" style="display:block" title="По опыту" ><img width="18" height="18" src="img/star.png" alt=""/></a></td>';
echo '<td class="img_obj"  style="background:url(style/pesok2.gif);padding:4px;text-align:center;;"><a href="?rating&dost" style="display:block" title="Достижениям"><img width="18" height="18" src="img/nov.png" alt=""/></a></td>';
echo '<td class="img_obj"  style="background:url(style/pesok2.gif);padding:4px;text-align:center;;"><a href="?rating&teh" style="display:block" title="Механизации"><img width="18" height="18" src="img/sett.png" alt=""/></a></td>';
echo '<td class="img_obj"  style="background:url(style/pesok2.gif);padding:4px;text-align:center;;"><a href="?rating&al" style="display:block" title="Турнир"><img width="18" height="18" src="images/icons/rating.png" alt=""/></a></td>';
echo '</tr></table></div>';

if(isset($_GET['teh']))
{
$sort='tehnika';
$sort2='&teh';
}
elseif(isset($_GET['dost']))
{
$sort='dostig';
$sort2='&dost';
}
elseif(isset($_GET['al']))
{
$sort='almaz';
$sort2='&al';
}
else
{
$sort='level';
$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 '<div class="div_hr2"></div>';
echo "<div style='padding:7px'><span class='#00FFFF'><span>$num.</span></span>";
echo "".on_k($post['id'])."";
echo " <a class='' href='?user=$post[id]'>".nc($post['id'])."</a>   <span class='title'><span class='title'>".rating($post[$sort])."</span></li>";
echo "</div>";
}
echo "</div>";
echo '<div class="div_hr2"></div>';
if ($k_page>1)str("?rating$sort2&",$k_page,$page); // Вывод страниц
echo '<div style="padding:2px"></div><div class="div_hr2"></div><div style="padding:2px"></div><div class="content"><table style="width:100%;"><tr></a></td>';
echo '<td class="img_obj"  style="background:url(style/pesok2.gif);padding:4px;text-align:center;;"><a href="?collectives" style="display:block" title="Рейтинг племён" >Рейтинг сообществ</a></td>';
echo '</tr></table></ul></div></div></div></div></div></div></div></div></div></div></div></div></div></div>';
include_once 'inc/foot.php';
?>