This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
forked from Shadez/wowarmory
-
Notifications
You must be signed in to change notification settings - Fork 1
/
character-select-submit.php
74 lines (72 loc) · 3.18 KB
/
character-select-submit.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
<?php
/**
* @package World of Warcraft Armory
* @version Release 4.50
* @revision 450
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**/
define('__ARMORY__', true);
if(!@include('includes/armory_loader.php')) {
die('<b>Fatal error:</b> unable to load system files.');
}
if(!isset($_SESSION['accountId'])) {
exit;
}
if(isset($_GET)) {
$totalCharsCount = $utils->CountSelectedCharacters();
$utils->DropAllSelectedCharacters(true);
for($i = 1; $i < MAX_SELECTED_CHARACTERS_COUNT+1; $i++) {
if(isset($_GET['cn' . $i]) && isset($_GET['r' . $i])) {
$realmName = urldecode($_GET['r' . $i]);
$realm_id = $utils->GetRealmIdByName($realmName);
if(!$realm_id) {
Armory::Log()->writeLog('character-select-submit : realm %s not found in database!', $realmName);
continue;
}
elseif(!isset(Armory::$realmData[$realm_id])) {
Armory::Log()->writeLog('character-select-submit : connection data to realm %s (ID: %d) not found!', $realmName, $realm_id);
continue;
}
$realm_info = Armory::$realmData[$realm_id];
$db = new ArmoryDatabaseHandler($realm_info['host_characters'], $realm_info['user_characters'], $realm_info['pass_characters'], $realm_info['name_characters'], $realm_info['charset_characters']);
if(!$db) {
// Error message will appear in ArmoryDatabaseHandler::ArmoryDatabaseHandler();
continue;
}
$char_data = $db->selectRow("SELECT `guid`, `name`, `class`, `race`, `gender`, `level`, `account` FROM `characters` WHERE `name`='%s' AND `account`=%d LIMIT 1", $utils->escape($_GET['cn' . $i]), $_SESSION['accountId']);
if(!$char_data) {
Armory::Log()->writeLog('character-select-submit : unable to get character data from DB (name: %s, accountId: %d)', $_GET['cn' . $i], $_SESSION['accountId']);
continue;
}
$char_data['realm_id'] = $realm_id;
if(isset($_GET['cn1']) && $i == 1) {
$char_data['selected'] = 1;
}
else {
$char_data['selected'] = $i;
}
$char_data['num'] = $i;
$utils->AddCharacterAsSelected($char_data, $realm_id, $i);
}
}
}
else {
Armory::Log()->writeLog('character-select-submit : $_GET variable not found!');
}
exit;
?>