View file pages/online.php

File size: 4.85Kb
<?php
#-----------------------------------------------------#
#          ********* ROTORCMS *********               #
#              Made by  :  VANTUZ                     #
#               E-mail  :  [email protected]         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#        для его дальнейшего распространения          #
#-----------------------------------------------------#	
require_once "../includes/start.php";
require_once "../includes/functions.php";
require_once "../includes/header.php";
include_once "../themes/" . $config['themes'] . "/index.php";

if (isset($_GET['act'])) {
    $act = check($_GET['act']);
} else {
    $act = 'index';
} 
if (isset($_GET['start'])) {
    $start = (int)$_GET['start'];
} else {
    $start = 0;
} 

echo'<img src="../images/img/group.png" alt="image" /> <b>Кто в онлайне</b><br /><br />';

$total_all = DB :: $dbh -> querySingle("SELECT count(*) FROM `online`;");
$total = DB :: $dbh -> querySingle("SELECT count(*) FROM `online` WHERE `online_user`<>?;", array(''));

echo 'Всего на сайте: <b>' . $total_all . '</b><br />';
echo 'Зарегистрированных:  <b>' . $total . '</b><br /><br />';

switch ($act):
# ###########################################################################################
# #                                    Главная страница                                    ##
# ###########################################################################################
case 'index':

    if ($total > 0) {
        if ($start >= $total) {
            $start = 0;
        } 

        $queryonline = DB :: $dbh -> query("SELECT * FROM `online` WHERE `online_user`<>? ORDER BY `online_time` DESC LIMIT " . $start . ", " . $config['onlinelist'] . ";", array(''));

        while ($data = $queryonline -> fetch()) {
            echo '<div class="b">';
            echo '<img src="../images/img/user.gif" alt="image" /> <b><a href="../pages/anketa.php?uz=' . $data['online_user'] . '&amp;' . SID . '">' . nickname($data['online_user']) . '</a></b> (Время: ' . date_fixed($data['online_time'], 'H:i:s') . ')</div>';
            echo '<div><span class="data">(' . $data['online_brow'] . ', ' . $data['online_ip'] . ')</span></div>';
        } 

        page_strnavigation('online.php?', $config['onlinelist'], $start, $total);
    } else {
        show_error('Авторизованных пользователей нет!');
    } 

    echo '<img src="../images/img/users.gif" alt="image" /> <a href="online.php?act=all&amp;' . SID . '">Показать гостей</a><br />';
    break;
# ###########################################################################################
# #                                Список всех пользователей                               ##
# ###########################################################################################
case 'all':

    $total = $total_all;

    if ($total > 0) {
        if ($start >= $total) {
            $start = 0;
        } 

        $queryonline = DB :: $dbh -> query("SELECT * FROM `online` ORDER BY `online_time` DESC LIMIT " . $start . ", " . $config['onlinelist'] . ";");

        while ($data = $queryonline -> fetch()) {
            if (empty($data['online_user'])) {
                echo '<div class="b">';
                echo '<img src="../images/img/user.gif" alt="image" /> <b>' . $config['guestsuser'] . '</b>  (Время: ' . date_fixed($data['online_time'], 'H:i:s') . ')</div>';
                echo '<div><span class="data">(' . $data['online_brow'] . ', ' . $data['online_ip'] . ')</span></div>';
            } else {
                echo '<div class="b">';
                echo '<img src="../images/img/user.gif" alt="image" /> <b><a href="../pages/anketa.php?uz=' . $data['online_user'] . '&amp;' . SID . '">' . nickname($data['online_user']) . '</a></b> (Время: ' . date_fixed($data['online_time'], 'H:i:s') . ')</div>';
                echo '<div><span class="data">(' . $data['online_brow'] . ', ' . $data['online_ip'] . ')</span></div>';
            } 
        } 

        page_strnavigation('online.php?act=all&amp;', $config['onlinelist'], $start, $total);
    } else {
        show_error('На сайте никого нет!');
    } 

    echo '<img src="../images/img/users.gif" alt="image" /> <a href="online.php?' . SID . '">Cкрыть гостей</a><br />';
    break;

default:
    header('location: online.php?' . SID);
    exit;
    endswitch;

    echo '<img src="../images/img/homepage.gif" alt="image" /> <a href="../index.php?' . SID . '">На главную</a><br />';

    include_once "../themes/" . $config['themes'] . "/foot.php";

    ?>