mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 11:19:22 +02:00
Bugfix: Error appearing when no news, username already exist error when creating account TFS 1.0
This commit is contained in:
parent
801e0bcbef
commit
87d09ebe67
@ -150,10 +150,14 @@ function support_list() {
|
||||
// NEWS
|
||||
function fetchAllNews() {
|
||||
$data = mysql_select_multi("SELECT * FROM `znote_news` ORDER BY `id` DESC;");
|
||||
for ($i = 0; $i < count($data); $i++) {
|
||||
$cd = user_character_data($data[$i]['pid'], 'name');
|
||||
$data[$i]['name'] = $cd['name'];
|
||||
unset($data[$i]['pid']);
|
||||
if ($data !== false) {
|
||||
for ($i = 0; $i < count($data); $i++) {
|
||||
$player = mysql_select_single("SELECT `name` FROM `players` WHERE `id`='".$data[$i]['pid']."' LIMIT 1;");
|
||||
if ($player !== false) $data[$i]['name'] = $player['name'];
|
||||
else $data[$i]['name'] = "Player not found.";
|
||||
|
||||
unset($data[$i]['pid']);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
@ -1183,7 +1187,7 @@ function user_create_character($character_data) {
|
||||
$fields_sql = implode("`, `", $fields); // Convert array into SQL compatible string
|
||||
$data_sql = implode("', '", $data); // Convert array into SQL compatible string
|
||||
echo 1;
|
||||
mysql_insert("INSERT INTO `players`(`$fields_sql`) VALUES ('$data_sql');") or die("INSERT ERROR: ". mysql_error());
|
||||
mysql_insert("INSERT INTO `players`(`$fields_sql`) VALUES ('$data_sql');");
|
||||
|
||||
$created = time();
|
||||
$charid = user_character_id($import_data['name']);
|
||||
@ -1340,7 +1344,7 @@ function user_activated($username) {
|
||||
// Checks that username exist in database
|
||||
function user_exist($username) {
|
||||
$username = sanitize($username);
|
||||
$data = mysql_select_single("SELECT COUNT('id') FROM `accounts` WHERE `name`='$username';");
|
||||
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username';");
|
||||
return ($data !== false) ? true : false;
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,20 @@ if (!empty($_POST['selected_delete'])) {
|
||||
}
|
||||
if (user_character_account_id($_POST['selected_delete']) === $session_user_id) {
|
||||
$charid = user_character_id($_POST['selected_delete']);
|
||||
$chr_data = user_character_data($charid, 'online');
|
||||
if ($chr_data['online'] != 1) {
|
||||
if (guild_leader_gid($charid) === false) user_delete_character($charid);
|
||||
else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
|
||||
} else echo 'Character must be offline first.';
|
||||
if ($charid !== false) {
|
||||
if ($config['TFSVersion'] === 'TFS_10') {
|
||||
if (!user_is_online_10($charid)) {
|
||||
if (guild_leader_gid($charid) === false) user_delete_character($charid);
|
||||
else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
|
||||
} echo 'Character must be offline first.';
|
||||
} else {
|
||||
$chr_data = user_character_data($charid, 'online');
|
||||
if ($chr_data['online'] != 1) {
|
||||
if (guild_leader_gid($charid) === false) user_delete_character($charid);
|
||||
else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
|
||||
} else echo 'Character must be offline first.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// end
|
||||
|
Loading…
x
Reference in New Issue
Block a user