-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcharsearch.php
More file actions
58 lines (47 loc) · 1.49 KB
/
charsearch.php
File metadata and controls
58 lines (47 loc) · 1.49 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
<?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['name']))
{
$name = strtolower($_POST['name']);
$characters = $db->SQL("SELECT * FROM characters WHERE name LIKE '$' LIMIT 0,100", $name);
foreach ($characters as &$character)
{
$character['name'] = ucfirst($character['name']);
$character['gender'] = $character['gender']?'Male':'Female';
$character['title'] = empty($character['title'])?'-':ucfirst($character['title']);
$character['exp'] = number_format($character['exp']);
switch ($character['admin'])
{
case ADMIN_PLAYER: $character['admin_str'] = 'Player'; break;
case ADMIN_GUIDE: $character['admin_str'] = 'Light Guide'; $character['gm'] = true; break;
case ADMIN_GUARDIAN: $character['admin_str'] = 'Guardian'; $character['gm'] = true; break;
case ADMIN_GM: $character['admin_str'] = 'Game Master'; $character['gm'] = true; break;
case ADMIN_HGM: $character['admin_str'] = 'High Game Master'; $character['gm'] = true; break;
default: $character['admin_str'] = 'Unknown'; break;
}
}
unset($character);
$tpl->characters = $characters;
$tpl->Execute('charsearch_results');
}
else
{
$tpl->Execute('charsearch');
}
$tpl->Execute('footer');