forked from Xkeeper0/jul
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin-useragents.php
82 lines (67 loc) · 2.3 KB
/
admin-useragents.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
<?php
require "lib/common.php";
admincheck();
load_layout();
$_GET['id'] = filter_int($_GET['id']);
$_GET['page'] = filter_int($_GET['page']);
if ($_GET['id']) {
$baseurl = "?id={$_GET['id']}";
$qwhere = "WHERE l.user = {$_GET['id']}";
$userfor = " for ".getuserlink(null, $_GET['id']);
} else {
$baseurl = "?";
$qwhere = "";
$userfor = "";
}
if (isset($_GET['ppp'])) {
$ppp = numrange($_GET['ppp'], 1, 100);
$baseurl .= "&ppp={$ppp}";
} else {
$ppp = 25;
}
$min = $ppp * $_GET['page'];
$items = $sql->query("
SELECT l.*, {$userfields} uid
FROM log_useragent l
LEFT JOIN users u ON l.user = u.id
{$qwhere}
ORDER BY l.lastchange DESC
LIMIT {$min}, {$ppp}
");
$total = $sql->resultq("SELECT COUNT(*) FROM log_useragent l {$qwhere}");
$pagelinks = "<span class='fonts'>".pagelist($baseurl, $total, $ppp)."</span>";
$txt = "";
foreach ($items as $x) {
$ip = htmlspecialchars($x['ip']);
$txt .= "
<tr>
<td class='tdbg1 center'>{$x['id']}</td>
<td class='tdbg2 center'>".($x['uid'] ? getuserlink($x, $x['uid']) : "<i>Guest</i>")."</td>
<td class='tdbg2 center'>".printdate($x['creationdate'])."</td>
<td class='tdbg2 center'>".printdate($x['lastchange'])."</td>
<td class='tdbg1 center'><a href=\"admin-ipsearch.php?ip={$ip}\">{$ip}</a></td>
<td class='tdbg1 fonts'>".escape_html($x['useragent'])."</td>
</tr>";
}
pageheader("User Agent History");
print adminlinkbar();
if (!$config['log-useragents'])
print boardmessage("User agent logging is disabled.", "Notice");
?>
<form method='GET' class='font right'>Select user: <?= user_select('id', $_GET['id'], null, "*** All users ***") ?> <button type='submit'>Search</button></form>
<?= $pagelinks ?>
<table class='table'>
<tr><td class='tdbgh center b' colspan='6'>User agent history<?= $userfor ?></td></tr>
<tr>
<td class='tdbgc center b' style='width: 50px'>#</td>
<td class='tdbgc center b'>User</td>
<td class='tdbgc center b' style='width: 200px'>First activity</td>
<td class='tdbgc center b' style='width: 200px'>Last login</td>
<td class='tdbgc center b' style='width: 200px'>Last IP</td>
<td class='tdbgc center b'>User Agent</td>
</tr>
<?= $txt ?>
</table>
<?= $pagelinks ?>
<?php
pagefooter();