<?php
include_once '../sys/inc/start.php';
dpanel::check_access();
$doc = new document(5);
$doc -> title = 'Статистика (сегодня)';

if (!$dcms->log_of_visits)$doc->err('Служба ведения статистики отключена');



$hits['wap']=mysql_result(mysql_query("SELECT COUNT(*) FROM `log_of_visits_today` WHERE `time` = '".DAY_TIME."' AND `browser_type` = 'wap'"),0);
$hits['pda']=mysql_result(mysql_query("SELECT COUNT(*) FROM `log_of_visits_today` WHERE `time` = '".DAY_TIME."' AND `browser_type` = 'pda'"),0);
$hits['web']=mysql_result(mysql_query("SELECT COUNT(*) FROM `log_of_visits_today` WHERE `time` = '".DAY_TIME."' AND `browser_type` = 'web'"),0);

$hosts['wap']=mysql_result(mysql_query("SELECT COUNT(DISTINCT `iplong` , `id_browser`) FROM `log_of_visits_today` WHERE `time` = '".DAY_TIME."' AND `browser_type` = 'wap'"),0);
$hosts['pda']=mysql_result(mysql_query("SELECT COUNT(DISTINCT `iplong` , `id_browser`) FROM `log_of_visits_today` WHERE `time` = '".DAY_TIME."' AND `browser_type` = 'pda'"),0);
$hosts['web']=mysql_result(mysql_query("SELECT COUNT(DISTINCT `iplong` , `id_browser`) FROM `log_of_visits_today` WHERE `time` = '".DAY_TIME."' AND `browser_type` = 'web'"),0);


if (isset($log_of_visits) && mysql_result(mysql_query("SELECT COUNT(*) FROM `log_of_visits_today` WHERE `time` <> '".DAY_TIME."' LIMIT 1"),0))
{
$log_of_visits->tally();
}



$id='today.hits';

$chart=&$_SESSION['chart'][$id];

switch ($dcms->browser_type) {
case 'wap':$chart['size']=64;break;
case 'pda':$chart['size']=110;break;
case 'web':$chart['size']=128;break;
}



$chart['parts']=array('WAP'=>$hits['wap'],'PDA'=>$hits['pda'],'WEB'=>$hits['web']);
echo "Кол-во переходов<br /><img src='/piechart.php?id=$id' alt='Хиты' /><br />";


$id='today.hosts';

$chart=&$_SESSION['chart'][$id];

switch ($dcms->browser_type) {
case 'wap':$chart['size']=64;break;
case 'pda':$chart['size']=110;break;
case 'web':$chart['size']=128;break;
}


$chart['parts']=array('WAP'=>$hosts['wap'],'PDA'=>$hosts['pda'],'WEB'=>$hosts['web']);
echo "Кол-во уникальных посетителей<br /><img src='/piechart.php?id=$id' alt='Хосты' /><br />";

if (!$dcms->log_of_visits)$doc->act('Управление службами','sys.settings.daemons.php');
$doc->ret('Админка','./');
?>
