<?
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['al']))
{
$sort='chatpost';
$sort2='&al';
}
elseif(isset($_GET['teh']))
{
$sort='forumpost';
$sort2='&teh';
}
elseif(isset($_GET['dost']))
{
$sort='mailpost';
$sort2='&dost';
}
else
{
$sort='sovetpost';
$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='block event'>";
if($post['id']==$post[id])
if($mcu['status']<=3)echo "";
if (file_exists('images/avatars/'.$post['id'].'.png'))
{
echo "<img src='images/avatars/$post[id].png' align='left' width='30' height='30' alt='' style='vertical-align: middle;' >";
}
else
{
echo "<img src='images/nofoto.png' align='left' width='30' height='30' alt='' style='vertical-align: middle;'>";
}
echo "<font color='snow'><b>$num.</b></font> ";
echo "".on_k($post['id'])."";
echo " <a class='' href='?user=$post[id]'><span>".nc($post['id'])."</span></a> ";
if ($post['level']>=10 && $post['level']<=15){echo " <img src='/images/medal/1.gif' alt='!'/> ";}
if ($post['level']>=16 && $post['level']<=20){echo " <img src='/images/medal/2.gif' alt='!'/> ";}
if ($post['level']>=21 && $post['level']<=26){echo " <img src='/images/medal/3.gif' alt='!'/> ";}
if ($post['level']>=27 && $post['level']<=30){echo " <img src='/images/medal/4.png' alt='!'/> ";}
if ($post['level']>=31 && $post['level']<=35){echo " <img src='/images/medal/5.png' alt='!'/> ";}
if ($post['level']>=36 && $post['level']<=40){echo " <img src='/images/medal/6.png' alt='!'/> ";}
if ($post['level']>=41 && $post['level']<=45){echo " <img src='/images/medal/7.png' alt='!'/> ";}
if ($post['level']>=46 && $post['level']<=50){echo " <img src='/images/medal/8.png' alt='!'/> ";}
if ($post['level']>=51 && $post['level']<=75){echo " <img src='/images/medal/9.png' alt='!'/> ";}


if (mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `id` = '$post[id]' AND `date_last` > '".(time()-700)."' LIMIT 1"),0)==1)
echo " <img src='/images/onlines.gif' alt='' class='*'/> ";
if(isset($_GET['pol']))
{
mysql_query("UPDATE `kolhoz_user` SET `pol` = '".($post['pol']==1?"0":"1")."' WHERE `id` = '$post[id]'");
}
echo " (<font color='violet'><span>".($post['pol']==0?"<b>Ж</b>":"<b>М</b>")."</span></font>/<font color='orangered'><b>".rating($post[$sort])."</font></b>) <a href='?mail&new_msg=$post[id]'><img width='16' height='16' src='images/icons/pencil.png' alt='o'></a></br>";
echo "(<font color='orange'><span>".($post['strana']==NULL?'':hsc($post['strana']))."</span>,<span>".($post['city']==NULL?'<font color="#4F4F4F">Город не указан</font>':hsc($post['city']))."</span></font>)";
echo "</div></span></li>";
//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> <span class='title'><span class='title'>".rating($post[$sort])."</span></li>";
}
echo "</ul>";
if ($k_page>1)str("?toper$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='?toper'>Сельсовету</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?toper&dost'>Личной почте</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?toper&teh'>Форуму</a></li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> <a href='?toper&al'>чату</a></li>";
echo "</ul>";
echo "</div>";
include_once 'inc/foot.php';
?>