-
Notifications
You must be signed in to change notification settings - Fork 0
/
lastknownbrowsers.php
146 lines (135 loc) · 2.61 KB
/
lastknownbrowsers.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
<?php
include("lib/common.php");
$title = "Last known browsers";
$isMod = $loguser['powerlevel'] > 0;
$sort = "id asc";
$ual = "?";
if(isset($_GET['byua']))
{
$sort = "lastknownbrowser asc";
$ual .= "byua&";
}
AssertForbidden("viewLKB");
$numUsers = FetchResult("select count(*) from users", 0, 0);
$ppp = $loguser['postsperpage'];
if($ppp<1) $ppp=50;
if(isset($_GET['from']))
$from = (int)$_GET['from'];
else
$from = 0;
$peeps = Query("select id, name, displayname, lastip, lastknownbrowser, sex, powerlevel from users where powerlevel < 5 order by ".$sort." limit ".$from.", ".$ppp);
$numonpage = NumRows($peeps);
for($i = $ppp; $i < $numUsers; $i+=$ppp)
{
if($i == $from)
$pagelinks .= " ".(($i/$ppp)+1);
else
$pagelinks .= " <a href=\"lastknownbrowsers.php".$ual."from=".$i."\">".(($i/$ppp)+1)."</a>";
}
if($pagelinks)
{
if($from == 0)
$pagelinks = "1".$pagelinks;
else
$pagelinks = "<a href=\"lastknownbrowsers.php".$ual."\">1</a>".$pagelinks;
Write("<div class=\"smallFonts pages\">".__("Pages:")." {0}</div>", $pagelinks);
}
if($isMod)
$format = "
<tr class=\"cell{0}\">
<td>
{1}
</td>
<td>
{2}
</td>
<td>
{3}
</td>
<td>
{4}
</td>
<td>
{5}
</td>
</tr>
";
else
$format = "
<tr class=\"cell{0}\">
<td>
{1}
</td>
<td>
{2}
</td>
<td>
{3}
</td>
<td>
{5}
</td>
</tr>
";
$items = "";
while($user = Fetch($peeps))
{
$bucket = "userMangler"; include("./lib/pluginloader.php");
$lip = $user['lastip'];
$lkb = $user['lastknownbrowser'];
if(isset($_GET['showfull']))
$lkb = str_replace("-->", "", str_replace("<!--", " —", $lkb));
$cellClass = ($cellClass+1) % 2;
$items .= format($format, $cellClass, $user['id'], UserLink($user), IP2C($lip), $lip, $lkb);
}
if($isMod)
write("
<table class=\"outline margin\">
<tr class=\"header1\">
<th>
".__("ID")."
</th>
<th>
".__("Name")."
</th>
<th>
</th>
<th>
".__("IP")."
</th>
<th>
".__("Last known browser")."
</th>
</tr>
{0}
</table>
", $items);
else
write("
<table class=\"outline margin\">
<tr class=\"header1\">
<th>
".__("ID")."
</th>
<th>
".__("Name")."
</th>
<th>
</th>
<th>
".__("Last known browser")."
</th>
</tr>
{0}
</table>
", $items);
function IP2C($ip)
{
$q = @mysql_query("select cc from ip2c where ip_from <= inet_aton('".$ip."') and ip_to >= inet_aton('".$ip."')") or $r['cc'] = "";
if($q) $r = @mysql_fetch_array($q);
if($r['cc'])
return " <img src=\"img/flags/".strtolower($r['cc']).".png\" alt=\"".$r['cc']."\" title=\"".$r['cc']."\" />";
}
?>