Просмотр файла chat_online.php

Размер файла: 3.26Kb
<?php
if (!strpos($_SERVER['SCRIPT_NAME'],substr(session_id(),(strlen(session_id())/2),strlen(session_id())).session_id().substr(session_id(),0,(strlen(session_id())/2)).'/index.php'))
    {
     header('location: http://'.$_SERVER['SERVER_NAME'].'/'); exit();
    }
$count = mysql_fetch_array(mysql_query('SELECT count(*) FROM `chat_session` WHERE `timeout` > "'.intval(time()-600).'"'));
$q = mysql_query('SELECT `id`,`var`,`val1` FROM `'.$px.$stable.'` WHERE `mod` = "room" ORDER BY `val3`');

$cls->a_header('Онлайн');
$cls->write('<div class="d1"><h5 align="center">'.$lang['who_online'].' ['.$count['count(*)'].']</h5></div>');
while ($droom = mysql_fetch_object($q))
       {
		$q_online = mysql_query('SELECT `login`,`timeout` FROM `chat_session` WHERE `timeout` > "'.intval(time()-600).'" AND `online` = "'.$droom->id.'" ORDER BY `timeout` DESC');

        if ($droom->id != '6')
            {
             $cls->write('<div class="d1"><a href="?'.$_SESSION['re'].'/'.$_SESSION['re2'].'/'.$droom->id.'&amp;'.SID.'">'.$droom->val1.'</a></div><div class="d0">');
             $nu = mysql_num_rows($q_online);
             if ($nu == '0') {$cls->write('Никого нет.');}
                 else
                     {
                      $n = 0;
                      while ($donline = mysql_fetch_object($q_online))
                             {
                              $n = $n+1;
                              #$cnt = mysql_num_rows($q_online);
                              $cls->write($donline->login); if ($n != $nu) {echo ', ';}
                              else {echo '.';}
                             }
                     }
             $cls->write('</div>');
            }
       }

$q_online = mysql_query('SELECT `login` FROM `chat_session` WHERE `timeout` > "'.intval(time()-600).'" AND `online` = "6" ORDER BY `timeout` DESC');
$cls->write('<div class="d1"><a href="?'.$_SESSION['re'].'/'.$_SESSION['re2'].'/6&amp;'.SID.'">Подвал</a></div><div class="d0">');
$nu = mysql_num_rows($q_online);
if ($nu == '0') {$cls->write('Никого нет.');}
    else
        {
         $n = 0;
         while ($donline = mysql_fetch_object($q_online))
                {
                 $n = $n+1;
                 $cls->write($donline->login); if ($n != $nu) {echo ', ';}
                 else {echo '.';}
                }
        }

$q_online = mysql_query('SELECT `login` FROM `chat_session` WHERE `timeout` > "'.intval(time()-600).'" AND `online` = "" ORDER BY `timeout` DESC');
$cls->write('</div>');
$cls->write('<div class="d1"><a href="?'.SID.'">'.$lang['holl'].'</a></div>');
$cls->write('<div class="d0">');
$nu = mysql_num_rows($q_online);
if ($nu == '0') {$cls->write('Никого нет.');}
    else
        {
         $n = 0;
         while ($donline = mysql_fetch_object($q_online))
                {
                 $n = $n+1;
                 $cls->write($donline->login); if ($n != $nu) {echo ', ';}
                 else {echo '.';}
                }
        }
$cls->write('</div>');
$pagesize = round((ob_get_length()+500)/1024,1);
require_once(rootpath.'trafic.php');
$end = gettime();
$cls->write('<div class="foot">['.round(($end - $mystart), 5).']</div>');
$cls->a_footer();
ob_end_flush();
@mysql_close();
?>