File size: 1.44Kb
<?php
// by Mike O. (mides), coolcms.org
$title = 'Кто, где';
require_once '../includes/sys.php';
require_once '../includes/header.php';
if (!empty($_GET['all'])) {
$all = 1;
$all_q = '';
} else {
$all = 0;
$all_q = 'WHERE `id_user` > 0';
}
tp('Кто, где');
$total = mysql_result(mysql_query("SELECT COUNT(`id_user`) FROM `online` $all_q"), 0);
if ($total > 0) {
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$online_r = mysql_query("SELECT * FROM `online` $all_q ORDER BY `time` DESC LIMIT $begin, $config[onpage]") or die(mysql_error());
while($online = mysql_fetch_assoc($online_r)){
if (empty($online['place'])) $online['place'] = $lang['home_header'];
echo '<div class="row">';
if ($online['id_user'] > 0) {
echo '<a href="profile.php?id='.$online['id_user'].'">'.username($online['id_user'], 2).'';
} else {
echo '<img src="../images/icons/g.png"> '.$lang['guest'];
}
echo ' ['.$online['place'].']';
if (access(2)) {
echo ' '.$online['ip'];
}
echo '</a></div>';
}
}
$echo = !empty($all) ? '» <a href="?">Скрыть гостей</a>' : '» <a href="?all=1&p='.$page.'">Показать гостей</a>';
echo '<div class="body">'.$echo.'</div>';
navig($page, '?all='.$all.'&', $pages);
require_once '../includes/tail.php';
?>