<?PHP
include('header.php'); 
echo "<span class='top-bl-s-verh'>Топ 20</span>
<div class='menucenter-top1'>
<table class='profile' width='100%' border='0' cellpadding='0' cellspacing='0' style='margin-bottom: 0;'>
<tr><td class='value1'>
Это страница лучших пользователей проекта, каждый из них сильно старается что бы попасть сюда!
</td></tr>
</table>
";
?>


<?PHP
$sql = mysql_query("SELECT * FROM `b_users` WHERE `user_status`!='admin' AND `user_status`!='moder' AND `user_status`!='users' order by `reyting` desc limit 20") or die(mysql_error());
if(mysql_num_rows($sql) > 0){
while($row=mysql_fetch_assoc($sql)){
$iid=$row["id"];

echo "<table class='referals2' width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr><td width='50px' valign='top' align='center'><img style='border: solid 1px #ddd;padding:1px;' src='/avp/".$row["avatar"]."' border='0' width='50' height='50' alt='avatar' /></td>";

echo "<td>
<a class='usrname' style='border-bottom: none' href='/users-".$row["id"]."-wall.html' target='_blank' title='Перейти на стену'><b>".$row["username"]."</b></a>
<br>
<span class='desctext'>Рейтинг: <span style='color: #34A305'>
".$row["reyting"]."
<br><span class='desctext'>ID: ".$row["id"]."</span>
";
echo "</td>";		
echo "<td class='visit1' nowrap='nowrap'>";
if($row["autoproc"] > 0) {$visible = "";}else{$visible = "style='display:none;'";}
echo "</td>";
echo "<td>";
$zz = mysql_query("SELECT `price` FROM `b_jarmarka` WHERE `rid`='".$row["id"]."'") or die(mysql_error());
$col_jar = mysql_num_rows($zz);
if($col_jar > 0) {	
$zzz=mysql_fetch_assoc($zz);
$price_jar = $zzz["price"];
$vis_j = "";
}else{$price_jar = NULL;$vis_j = "style='display:none;'";}
echo "<span id='sale_jar_".$row["id"]."' class='sref-jarmarka' title='Продаётся за $price_jar $sitevalname' $vis_j></span>";
$nowdate = '';
$nowdate1 = date("d.m.Y");
$gg = $row["lastlogdate"];
if($nowdate1==$gg) { $nowdate="<span style='color: #009126'>Сегодня</span><br />";
}elseif($gg == ''){
$nowdate = "<span style='color: #F78383'>Еще не заходил</span><br />";
}else{ $nowdate = "$gg<br />";
}
$ggj = $row["joindate"];
$nowdate .= "<span class='desctext'>$ggj</span>";
$mon=($row["money"]+$row["paid"]);
$short_link = substr($mon, 0, 5);
echo "</td>";		
echo "<td class='visit' width='60px' nowrap='nowrap'>".$nowdate."</td>";
echo "<td align='center' width='45px' class='visit1' nowrap='nowrap'><span style='color: #b8452a'>".count_referals($row["id"])." шт.</span></td>";
echo "<td class='visit' width='50px' nowrap='nowrap'><span style='color: #009126'>$short_link</span></td>";
echo "<td width='70px' nowrap='nowrap'><center>";
echo "<span id='sref-bonus_".$row["id"]."' class='sref-bonus' title='Установлен бонус: ".$row["autoproc"]."%' $visible></span>";
echo "</center></td></tr></table>";

if(isset($_GET["stat"]) && $_GET["stat"]==$row["id"]){
 require('statistika/stat_diogram.php');
 initstat($row["username"],1); 
 } ?>
<?
}
}
?>

</div>
<?PHP include('footer.php');?>