<?php
$security = 3;
include_once('../inclfiles/core.php');
$title = 'Статистика игры';
include_once('../inclfiles/head.php');

if($_SERVER['HTTP_HOST'] == $set['site_url']){
	t1();
	echo '<table>';
	echo '<tr><td>Дата</td><td>Посетители</td><td>Просмотры</td></tr>';
	$xml = simplexml_load_file("http://api.mobtop.ru/103918/visitors_offset/7/");
	foreach ($xml->stat->day as $day){?><tr><td><?=$day->date?></td><td><?=$day->hosts?></td><td><?=$day->hits?></td></tr><?};
	echo '</table>';
	t2();
}

$users = mysql_num_rows(mysql_query("SELECT * FROM `users`"));
$countries = mysql_num_rows(mysql_query("SELECT * FROM `countries` WHERE `zahvatil` = 0"));
$countries_all = mysql_num_rows(mysql_query("SELECT * FROM `countries`"));
$buildings = mysql_num_rows(mysql_query("SELECT * FROM `buildings`"));
$generals = mysql_num_rows(mysql_query("SELECT * FROM `generals`"));
t1();
echo 'Количество правителей: '.$users.'<br/>';
echo 'Стран на карте мира: '.$countries.'<br/>';
echo 'Всего стран: '.$countries_all.'<br/>';
echo 'Захвачено стран: '.intval($countries_all - $countries).'<br/>';
echo 'Сооружений: '.$buildings.'<br/>';
echo 'Генералов: '.$generals.'<br/>';
echo 'Возраст игры: '.vozrast(time() - $set['runtime']).'<br/>';
t2();
if($user['level'] >= 2) a('index.php?','Панель управления','control_panel');
include_once('../inclfiles/foot.php');
?>