<?
$system['title'] = 'Гости';
require SYS . 'header.php';

$k_post=$sql -> selectCount("SELECT COUNT(*) FROM `gosti_online` WHERE `date_last` > '".(time()-600)."' AND `pereh` >= '0'");


//include_once FUNC.'geolocal.php';


if ($k_post == 0) {
  ?>
  <div class="alert" style="margin: 2px;">Список гостей пуст</div>
  <?
} else {
  $k_page = k_page($k_post, $system['page_str']);
  $page = page($k_page);
  $start =  $system['page_str'] * $page -  $system['page_str'];

$array = $sql -> select("SELECT * FROM `gosti_online` WHERE `date_last` > '".(time()-600)."' AND `pereh` >= '0' ORDER BY `date_aut` DESC LIMIT $start, $system[page_str]");

foreach ($array AS $guest){
$num++;

$ip = long2ip($guest['ip']);


//get ISO2 country code


echo "  <div class='nav1'>\n";
echo "Гость\n";
echo "  </div>\n";

echo "  <div class='nav2'>\n";

echo "<span class=\"ank_n\">Посл. посещение:</span> <span class=\"ank_d\">".vremja($guest['date_last'])."</span><br />\n";
if ($guest['ua']!=NULL)echo "<span class=\"ank_n\">UA:</span> <span class=\"ank_d\">$guest[ua]</span><br />\n";


if ($level >2)
{
echo "<span class=\"ank_n\">IP:</span> <span class=\"ank_d\">".long2ip($guest['ip'])."</span><br />\n";
echo "<span class=\"ank_n\">Переходов:</span> <span class=\"ank_d\">$guest[pereh]</span><br />\n";
//echo "<span class=\"ank_n\">Пров:</span> <span class=\"ank_d\">".$guest['ip']."</span><br />\n";
if ($guest['url'])echo "<span class=\"ank_n\">URL:</span> <span class=\"ank_d\"><a href='$guest[url]'>".$guest['url']."</a></span><br />\n";
}

echo "  </div>\n";
}

  if ($k_page > 1) { 
    str('?func=' . $func .  '&amp;', $k_page, $page);
  }
}
