<?
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();

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `raitings` WHERE `udacha_sum` > '0'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>\n";
if ($k_post==0)
{
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "Извините, но результаты отсутствуют...\n";
echo "  </td>\n";
echo "   </tr>\n";
}
$q=mysql_query("SELECT `id` FROM `raitings` WHERE `udacha_sum` > '0' ORDER BY `udacha_sum` DESC LIMIT $start, $set[p_str]");
while ($ank = mysql_fetch_assoc($q))
{
$ank=get_user($ank['id']);
echo "   <tr>\n";

if ($set['set_show_icon']==2){
echo "  <td class='icon48' rowspan='2'>\n";
avatar($ank['id']);
echo "  </td>\n";
}
elseif ($set['set_show_icon']==1)
{
echo "  <td class='icon14'>\n";
echo "<img src='/style/themes/$set[set_them]/user/$ank[pol].png' alt='' />";
echo "  </td>\n";
}
echo "  <td class='p_t'>\n";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a>".online($ank['id'])."\n";
echo '<br/>';
$u_raitings=mysql_fetch_array(mysql_query("SELECT * FROM `raitings` WHERE `id`='$ank[id]'"));
echo "<b>Сумма пойманных удач</b>: $u_raitings[udacha_sum] баллов<br />\n";



echo "  </td>\n";
echo "   </tr>\n";
echo "   <tr>\n";
if ($set['set_show_icon']==1)echo "  <td class='p_m' colspan='2'>\n"; else echo "  <td class='p_m'>\n";

{
if($user['level']>4){
echo "<div class='str'>\n";
echo "<a href='/adm_panel/user.php?id=$ank[id]'>Редактировать профиль</a><br />\n";
echo "</div>\n";
};
}

echo "  </td>\n";
echo "   </tr>\n";
}
echo "</table>\n";
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц

echo "<div class='menu_foot'>";
echo "<img src='/style/icons/krugovaya_strelka.png'> <a href='/raitings/'>Вернуться назад</a><br />\n";
echo "</div>\n";
include_once '../sys/inc/tfoot.php';
?>