<?php
  
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".LG('Гости в сети')."</a>";
ECHO "</div>";

ECHO "<div class='list'>";

ECHO "<a class='h1' href='/modules/?path=users&get=online'>".LG('Пользователи')."</a>";
ECHO "<a class='h1 h' href='/modules/?path=users&section=guests'>".LG('Гости')."</a>";

ECHO "</div>";

$column = DB::GET_COLUMN("SELECT COUNT(*) FROM `GUESTS` WHERE `DATE_VISIT` > '".(TIME()-CONFIG('ONLINE_TIME_GUESTS'))."'");
$spage = SPAGE($column, $page_settings);
$page = PAGE($spage);
$limit = $page_settings * $page - $page_settings;

IF ($column == 0){ 
  
  HTML::EMPTY();
  
}ELSE{
  
  ECHO "<div class='list-body'>"; 
  
}

$data = DB::GET_STRING_ALL("SELECT * FROM `GUESTS` WHERE `DATE_VISIT` > '".(TIME()-CONFIG('ONLINE_TIME_GUESTS'))."' ORDER BY `DATE_VISIT` DESC LIMIT ".$limit.", ".$page_settings."");

WHILE ($list = $data->FETCH())
{
  
  ECHO "<div class='list-menu'>"; 
  
  ECHO "<table style='width: 100%;'><tr>";
  
  ECHO "<td class='us-avatar'>";
  ECHO ICONS('user-secret', 50);
  ECHO "</td>";
  
  ECHO "<td class='us-info'>";
  ECHO "<b>".LG('Гость')."</b><br /><small>";

  ECHO "<br /><font color='black'><b>".LG('Посл. визит').":</b> ".FTIME($list['DATE_VISIT'])."</font>";
  ECHO "<br /><font color='black'><b>".LG('Первый визит').":</b> ".FTIME($list['DATE_CREATE'])."</font>";
  ECHO "<br /><font color='black'><b>".LG('Переходов').":</b> ".$list['TRANSITIONS']."</font>";
  
  IF (ISSET($user)){ 
    
    IF (ACCESS('guests_info', NULL, 1) || MANAGEMENT == 1){
      
      ECHO "<br /><font color='black'><b>".LG('IP').":</b> ".$list['IP']."</font>";
      ECHO "<br /><font color='black'><b>".LG('Браузер').":</b> ".$list['BROWSER']."</font>";
      
    }
    
  }
  
  ECHO "</small></td>";
  
  ECHO "</tr></table>";
  
  ECHO "</div>";
  
}

IF ($column > 0){

  ECHO "</div>";
  
}

IF ($spage > 1){ ECHO STR_PAGE('/modules/?path=users&section=guests&', $spage, $page); }

//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".LG('Гости в сети')."</a>";
ECHO "</div>";
  
?>