forked from Shadez/wowarmory
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcharacter-select-submit.php
69 lines (67 loc) · 3.17 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
<?php
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 198
* @copyright (c) 2009-2010 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 = $armory->aDB->selectCell("SELECT COUNT(`guid`) FROM `armory_login_characters` WHERE `account`=?d", $_SESSION['accountId']);
$delete_query = sprintf("DELETE FROM `armory_login_characters` WHERE `account`='%d'", $_SESSION['accountId']);
$armory->aDB->query($delete_query);
for($i = 1; $i < 4; $i++) {
if(isset($_GET['cn' . $i]) && isset($_GET['r' . $i])) {
$realmName = urldecode($_GET['r' . $i]);
$realm_data = $armory->aDB->selectRow("SELECT `id`, `name` FROM `armory_realm_data` WHERE `name`=? LIMIT 1", $realmName);
if(!$realm_data) {
continue;
}
elseif(!isset($armory->realmData[$realm_data['id']])) {
continue;
}
$armory->connectionData = $armory->realmData[$realm_data['id']];
$db = DbSimple_Generic::connect('mysql://'.$armory->connectionData['user_characters'].':'.$armory->connectionData['pass_characters'].'@'.$armory->connectionData['host_characters'].'/'.$armory->connectionData['name_characters']);
if(!$db) {
continue;
}
$char_data = $db->selectRow("SELECT `guid`, `name`, `class`, `race`, `gender`, `level`, `account` FROM `characters` WHERE `name`=? AND `account`=?d LIMIT 1", $utils->escape($_GET['cn' . $i]), $_SESSION['accountId']);
if(!$char_data) {
continue;
}
$char_data['realm_id'] = $realm_data['id'];
if(isset($_GET['cn1']) && $i == 1) {
$char_data['selected'] = 1;
}
else {
$char_data['selected'] = $i;
}
$char_data['num'] = $i;
$add_query = sprintf("INSERT INTO `armory_login_characters` VALUES (%d, %d, %d, '%s', %d, %d, %d, %d, %d, %d)", $char_data['account'], $i, $char_data['guid'], $char_data['name'], $char_data['class'], $char_data['race'], $char_data['gender'], $char_data['level'], $realm_data['id'], $char_data['selected']);
$armory->aDB->query($add_query);
}
}
}
exit;
?>