I AM ZIG AND ZIG INVOKES statwhoring
[specialops2.git] / stuff.php
blob26fc38be56a420dc73a77251c7c2d32532ba0acc
1 <?php
2 // $Id$
4 require 'con.php';
6 usleep(100000); //DoS protection
8 $page->title = _('Stats and Stuff');
10 $user->userheader();
12 $a = 1;
14 $date = array(
15 'today' => mktime(0, 0, 0),
16 'week' => mktime(0, 0, 0) - 86400*(gmdate('w')-1),
17 'month' => mktime(0, 0, 0, gmdate('m'), 1),
18 '24h' => (time() - 86400),
19 '7d' => (time() - 86400*7),
20 '30d' => (time() - 86400*30)
23 function getrow($sql) { //getlost
24 global $DB, $date;
25 $return = '';
26 foreach ($date as $num)
27 $return .= '<td>'.$DB->query(sprintf($sql, $num))->fetch_object()->result.'</td> ';
29 return $return;
32 echo '<!--I am insane-->
33 <table id="board_stats" style="empty-cells: hide">
34 <caption>',_('Board Statistics'),'</caption>
36 <colgroup title="',_('Row headers'),'">
37 <col title="',_('Type of data'),'"/>
38 </colgroup>
39 <colgroup title="',_('Fuzzy statistics'),'">
40 <col/><col/><col/>
41 </colgroup>
42 <colgroup title="',_('Raw statistics'),'">
43 <col/><col/><col/><col/>
44 </colgroup>
46 <thead>
47 <tr>
48 <td/>
49 <th scope="col">',_('Today'),'</th>
50 <th scope="col">',_('This week'),'</th>
51 <th scope="col">',_('This month'),'</th>
52 <th scope="col">',_('Last 24 hours'),'</th>
53 <th scope="col">',_('Last 7 days'),'</th>
54 <th scope="col">',_('Last 30 days'),'</th>
55 <th scope="col">',_('Total'),'</th>
56 </tr>
57 </thead>
59 <tbody>
61 <tr class="content c',(++$a&1),'">
62 <th scope="row" title="',_('Count of all messages'),'">',_('Posts'),'</th>
63 ',getrow('SELECT COUNT(*) AS `result` FROM `messages` WHERE `m_time` > %d'),'
64 <td>',$DB->query('SELECT COUNT(*) AS `result` FROM `messages`')->fetch_object()->result,'</td>
65 </tr>
67 <tr class="content c',(++$a&1),'">
68 <th scope="row" title="',_('Any post in direct reply to someone else\'s'),'">',_('Replies'),'</th>
69 ',getrow('SELECT COUNT(*) AS `result` FROM `messages` WHERE `m_replyto` IS NOT NULL AND `m_time` > %d'),'
70 <td>',$DB->query('SELECT COUNT(*) AS `result` FROM `messages` WHERE `m_replyto` IS NOT NULL')->fetch_object()->result,'</td>
71 </tr>
73 <tr class="content c',(++$a&1),'">
74 <th scope="row" title="',_('Count of all topics'),'">',_('Topics'),'</th>
75 ',getrow('SELECT COUNT(DISTINCT(`m_topic`)) AS `result` FROM `messages` WHERE `m_time` > %d'),'
76 <td>',$DB->query('SELECT COUNT(*) AS `result` FROM `topics`')->fetch_object()->result,'</td>
77 </tr>
79 <tr class="content c',(++$a&1),'">
80 <th scope="row" title="',_('Number of new users in a time period'),'">',_('Users'),'</th>
81 ',getrow('SELECT COUNT(*) AS `result` FROM `users` WHERE `u_firstactive` > %d'),'
82 <td>',$DB->query('SELECT COUNT(*) AS `result` FROM `users`')->fetch_object()->result,'</td>
83 </tr>
85 <tr class="content c',(++$a&1),'">
86 <th scope="row" title="',_('Users who\'ve logged in at some point after they registered'),'">',_('Online Users'),'</th>
87 ',getrow('SELECT COUNT(`userid`) AS `result` FROM `users` WHERE `u_lastactive` > `u_firstactive` AND `u_lastactive` > %d'),'
88 <td>',$DB->query('SELECT COUNT(*) AS `result` FROM `users` WHERE `u_lastactive` > `u_firstactive`')->fetch_object()->result,'</td>
89 </tr>
91 <tr class="content c',(++$a&1),'">
92 <th scope="row" title="',_('Users who\'ve posted at least once'),'">',_('Active Users'),'</th>
93 ',getrow('SELECT COUNT(DISTINCT(`userid`)) AS `result` FROM `users`, `messages`
94 WHERE `messages`.`m_poster` = `users`.`userid` AND `messages`.`m_time` > %d'),'
95 <td>',$DB->query('SELECT COUNT(DISTINCT(`userid`)) AS `result` FROM `users`, `messages`
96 WHERE `messages`.`m_poster` = `users`.`userid`')->fetch_object()->result,'</td>
97 </tr>
98 </tbody>
100 </table>';
103 <h2>Stuff</h2>
104 <h3>Terms of Service</h3>
105 <ol>
106 <li>Don't be a fucking idiot.</li>
107 </ol>
109 <?php
110 $page->pagefooter();