Пример #1
0
 public function Statistic()
 {
     $sys = new TSystem();
     $st = new TStatistic();
     $dt = new TDate();
     $this->view->m = $sys->GetRcordCount('member');
     $this->view->ma = $sys->GetRcordCount('member', 'member_type = 1');
     $this->view->com = $sys->GetRcordCount('comment');
     $this->view->acom = $sys->GetRcordCount('member', 'member_status = 1');
     $this->view->top = $sys->GetRcordCount('topic');
     $this->view->topa = $sys->GetRcordCount('topic', 'topic_status = 1');
     $this->view->tops = $sys->GetRcordCount('topic', 'topic_status = 2');
     $viss['visitcount'] = $st->VisitCount($dt->Today(), time());
     $viss['visitorcount'] = $st->VisitorCount($dt->Today(), time());
     $viss['y'] = $st->VisitCount($dt->Yesterday(), $dt->Today());
     $viss['ys'] = $st->VisitorCount($dt->Yesterday(), $dt->Today());
     $viss['m'] = $st->VisitCount($dt->ThisMonthStart(), time());
     $viss['lm'] = $st->VisitCount($dt->LastMonthStart(), $dt->LastMonthEnd());
     $viss['total'] = $st->VisitCount(0, time());
     $viss['online'] = $st->OnlineCount();
     $t = time();
     $s = $dt->Yesterday();
     $e = $dt->Today() - 1;
     $dayz = array();
     $viz = array();
     $vit = array();
     $viz[0] = $viss['visitcount'];
     $vit[0] = $viss['visitorcount'];
     for ($index = 0; $index < 30; $index++) {
         $mod = $index * DAY;
         $dayz[$index] = $dt->SDate('d', $t - $mod);
         $viz[$index + 1] = $st->VisitCount($s - $mod, $e - $mod);
         $vit[$index + 1] = $st->VisitorCount($s - $mod, $e - $mod);
     }
     unset($viz[$index + 1]);
     unset($vit[$index + 1]);
     $this->view->dayz = array_reverse($dayz);
     $this->view->viz = array_reverse($viz);
     $this->view->vit = array_reverse($vit);
     global $browser_list, $os_list;
     $this->view->bw = array();
     $this->view->os = array();
     for ($i = 0; $i < count($browser_list); $i++) {
         $this->view->bw[$i] = $sys->GetRcordCount('statistic', 'statistic_browser = ' . $i);
     }
     for ($i = 0; $i < count($os_list); $i++) {
         $this->view->os[$i] = $sys->GetRcordCount('statistic', 'statistic_os = ' . $i);
     }
     while (($key = array_search('0', $this->view->os)) !== false) {
         unset($this->view->os[$key]);
     }
     while (($key = array_search('0', $this->view->bw)) !== false) {
         unset($this->view->bw[$key]);
     }
     $this->view->cl1 = $sys->GetRedToGreen(count($this->view->bw));
     $this->view->cl2 = $sys->GetRedToGreen(count($this->view->os));
     $this->view->topvisits = $sys->GetRecordByOrd('topic', 'topic_counter', '1', 'DESC');
     $this->view->lastsch = $sys->GetRecordByOrd('statistic', 'statistic_id', ' CHAR_LENGTH(statistic_keyword) > 2 ', 'DESC');
     $this->view->vis = $viss;
     $this->view->PageRender('Index/Statistic', _lg('Statistic'));
 }
Пример #2
0
// is user in manager page
define('__MP__', FALSE);
session_start();
ob_start();
require_once './tconstant.php';
require_once './inc/header.php';
define('PAGE_C', 24);
require './api/general.php';
require './api/relation.php';
require './tempp/topic.php';
$a = GetTag();
$a = GetRecord($ID);
$dt = new TDate();
$st = new TStatistic();
$st->Count();
$viss['visitcount'] = $st->VisitCount($dt->Today(), time());
$viss['visitorcount'] = $st->VisitorCount($dt->Today(), time());
$viss['y'] = $st->VisitCount($dt->Yesterday(), $dt->Today());
$viss['totoal'] = $st->VisitCount(0, time());
$viss['online'] = $st->OnlineCount();
//print_r($viss);die;
$smarty->assign('vss', $viss);
if (isset($_COOKIE['mid'])) {
    $_SESSION['mid'] = $_COOKIE['mid'];
}
if (isset($url[1]) && $url[0] == 'form' && isset($_POST)) {
    require './inc/form.php';
} else {
    switch ($url[0]) {
        case 'index.php':
            $smarty->assign('title', $title);