<?





$set['p_str']=1;
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `leaders`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0)
{echo "<div class='block'>Лидеров дня нет [<a href='?glav&kup'>&raquo;&raquo;</a>]</div>";}
$q=mysql_query("SELECT * FROM `leaders` ORDER BY rand() LIMIT $start, $set[p_str]");
while ($a = mysql_fetch_array($q)){
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $a[user] LIMIT 1"));
mysql_query("DELETE FROM `leaders` WHERE `time` < '".(time()-86400*$a['zkl'])."'"); // удаление старых

$ka=rand(1,7);
$k=$ka;
if($k == 1)echo '<div class="block"><b><font color="#44EE22">Л</font><font color="#BB2277">и</font><font color="#BB3355">д</font><font color="#EE88CC">е</font><font color="#EE9944">р</font> <font color="#557799">д</font><font color="#006600">н</font><font color="#5544CC">я</font>:</b><br/>';
if($k == 2)echo '<div class="block"><b><font color="#88EE11">Л</font><font color="#2266CC">и</font><font color="#DDCCCC">д</font><font color="#EE2233">е</font><font color="#9933DD">р</font> <font color="#7788EE">д</font><font color="#116611">н</font><font color="#5533FF">я</font>:</b><br/>';
if($k == 3)echo '<div class="block"><b><font color="#EEFF44">Л</font><font color="#667733">и</font><font color="#CCEE66">д</font><font color="#DD66DD">е</font><font color="#4400FF">р</font> <font color="#554455">д</font><font color="#6655BB">н</font><font color="#CC2211">я</font>:</b><br/>';
if($k == 4)echo '<div class="block"><b><font color="#CCCC88">Л</font><font color="#337755">и</font><font color="#9944DD">д</font><font color="#6688DD">е</font><font color="#11BBDD">р</font> <font color="#5599BB">д</font><font color="#556655">н</font><font color="#77AACC">я</font>:</b><br/>';
if($k == 5)echo '<div class="block"><b><font color="#BB1166">Л</font><font color="#FF88AA">и</font><font color="#EE44FF">д</font><font color="#115588">е</font><font color="#7755DD">р</font> <font color="#AA3388">д</font><font color="#88CC33">н</font><font color="#FF3366">я</font>:</b><br/>';
if($k == 6)echo '<div class="block"><b><font color="#33FF77">Л</font><font color="#AA55DD">и</font><font color="#EE9911">д</font><font color="#229911">е</font><font color="#88DDFF">р</font> <font color="#880088">д</font><font color="#FF9977">н</font><font color="#DD6666">я</font>:</b><br/>';
if($k == 7)echo '<div class="block"><b><font color="#11AABB">Л</font><font color="#774411">и</font><font color="#2244CC">д</font><font color="#227733">е</font><font color="#BBEE00">р</font> <font color="#AA1144">д</font><font color="#AA3300">н</font><font color="#FF44DD">я</font>:</b><br/>';




if (file_exists('img/avatars/'.$a['user'].'.png'))
{echo "<img src='img/avatars/$a[user].png' align='left' width='30' height='30' alt='' style='vertical-align: middle;' > ";}
else{echo "<img src='img/noava.gif' align='left' width='30' height='30' alt='' style='vertical-align: middle;'> ";}
echo ' <a class="" href=?user='.$a['user'].'>'.nc($a['user']).'</a>';
echo " ".med($a['user'])."";
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `id` = '$a[user]' AND `date_last` > '".(time()-600)."' LIMIT 1"),0)==1)
echo " <img src='img/icons/online.gif' alt='' class='*'/> ";








$ban = mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_ban` WHERE `id_user` = '$a[user]' AND (`time` > '$time' OR `izg` = '1') ORDER BY `id` DESC LIMIT 1"));
$us_ban = mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_user` WHERE `id` = '$ban[id_who]'"));

if($ban['id']){
echo "<br/><br/>";
echo "".($ban['izg']==1?'<font color="tomato">Сообщение заблокировано</font>':"<font color='tomato'>Сообщение заблокировано до:</font> <b>".vremja($ban['time']))."</b>";
}
else

if($a['user']){
if (htmlspecialchars($a['text'])!=NULL){



if ($a['color'])echo "<br/><br/><span style='color:".$a['color']."'>".output_text($a['text'])."</span>";
else
if ($a['color']==null)echo "<br/><br/><span style='color:".$a['color']."'>".output_text($a['text'], $a['id'])."</span>";

}
else
echo "<br/><br/>Без комментариев..";
}
}
echo "</div>";


?>