3 require('includes/header.php');
5 update_activity('statistics');
6 $page_title = 'Statistics';
10 $query = 'SELECT count(*) FROM topics;';
11 $query .= 'SELECT count(*) FROM replies;';
12 $query .= 'SELECT count(*) FROM uid_bans;';
13 $query .= "SELECT count(*) FROM topics WHERE author = '" . $link->real_escape_string($_SESSION['UID']) . "';";
14 $query .= "SELECT count(*) FROM replies WHERE author = '" . $link->real_escape_string($_SESSION['UID']) . "';";
15 $query .= 'SELECT count(*) FROM ip_bans;';
17 $link->multi_query($query);
19 $result = $link->store_result();
20 while ($row = $result->fetch_row())
22 $statistics[] = $row[0];
25 } while ($link->next_result());
27 $num_topics = $statistics[0];
28 $num_replies = $statistics[1];
29 $replies_per_topic = round($num_replies / $num_topics);
30 $num_bans = $statistics[2];
31 $your_topics = $statistics[3];
32 $your_replies = $statistics[4];
33 $your_posts = $your_topics +
$your_replies;
34 $num_ip_bans = $statistics[5];
36 $total_posts = $num_topics +
$num_replies;
37 $days_since_start = floor(( $_SERVER['REQUEST_TIME'] - SITE_FOUNDED
) / 86400);
38 if ($days_since_start == 0) //Fix a division by zero error
39 $days_since_start = 1;
40 $posts_per_day = round($total_posts / $days_since_start);
41 $topics_per_day = round($num_topics / $days_since_start);
42 $replies_per_day = round($num_replies / $days_since_start);
49 <th
class="minimal">Amount
</th
>
54 <th
class="minimal">Total existing posts
</th
>
55 <td
class="minimal"><?php
echo format_number($total_posts) ?
></td
>
60 <th
class="minimal">Existing topics
</th
>
61 <td
class="minimal"><?php
echo format_number($num_topics) ?
></td
>
66 <th
class="minimal">Existing replies
</th
>
67 <td
class="minimal"><?php
echo format_number($num_replies) ?
></td
>
68 <td
>That
's ~<?php echo $replies_per_topic ?> replies/topic.</td>
72 <th class="minimal">Posts/day</th>
73 <td class="minimal">~<?php echo format_number($posts_per_day) ?></td>
78 <th class="minimal">Topics/day</th>
79 <td class="minimal">~<?php echo format_number($topics_per_day) ?></td>
84 <th class="minimal">Replies/day</th>
85 <td class="minimal">~<?php echo format_number($replies_per_day) ?></td>
90 <th class="minimal">Temporarily banned IDs</th>
91 <td class="minimal"><?php echo format_number($num_bans) ?></td>
96 <th class="minimal">Banned IP addresses</th>
97 <td class="minimal"><?php echo format_number($num_ip_bans) ?></td>
102 <th class="minimal">Days since launch</th>
103 <td class="minimal"><?php echo number_format($days_since_start) ?></td>
104 <td>Went live on <?php echo date('Y
-m
-d
', SITE_FOUNDED) . ', ' . calculate_age(SITE_FOUNDED) ?> ago.</td>
115 <th class="minimal">Total posts by you</th>
116 <td><?php echo format_number($your_posts) ?></td>
120 <th class="minimal">Topics started by you</th>
121 <td><?php echo format_number($your_topics) ?></td>
125 <th class="minimal">Replies by you</th>
126 <td><?php echo format_number($your_replies) ?></td>
132 require('includes
/footer
.php
');