Privacy if you would rather * not keep it. */ // The type column, as written by znote_visitor_insert_detailed_data(). function acp_visit_types(): array { return array( 0 => t('acp.vis.type_pageview'), 1 => t('acp.vis.type_register'), 2 => t('acp.vis.type_char_created'), 3 => t('acp.vis.type_highscores'), 4 => t('acp.vis.type_char_search'), 5 => t('acp.vis.type_other'), ); } $days = intv($_GET['days'] ?? 7); if (!in_array($days, array(1, 7, 30, 90), true)) { $days = 7; } $since = time() - ($days * 86400); $collecting = !empty($config['log_ip']); $totalRows = acp_count("SELECT COUNT(*) AS `c` FROM `znote_visitors_details`;"); $uniqueAll = acp_count("SELECT COUNT(DISTINCT `ip`) AS `c` FROM `znote_visitors_details`;"); $rowsPeriod = acp_count("SELECT COUNT(*) AS `c` FROM `znote_visitors_details` WHERE `time` >= ?;", [$since]); $uniquePeriod= acp_count("SELECT COUNT(DISTINCT `ip`) AS `c` FROM `znote_visitors_details` WHERE `time` >= ?;", [$since]); // Visits per day $perDay = db()->fetchAll(" SELECT FROM_UNIXTIME(`time`, '%Y-%m-%d') AS `day`, COUNT(*) AS `hits`, COUNT(DISTINCT `ip`) AS `uniques` FROM `znote_visitors_details` WHERE `time` >= ? GROUP BY `day` ORDER BY `day` DESC; ", [$since]); $perDay = is_array($perDay) ? $perDay : array(); // Breakdown by what people did $byType = db()->fetchAll(" SELECT `type`, COUNT(*) AS `hits` FROM `znote_visitors_details` WHERE `time` >= ? GROUP BY `type` ORDER BY `hits` DESC; ", [$since]); $byType = is_array($byType) ? $byType : array(); // Busiest addresses $topIps = db()->fetchAll(" SELECT `ip`, COUNT(*) AS `hits`, MAX(`time`) AS `last`, MAX(`account_id`) AS `account_id` FROM `znote_visitors_details` WHERE `time` >= ? GROUP BY `ip` ORDER BY `hits` DESC LIMIT 15; ", [$since]); $topIps = is_array($topIps) ? $topIps : array(); $peak = 0; foreach ($perDay as $row) { $peak = max($peak, (int)$row['hits']); } ?>
= t('acp.vis.last_n_days', ['n' => (int)$days]) ?>
| = t('acp.vis.col_day') ?> | = t('acp.vis.col_visits') ?> | = t('acp.vis.col_unique') ?> | |
|---|---|---|---|
| = h((string)$row['day']) ?> | = number_format($hits) ?> | = number_format((int)$row['uniques']) ?> |
= t('acp.vis.last_n_days', ['n' => (int)$days]) ?>
| = t('acp.vis.col_action') ?> | = t('acp.vis.col_count') ?> |
|---|---|
| = h(acp_visit_types()[(int)$row['type']] ?? t('acp.vis.type_n', ['n' => (int)$row['type']])) ?> | = number_format((int)$row['hits']) ?> |
= t('acp.vis.busiest_sub') ?>
| = t('acp.vis.col_ip') ?> | = t('acp.vis.col_visits') ?> | = t('acp.vis.col_last_seen') ?> | = t('acp.vis.col_account') ?> |
|---|---|---|---|
= h(long2ip((int)$row['ip'])) ?> |
= number_format((int)$row['hits']) ?> | = h(getClock((int)$row['last'], true)) ?> | 0): ?> #= $accountId ?> — |