-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaccsearch.php
More file actions
60 lines (48 loc) · 1.3 KB
/
accsearch.php
File metadata and controls
60 lines (48 loc) · 1.3 KB
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
<?php
$pagetitle = 'Account Search';
require 'common.php';
if (!$logged)
{
$tpl->message = 'You must be logged in to view this page.';
$tpl->Execute('header');
$tpl->Execute('footer');
exit;
}
if (!$GM)
{
$tpl->message = 'You must be a Game Master to view this page.';
$tpl->Execute('header');
$tpl->Execute('footer');
exit;
}
$tpl->Execute('header');
if (isset($_POST['username'],$_POST['computer'],$_POST['hdid']))
{
$hdid = explode('-', $_POST['hdid']);
if (isset($hdid[1]))
{
$hdid = hexdec($hdid[0]) * 0x10000 + hexdec($hdid[1]);
$hdidq = " AND hdid = '".$hdid."'";
}
else
{
$hdidq = "";
}
$username = strtolower($_POST['username']);
$computer = strtoupper($_POST['computer']);
$accounts = $db->SQL("SELECT * FROM accounts WHERE username LIKE '$' AND computer LIKE '$'$hdidq LIMIT 0,100", $username, $computer);
foreach ($accounts as &$account)
{
$account['hdid_str'] = sprintf("%08x", (double)$account['hdid']);
$account['hdid_str'] = strtoupper(substr($account['hdid_str'],0,4).'-'.substr($account['hdid_str'],4,4));
$account['characters'] = count($db->SQL("SELECT 1 FROM `characters` WHERE account = '$'", $account['username']));
}
unset($account);
$tpl->accounts = $accounts;
$tpl->Execute('accsearch_results');
}
else
{
$tpl->Execute('accsearch');
}
$tpl->Execute('footer');