1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 17:31:00 +01:00

unique ips column

This commit is contained in:
8chan 2014-09-29 07:17:00 +00:00
parent c9a2fe5343
commit 84d600a880
2 changed files with 16 additions and 3 deletions

View File

@ -21,8 +21,10 @@ foreach ($boards as $i => $board) {
$query = prepare(sprintf("
SELECT MAX(id) max, (SELECT COUNT(*) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time) > DATE_SUB(NOW(), INTERVAL 1 DAY)) ppd,
(SELECT COUNT(*) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time) > DATE_SUB(NOW(), INTERVAL 1 HOUR)) pph,
(SELECT count(id) FROM ``posts_%s``) count FROM ``posts_%s``
", $board['uri'], $board['uri'], $board['uri'], $board['uri']));
(SELECT count(id) FROM ``posts_%s``) count,
(SELECT COUNT(DISTINCT ip) FROM ``posts_%s``) uniq_ip
FROM ``posts_%s``
", $board['uri'], $board['uri'], $board['uri'], $board['uri'], $board['uri']));
$query->execute() or error(db_error($query));
$r = $query->fetch(PDO::FETCH_ASSOC);
@ -35,6 +37,7 @@ SELECT MAX(id) max, (SELECT COUNT(*) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time)
$boards[$i]['pph'] = $pph;
$boards[$i]['ppd'] = $ppd;
$boards[$i]['max'] = $r['max'];
$boards[$i]['uniq_ip'] = $r['uniq_ip'];
}
usort($boards,

View File

@ -23,7 +23,16 @@ th.headerSortDown {
<p style='text-align:center'>{% trans %}There are currently <strong>{{n_boards}}</strong> boards + <strong>{{hidden_boards_total}}</strong> unindexed boards = <strong>{{t_boards}}</strong> total boards. Site-wide, {{total_posts_hour}} posts have been made in the last hour, with {{total_posts}} being made on all active boards since October 23, 2013.{% endtrans %}</p>
<table class="modlog" style="width:auto"><thead><tr><th>L</th><th>{% trans %}Board{% endtrans %}</th><th>{% trans %}Board title{% endtrans %}</th><th>{% trans %}Posts in last hour{% endtrans %}</th><th>{% trans %}Total posts{% endtrans %}</th><th>{% trans %}Created{% endtrans %}</th></tr></thead><tbody>
<table class="modlog" style="width:auto"><thead>
<tr>
<th>L</th>
<th>{% trans %}Board{% endtrans %}</th>
<th>{% trans %}Board title{% endtrans %}</th>
<th>{% trans %}Posts in last hour{% endtrans %}</th>
<th>{% trans %}Total posts{% endtrans %}</th>
<th>{% trans %}Unique IPs{% endtrans %}</th>
<th>{% trans %}Created{% endtrans %}</th>
</tr></thead><tbody>
{% for board in boards %}
<tr>
<td>{{ board.img|raw }}</td>
@ -31,6 +40,7 @@ th.headerSortDown {
<td>{{ board['title'] }}</td>
<td style='text-align:right'>{{board['pph']}}</td>
<td style='text-align:right'>{{board['max']}}</td>
<td style='text-align:right'>{{board['uniq_ip']}}</td>
<td>{{board['time']}} ({{board['ago']}} ago)</td></tr>
{% endfor %}
</tbody></table>