<?php
//Creator Morgan
//colinmorgan@list.ru
////////////////////////////
define ('_IN_JOHNCMS', 1);
require('../incfiles/core.php');
$headmod = 'hafta';
require('../incfiles/head.php');
//MORGAN TOMONIDAN YOZILDI

echo ' <div class="phdr"><b>Hafta faollari TOP 30</b></div>';

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` "),0);
$ab = mysql_query("SELECT * FROM `users` ORDER BY `vaqt` DESC LIMIT 30");
$i = 0;
if($total){
while($aa = mysql_fetch_assoc($ab)){
echo $i % 2 ? '<div  class="menu">' : '<div  class="menu">';
echo '<table cellpadding="0" cellspacing="0"><tr><td>';
if (file_exists('../files/users/photo/' . $aa['id'] . '_small.jpg'))
echo '<a href="' . $home . '/users/profile.php?user=' . $aa['id'] . '"><img src="'.$home.'/files/users/photo/' . $aa['id'] . '_small.jpg" alt="#" style="width: 48px; height: 48px; float: left;"/></a>';
else
echo '<a href="' . $home . '/users/profile.php?user=' . $user['id'] . '"><img src="' . $home . '/images/no_photo.jpg" alt="#" style="width: 48px; height: 48px; float: left;"/></a>';
echo '</td><td>';
if ($aa['sex'])
echo functions::image(($aa['sex'] == 'm' ? 'm_on' : 'w_on') . ($aa['datereg'] > time() - 86400 ? '' : '') . '.gif', array('class' => 'icon-inline'));
echo !$user_id || $user_id == $total['id'] ? '<b>' . $aa['imname'] . '</b>' : '<a href="' . $home . '/users/profile.php?user=' . $aa['id'] .'"><b>' . $aa['imname'] . '</b></a>';
$rank  = array(
0  => '',
1  => '(GMod)',
2  => '(CMod)',
3  => '(FMod)',
4  => '(DMod)',
5  => '(LMod)',
6  => '(Smd)',
7  => '(Adm)',
9  => ' (admin)'
);
$Rights  = isset($aa['rights']) ? $aa['rights'] : 0;
echo  $rank[$Rights];
if (!empty($aa['status'])) {
echo '<div class="status">' . functions::image('label.png', array('class' => 'icon-inline')).(strlen($cstat) == 1 ? '' . $aa['status'] . '' : '<font color="'.$aa['cstat'].'">' . $aa['status'] . '</font>').'</div>';
}
echo '<br/><span class="gray">Faollik darajasi:</span> ' . functions::timecount($aa['vaqt']) . '';
 echo '</td></tr></table></div>';
}
}
$hafta= mysql_fetch_assoc(mysql_query("SELECT * FROM `users` "),0);
echo '<div class="bmenu">So`ngi yangilanish: ('. date("d.m.Y /H:i",$hafta['time']) .')</div>';
if ($rights >= 9) {
echo '<div class="gmenu"><a href="/hafta/yangilash.php">Yangilash (haftada 1marta)</div>';
}
require('../incfiles/end.php');
?>