-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathactiveusers.php
147 lines (129 loc) · 4.69 KB
/
activeusers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
require 'lib/function.php';
$windowtitle = "$boardname -- Active users";
require 'lib/layout.php';
if (($type == 'pm' || $type == 'pms') && !$log)
unset($type);
if (!isset($_GET['time']))
$time = 86400;
else
$time = intval($_GET['time']);
$query='SELECT users.id, regdate, name, minipic, sex, powerlevel, aka, birthday, COUNT(*) AS cnt FROM users';
$endp=' GROUP BY users.id ORDER BY cnt DESC';
$linklist[0] = "<a href=\"?time=$time\">posts made</a>";
$linklist[1] = "<a href=\"?type=thread&time=$time\">new threads</a>";
if ($log) {
$linklist[2] = "<a href=\"?type=pms&time=$time\">PMs sent by you</a>";
$linklist[3] = "<a href=\"?type=pm&time=$time\">PMs sent to you</a>";
}
if ($type == 'thread') {
$posters = $sql-> query("$query, threads WHERE threads.user=users.id"
.($time ? " AND threads.firstpostdate> '". (ctime() - $time) ."'" : '')
.$endp);
$desc = "Most active thread posters";
$column = "Threads";
$column2 = "threads";
$stat = "most thread creators";
$linklist[1] = "new threads";
} elseif ($type == 'pm') {
$posters = $sql-> query("$query, pmsgs WHERE pmsgs.userto=$loguserid"
.($time ? " AND pmsgs.date> '". (ctime() - $time) ."'" : '')
." AND pmsgs.userfrom=users.id$endp");
$desc = "PMs recieved from";
$column = "PMs";
$column2 = "PMs";
$stat = "most message senders";
$linklist[3] = "PMs sent to you";
} elseif ($type == 'pms') {
$posters = $sql-> query("$query, pmsgs WHERE pmsgs.userfrom=$loguserid"
.($time ? " AND pmsgs.date> '". (ctime() - $time) ."'" : '')
." AND pmsgs.userto=users.id$endp");
$desc = "PMs sent to";
$column = "PMs";
$column2 = "PMs";
$stat = "who you've sent the most messages to";
$linklist[2] = "PMs sent by you";
} else {
$posters = $sql-> query("$query, posts WHERE posts.user=users.id"
.($tid ? " AND thread='$tid'" : '')
.($time ? " AND posts.date> '". (ctime() - $time) ."'" : '')
.$endp);
$desc = "Most active posters";
$column = "Posts";
$column2 = "posts";
$stat = "most active posters";
$linklist[0] = "posts made";
$type = '';
}
$link='<a href='.(($type) ? "?type={$type}&" : '?').'time';
print "
$header
$tblstart
<td align=left width=50%>$smallfont
Show $stat in the:
<br>$link=3600>last hour</a> - $link=86400>last day</a> - $link=604800>last week</a> - $link=2592000>last 30 days</a> - $link=0>from the beginning</a>
</td><td width=50% align=right>$smallfont
Most active users by:<br>
".implode(" - ", $linklist)."
$tblend
";
if ($time)
$timespan = " during the last ". timeunits2($time);
else
$timespan = "";
/*
if ($loguser["powerlevel"] >= 1) {
// Xk will hate me for using subqueries.
// No, I'll just hate you for adding this period
// It's like a sore.
// Also, uh, interesting I guess. The more you know.
$pcounts = $sql -> query("
SELECT
(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel >= 1) AS posts_staff,
(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = 0) AS posts_users,
(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = -1) AS posts_banned");
$pcounts = $sql->fetch($pcounts);
print "
$tblstart
<tr>$tccellh colspan=2>Staff vs. Normal User Posts</tr>
<tr>$tccell1>$pcounts[posts_staff]</td>$tccell1>$pcounts[posts_users]</td></tr>
<tr>$tccell2 colspan=2>The ratio for staff posts to normal user posts is ".round($pcounts["posts_staff"]/$pcounts["posts_users"],3).".</td></tr>
<tr>$tccell2 colspan=2>Not included were the ".abs($pcounts[posts_banned])." posts shat out by a collective of morons. Depressing.</td></tr>
$tblend
<br>
";
}
*/
print "
$tblstart
<tr>$tccellc colspan=6><b>$desc$timespan</b></td></tr>
<tr>
$tccellh width=30>#</td>
$tccellh colspan=2>Username</td>
$tccellh width=200>Registered on</td>
$tccellh width=130 colspan=2>$column</td>
";
$total = 0;
for($i = 1; $user = $sql->fetch($posters); $i++) {
if($i == 1) $max = $user['cnt'];
if ($user['cnt'] != $oldcnt) $rank = $i;
$oldcnt = $user['cnt'];
$ulink = getuserlink($user);
print "
<tr>
$tccell1>$rank</td>
$tccell1 width=16>". ($user['minipic'] ? "<img src=\"". htmlspecialchars($user['minipic']) ."\" width=16 height=16>" : " ") ."</td>
$tccell2l>{$ulink}</td>
$tccell1>".date($dateformat, $user['regdate'] + $tzoff) ."</td>
$tccell2 width=30><b>". $user['cnt'] ."</b></td>
$tccell2 width=100>". number_format($user['cnt'] / $max * 100, 1) ."%<br><img src=images/minibar.png width=\"". number_format($user['cnt'] / $max * 100) ."%\" align=left height=3> </td>
</tr>";
$total += $user['cnt'];
}
print "
<tr>
$tccellc colspan=6>". ($i - 1) ." users, $total $column2</td>
</tr>
";
print $tblend.$footer;
printtimedif($startingtime);