<?

          include 'system/core.php';

          $_title = 'Онлайн';
          include 'system/header.php';
          if(!$user['id'])
          {
  
          header('Location: /index.php/?m=guest'); exit;
          
          }


 
         echo '<div class="tegi"><b>Онлайн '.mysql_result(mysql_query('select count(`id`) from `user` where `online` > "'.(time()-180).'"'),0).'</b></div></div></div> ';
         
 
          $cop = 10;
  
          $ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `user` where `online` > '".(time()-180)."'"),0);
          
          $cp = ceil($ca/$cop);
  
          if(isset($_GET['p']) && is_numeric($_GET['p'])){
  
          $p = $_GET['p'];
  
          if($_GET['p']>$cp) $p = $cp;
  
          if($_GET['p']<1)$p = 1;
  
          }
          else
          {

          $p = 1;
          
          }

          $start = $p*$cop-$cop;
  
          $online = mysql_query("SELECT * FROM `user` where `online` > '".(time()-180)."' ORDER BY `online` DESC LIMIT $start,$cop");

          while($online2 = mysql_fetch_assoc($online))
          {
          echo '<div class="post2"><table cellpadding="0" cellspacing="4"><tr><td style="width: 40px; vertical-align: top; height: 40px; margin: 0; padding:0; border: 0;" id="mail_avatar"><img src="/modules/profile/';
  if(empty($online2['ava'])) echo 'images/noava.png'; else echo 'ava/'.$online2['ava'];
  echo '"style="max-width:40px;"/>';
echo '</td><td style="vertical-align: top;" id="mail_textarea">'.ustatus($online2['id']).' <a href="/us'.$online2['id'].'">'.uname($online2['id']).' </a>'.ced($online2['id']).''.uaccess($online2['id']);
echo '<br/>Рейтинг: <font color="green">'.$online2['rating'].'</font><br/>Активность: '.times($online2['online']).'';
echo '</td></tr></table></div>';
          
          }

          echo '<div class="spis">Стр. ';
  
          if($p-2>0) echo '<a href="/online.php?p=1"><<</a> ';
  
          if($p-1>0) echo '<a href="/online.php?p='.($p-1).'"><</a> ';

          if($p-3>0) echo '<a href="/online.php?p='.($p-3).'">'.($p-3).'</a> | ';
 
          if($p-2>0) echo '<a href="/online.php?p='.($p-2).'">'.($p-2).'</a> | ';  
  
          if($p-1>0) echo '<a href="/online.php?p='.($p-1).'">'.($p-1).'</a> | ';
  
          echo '<b>'.$p.'</b>';
  
          if($p+1<=$cp) echo ' | <a href="/online.php?p='.($p+1).'">'.($p+1).'</a>';
  
          if($p+2<=$cp) echo ' | <a href="/online.php?p='.($p+2).'">'.($p+2).'</a>';
  
          if($p+3<=$cp) echo ' | <a href="/online.php?p='.($p+3).'">'.($p+3).'</a>';

          if($p+1<=$cp) echo ' <a href="/online.php?p='.($p+1).'">></a>';
  
          if($p+2<=$cp) echo ' <a href="/online.php?p='.ceil($ca/$cop).'">>></a>';
  
          echo '</div></div>';

          include 'system/footer.php';

?>