This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
c.php
73 lines (60 loc) · 1.86 KB
/
c.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
<?php
/**
* WoWRoster.net WoWRoster
*
* Short URL link for characters
*
* @copyright 2002-2011 WoWRoster.net
* @license http://www.gnu.org/licenses/gpl.html Licensed under the GNU General Public License v3.
* @package WoWRoster
*/
define('IN_ROSTER', true);
/**
* Set the relative URL here. Use slashes, not backslashes. Use slash in front
* and omit the one at the end. If your windows server does not accept slashes
* in pathnames set the include statement seperately.
*/
$roster_rel = '';
$_GET[ROSTER_PAGE] = 'dummy';
// Environment
include ('.' . $roster_rel . '/settings.php');
// Get the char from the query string. To keep the link as short as
// possible, we don't use member= or anything like that
$char = $roster->db->escape(urldecode($_SERVER['QUERY_STRING']));
if( is_numeric($char) )
{
$where = ' `member_id` = "' . $char . '"';
}
elseif( strpos($char, '@') !== false )
{
list($name, $realm) = explode('@', $char);
if( strpos($realm, '-') !== false )
{
list($region, $realm) = explode('-', $realm);
$where = ' `name` = "' . $name . '" AND `server` = "' . $realm . '" AND `region` = "' . strtoupper($region) . '"';
}
else
{
$where = ' `name` = "' . $name . '" AND `server` = "' . $realm . '"';
}
}
else
{
$name = $char;
$where = ' `name` = "' . $name . '"';
}
// Check if there's a character with this name
$query = "SELECT `member_id` FROM `" . $roster->db->table('members') . "` WHERE $where;";
$result = $roster->db->query($query);
if( !$result )
{
die_quietly($roster->db->error(), 'Roster Autopointer', __FILE__, __LINE__, $query);
}
if( $row = $roster->db->fetch($result) )
{
$roster->db->free_result($result);
header('Location: ' . str_replace('&', '&', makelink('char-info&a=c:' . $row['member_id'], true)));
exit();
}
// There's no char with that name? Redirect to guild page.
header('Location: ' . ROSTER_URL . $roster_rel);