View file all_online.php

File size: 1.41Kb
<?php
if (!strpos($_SERVER['SCRIPT_NAME'],'index.php'))
    {
     header('location: http://wapmoto.ru/chat/?not_found');
     exit();
    }
$__who__online = mysql_query('SELECT `login`, `online` FROM `chat_session` WHERE `timeout` > '.(time()-600));
$cls->a_header('Список онлайн.');
$cls->write('<div class="d1">Кто в чате?</div>');
if (mysql_num_rows($__who__online) == '0') {$cls->write('<div class="d0">Сейчас в чате никого нет.</div>');}
    else
        {
         $cls->write('<div class="d0">');
         while ($__list__online = mysql_fetch_object($__who__online))
                {
                 $__room__users = mysql_fetch_object(mysql_query('SELECT `val1` FROM `chat_settings` WHERE `id` = "'.$__list__online->online.'"'));
                 if (empty($__room__users->val1)) {$__where__is__user = 'Прихожая';}
                     else {$__where__is__user = $__room__users->val1;}
                 ++$__last__count;
                 if (mysql_num_rows($__who__online) != $__last__count)
                     {
                      $cls->write($__list__online->login.'('.$__where__is__user.'),');
                     }
                 else
                     {
                      $cls->write($__list__online->login.'('.$__where__is__user.').');
                     }
                }
         $cls->write('</div>');
        }

    $cls->a_footer();
?>