?> <table class="tDefault tMedia"> <thead> <tr> <th>Дата</th> <th>Поисковик</th> <th>Последние <?php echo $n; ?> запроса</th> <th>Время / Страница</th> </tr> </thead> <?php foreach ($items as $ref) { $refer = StatsHelper::Ref($ref['refer']); if (is_array($refer)) { list($engine, $query) = $refer; if ($engine == "G" and !empty($query) and stristr($ref['refer'], "/url?")) { $ref['refer'] = str_replace("/url?", "/search?", $ref['refer']); } echo "<tr>"; echo "<td nowrap title=" . StatsHelper::$MONTH[substr($ref['dt'], 4, 2)] . ">" . StatsHelper::$DAY[$ref['day']] . StatsHelper::dtconv($ref['dt']) . "</td>"; echo "<td align=center>"; StatsHelper::echo_se($engine); if (empty($query)) { $query = "<font color=grey>неизвестно</font>"; } echo "</td><td align=left style='overflow: hidden;text-overflow: ellipsis;'><a target=_blank href=\"" . $ref['refer'] . "\">" . $query . "</a></td>"; echo "<td align=left style='overflow: hidden;text-overflow: ellipsis;' nowrap>" . $ref['tm'] . " <a target=_blank href=" . $ref['req'] . ">" . $ref['req'] . "</a></td></tr>"; }
public function actionHosts($date) { $this->pageName = 'Hosts'; $stats = Yii::app()->stats->initRun(); $zp = $stats['zp']; $sql = "SELECT tm,refer,ip,proxy,host,lang,user,req from cms_surf WHERE dt='" . $date . "' AND " . $zp . " GROUP BY ip ORDER BY i DESC"; $cmd = Yii::app()->db->createCommand($sql); $result = array(); foreach ($cmd->queryAll(false) as $row) { $refer = StatsHelper::Ref($row[1]); if (is_array($refer)) { list($engine, $query) = $refer; $refer1 = StatsHelper::checkSearchEngine($row[1], $engine, $query); } else { $refer1 = StatsHelper::checkIdna($row); } $result[] = array('time' => $row[0], 'refer' => $refer1, 'ip' => StatsHelper::getRowIp($row[2], $row[3]), 'host' => StatsHelper::getRowHost($row[2], $row[3], $row[4], $row[5]), 'user_agent' => StatsHelper::getRowUserAgent($row[6], $row[1]), 'timelink' => Html::link($row[7], $row[7])); } $dataProvider = new CArrayDataProvider($result, array('sort' => array('attributes' => array('ip' => array('asc' => 'ip DESC', 'desc' => 'ip ASC'), 'refer' => array('asc' => 'refer DESC', 'desc' => 'refer ASC'), 'time' => array('asc' => 'time DESC', 'desc' => 'time ASC'))), 'pagination' => array('pageSize' => 10))); $this->render('hosts', array('dataProvider' => $dataProvider)); }