<?php $depth = '../'; require_once $depth . '../login/login_check.php'; /*初始变量*/ $dtime = statime("Y-m-d"); $css_url = $depth . "../templates/css"; $img_url = $depth . "../templates/images"; if ($action == 'modify') { if ($met_stat_cr1) { delet_estat_cr(1, $met_stat_cr1); } if ($met_stat_cr2) { delet_estat_cr(2, $met_stat_cr2); } if ($met_stat_cr3) { delet_estat_cr(3, $met_stat_cr3); } if ($met_stat_cr4) { delet_estat_cr(4, $met_stat_cr4); } if ($met_stat_cr5) { delet_estat_cr(5, $met_stat_cr5); } if ($met_stat_max < 0) { $met_stat_max = 10000; } require_once $depth . '../include/config.php'; metsave('../app/stat/set.php?lang=' . $lang . '&anyid=' . $anyid, '', $depth); } elseif ($action == 'empty') { delet_estat_cr(1, 1);
$summary_ip[$i] = $ky[1]; $summary_al[$i] = $ky[2]; } } } $metinfo = "<graph BGCOLOR='F8F8F8' yAxisMinValue='0' decimalPrecision='0' showValues='0' showAlternateHGridColor='1' AlternateHGridColor='ff5904' divLineColor='ff5904' divLineAlpha='20' alternateHGridAlpha='5' anchorRadius='4' anchorBgColor='ffffff' baseFontSize='12' canvasBorderColor='cccccc' canvasBorderThickness='1' \n\t\tshadowAlpha='30' numVDivLines ='22' showAlternateVGridColor='1' alternateVGridAlpha='5' outCnvbaseFontSize='10' formatNumberScale='0'\n\t\t>"; $dtm = date('Y-m-d'); $metinfo .= '<categories>'; for ($i = 0; $i < 24; $i++) { if ($p == 24) { $p = 0; } $lp = $p % 2 == 0 ? 1 : 0; $dtms = $dtm; if ($p > date('G')) { $dtms = date("Y-m-d", statime("Y-m-d", "-1 day")); } $metinfo .= $sys ? "<category name='{$p}' showName='{$lp}' hoverText='{$dtms} {$p}'/>" : "<category name='{$p}:00' showName='{$lp}' hoverText='{$dtms} {$p}:00'/>"; $p++; } $metinfo .= '</categories>'; /*PV*/ $metinfo .= "<dataset seriesName='{$lang_statpv}' color='0033ca' anchorBorderColor='0033ca' anchorBgColor='ffffff' anchorSides='10' anchorRadius='4'>"; for ($i = 0; $i < 24; $i++) { if ($p == 24) { $p = 0; } $lp = $p % 2 == 0 ? 1 : 0; if (!$summary_pv[$p]) { $summary_pv[$p] = 0; }
<?php $depth = '../'; require_once $depth . '../login/login_check.php'; /*时间变量*/ $dtime = statime("Y-m-d"); $ztime = statime("Y-m-d", "-1 day"); $xtime = statime("Y-m-d", "-6 day"); $timeq30 = statime("Y-m-d", "-29 day"); $timed1 = strtotime(date('Y-m-d', mktime(0, 0, 0, date('n'), 1, date('Y')))); $st = isset($st) ? $st : $dtime; $et = isset($et) ? $et : $dtime; if ($stt) { $st = strtotime($stt); } if ($ett) { $et = strtotime($ett); } if ($st > $et) { $st = strtotime($ett); $et = strtotime($stt); } if ($st && $st > $dtime) { $st = $dtime; } if ($et && $et > $dtime) { $et = $dtime; } /*初始变量*/ $tmst = date("Y-m-d", $st); $tmet = date("Y-m-d", $et);
function delet_estat_cr($type, $value) { global $db, $met_visit_summary, $met_visit_detail, $met_visit_day, $met_adminfile; $time = date('Y-m'); $string = ''; switch ($value) { case 1: $st = statime("Y-m-d"); break; case 2: $st = statime("Y-m-d", "-6 day"); break; case 3: $st = statime("Y-m-d", "last month"); break; case 4: $st = statime("Y-m-d", "-1 year"); break; } if ($st) { switch ($type) { case 1: $query = "select * from {$met_visit_summary} where stattime<'{$st}'"; $ststdata = $db->get_all($query); foreach ($ststdata as $key => $val) { $string .= "INSERT INTO {$met_visit_summary} VALUES('','{$val['pv']}','{$val['ip']}','{$val['alone']}','{$val['parttime']}','{$val['stattime']}');\n"; } $query = "delete from {$met_visit_summary} where stattime<'{$st}'"; break; case 2: $query = "select * from {$met_visit_detail} where stattime<'{$st}' and type='1'"; $ststdata = $db->get_all($query); foreach ($ststdata as $key => $val) { $string .= "INSERT INTO {$met_visit_detail} VALUES('','{$val['name']}','{$val['pv']}','{$val['ip']}','{$val['alone']}','{$val['remark']}','{$val['type']}','{$val['columnid']}','{$val['listid']}','{$val['stattime']}','{$val['lang']}');\n"; } $query = "select * from {$met_visit_detail} where stattime<'{$st}' and type='1'"; $db->query($query); break; case 3: $query = "select * from {$met_visit_detail} where stattime<'{$st}' and type='2'"; $ststdata = $db->get_all($query); foreach ($ststdata as $key => $val) { $string .= "INSERT INTO {$met_visit_detail} VALUES('','{$val['name']}','{$val['pv']}','{$val['ip']}','{$val['alone']}','{$val['remark']}','{$val['type']}','{$val['columnid']}','{$val['listid']}','{$val['stattime']}','{$val['lang']}');\n"; } $query = "delete from {$met_visit_detail} where stattime<'{$st}' and type='2'"; $db->query($query); break; case 4: $query = "select * from {$met_visit_detail} where stattime<'{$st}' and type='3'"; $ststdata = $db->get_all($query); foreach ($ststdata as $key => $val) { $string .= "INSERT INTO {$met_visit_detail} VALUES('','{$val['name']}','{$val['pv']}','{$val['ip']}','{$val['alone']}','{$val['remark']}','{$val['type']}','{$val['columnid']}','{$val['listid']}','{$val['stattime']}','{$val['lang']}');\n"; } $query = "delete from {$met_visit_detail} where stattime<'{$st}' and type='3'"; $db->query($query); break; case 5: $query = "select * from {$met_visit_day} where acctime<'{$st}'"; $ststdata = $db->get_all($query); foreach ($ststdata as $key => $val) { $string .= "INSERT INTO {$met_visit_day} VALUES('','{$val['ip']}','{$val['acctime']}','{$val['visitpage']}','{$val['antepage']}','{$val['columnid']}','{$val['listid']}','{$val['browser']}','{$val['dizhi']}','{$val['network']}','{$val['lang']}');\n"; } $query = "delete from {$met_visit_day} where acctime<'{$st}'"; $db->query($query); break; } if ($met_adminfile) { if (!file_exists(ROOTPATH . "{$met_adminfile}/databack/stat/")) { mkdir(ROOTPATH . "{$met_adminfile}/databack/stat/", 0777); } if (!file_exists(ROOTPATH . "{$met_adminfile}/databack/")) { mkdir(ROOTPATH . "{$met_adminfile}/databack/", 0777); } if ($string) { file_put_contents(ROOTPATH . "{$met_adminfile}/databack/stat/{$time}.sql", $string, FILE_APPEND); } } } }
$visit = $db->get_one($query); $visit[pv] = $visit[pv] ? $visit[pv] : 0; $visit[alone] = $visit[alone] ? $visit[alone] : 0; $visit[ip] = $visit[ip] ? $visit[ip] : 0; $per_visit = sprintf("%.2f", $visit['pv'] / $visit['alone']); $ztime = statime("Y-m-d", "-1 day"); $visit_summaryz = $db->get_one("SELECT * FROM {$met_visit_summary} WHERE stattime='{$ztime}'"); if (!$visit_summaryz) { $visit_summaryz['pv'] = 0; $visit_summaryz['alone'] = 0; $visit_summaryz['ip'] = 0; $visit_summaryz['per'] = '0.00'; } else { $visit_summaryz['per'] = sprintf("%.2f", $visit_summaryz['pv'] / $visit_summaryz['alone']); } $qtime = statime("Y-m-d", "-2 day"); $visit_summaryq = $db->get_one("SELECT * FROM {$met_visit_summary} WHERE stattime='{$qtime}'"); if (!$visit_summaryq) { $visit_summaryq['pv'] = 0; $visit_summaryq['alone'] = 0; $visit_summaryq['ip'] = 0; $visit_summaryq['per'] = '0.00'; } else { $visit_summaryq['per'] = sprintf("%.2f", $visit_summaryq['pv'] / $visit_summaryq['alone']); } $SERVER_SIGNATURE1 = $_SERVER['SERVER_SIGNATURE']; $mysql1 = mysql_get_server_info(); $feedback = $db->counter($met_feedback, " where readok=0 and lang='{$lang}' ", "*"); $message = $db->counter($met_message, " where readok=0 and lang='{$lang}' ", "*"); $link = $db->counter($met_link, " where show_ok=0 and lang='{$lang}' ", "*"); $member = $db->counter($met_admin_table, " where admin_approval_date is null and lang='{$lang}' and usertype<3 ", "*");
public function dohome() { global $_M; /*获取统计数据*/ function statime($ymd, $day = '') { $day = $day == '' ? time() : strtotime($day); $time = strtotime(date($ymd, $day)); return $time; } $stat = array(); for ($i = 1; $i <= 5; $i++) { $stats = $i == 1 ? statime("Y-m-d") : statime("Y-m-d", 0 - $i + 1 . " day"); $query = "select * from {$_M[table][visit_summary]} WHERE stattime ='{$stats}'"; $stat[$i] = DB::get_one($query); if (!$stat[$i]) { $stat[$i]['pv'] = 0; $stat[$i]['alone'] = 0; $stat[$i]['ip'] = 0; } $stat[$i]['day'] = date('Y-m-d', $stats); if ($i == 1) { $stat[$i]['day'] = $_M['word']['today']; } if ($i == 2) { $stat[$i]['day'] = $_M['word']['yesterday']; } } /*图表数据*/ $dm = date('H', time()); $dt = $dm - 8; $dt = $dt < 0 ? $dt + 24 : $dt; for ($i = 0; $i <= 23; $i++) { if ($i <= $dm && $i >= $dt) { $d = $i < 10 ? '0' . $i : $i; $chartdata['labels'][] = "{$d}:59"; } } $chartcolor[0] = "#23b7e5"; $chartcolor[1] = "#7266ba"; $chartcolor[2] = "#23ad44"; foreach ($chartcolor as $key => $val) { $chartdata['datasets'][$key]['fillColor'] = $val; $chartdata['datasets'][$key]['strokeColor'] = $val; $chartdata['datasets'][$key]['pointColor'] = $val; $chartdata['datasets'][$key]['pointStrokeColor'] = '#fff'; } $nowcrt = explode("|", $stat[1]['parttime']); $i = 0; foreach ($nowcrt as $val) { if ($i <= $dm && $i >= $dt) { $aowcrt = ''; if ($val) { $aowcrt = explode("-", $val); $val = array(); $val[0] = $aowcrt[0]; $val[1] = $aowcrt[1]; $val[2] = $aowcrt[2]; } else { $val[0] = 0; $val[1] = 0; $val[2] = 0; } $chartdata['datasets'][0]['data'][] = $val[0]; $chartdata['datasets'][1]['data'][] = $val[1]; $chartdata['datasets'][2]['data'][] = $val[2]; } $i++; } $chartdata = jsonencode($chartdata); /*我的应用*/ $query = "select * from {$_M['table']['admin_column']} where bigclass='44'"; $app_in = DB::get_all($query); $privilege = background_privilege(); require $this->template('tem/home'); }
<?php # MetInfo Enterprise Content Management System # Copyright (C) MetInfo Co.,Ltd (http://www.metinfo.cn). All rights reserved. $depth = '../'; require_once $depth . '../login/login_check.php'; require_once ROOTPATH . 'include/export.func.php'; /*时间变量*/ $dtimet = statime("Y/m/d 00:00:00"); $dtimew = statime("Y/m/d 23:59:59"); $ztimea = statime("Y-m-d 00:00:00", "-1 day"); $ztimeb = statime("Y-m-d 23:59:59", "-1 day"); $xtime = statime("Y-m-d 00:00:00", "-6 day"); $timeq30 = statime("Y-m-d 00:00:00", "-29 day"); $timed1 = strtotime(date('Y-m-d 00:00:00', mktime(0, 0, 0, date('n'), 1, date('Y')))); $st = isset($st) ? $st : $dtimet; $et = isset($et) ? $et : $dtimew; if ($stt) { $st = strtotime($stt); } if ($ett) { $et = strtotime($ett); } if ($st > $et) { $st = strtotime($ett); $et = strtotime($stt); } /*初始变量*/ $cs = isset($cs) ? $cs : 0; $dancs[$cs] = 'class="dday round"'; $tmst = date("Y-m-d", $st);