File size: 1.38Kb
<?php
// by Mike O. (mides), coolcms.mobi
$title = 'Кто, где';
require_once 'system/sys.php';
require_once 'system/header.php';
if (isset($_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'];
if ($online['id_user'] > 0) {
echo '<a href="profile.php?id='.$online['id_user'].'">'.login($online['id_user']).'</a>';
} else {
echo $lang['guest'];
}
echo ' ['.$online['place'].']';
if (access(2)) {
echo ' '.$online['ip'];
}
echo '<br />';
}
navig($page, '?all='.$all.'&', $pages);
}
if (!empty($all)) {
nav2('?', 'Скрыть гостей');
} else {
nav2('?all=1&p='.$page, 'Показать гостей');
}
require_once ('system/tail.php');
?>