diff --git a/engine/function/users.php b/engine/function/users.php
index ebbac8d..60a234e 100644
--- a/engine/function/users.php
+++ b/engine/function/users.php
@@ -143,7 +143,18 @@ function support_list03() {
// NEWS
function fetchAllNews() {
- return mysql_select_multi("SELECT `n`.`id`, `n`.`title`, `n`.`text`, `n`.`date`, `p`.`name` FROM `znote_news` AS `n` INNER JOIN `players` AS `p` ON `n`.`pid` = `p`.`id` ORDER BY `n`.`id` DESC;");
+ return mysql_select_multi("
+ SELECT
+ `n`.`id`,
+ `n`.`title`,
+ `n`.`text`,
+ `n`.`date`,
+ `p`.`name`
+ FROM `znote_news` AS `n`
+ INNER JOIN `players` AS `p`
+ ON `n`.`pid` = `p`.`id`
+ ORDER BY `n`.`id` DESC;
+ ");
}
// HOUSES
@@ -640,16 +651,30 @@ function user_character_list($account_id) {
//$count = user_character_list_count($account_id);
$account_id = (int)$account_id;
- if (config('ServerEngine') == 'TFS_10') {
- $characters = mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `p`.`town_id`, `p`.`lastlogin`, `gm`.`rank_id`, `po`.`player_id` AS `online` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `p`.`id`=`gm`.`player_id` LEFT JOIN `players_online` AS `po` ON `p`.`id`=`po`.`player_id` WHERE `p`.`account_id`='$account_id' ORDER BY `p`.`level` DESC");
- if ($characters !== false) {
- for ($i = 0; $i < count($characters); $i++) {
- $characters[$i]['online'] = ($characters[$i]['online'] > 0) ? 1 : 0;
- //unset($characters[$i]['id']);
- }
- }
-
- } else $characters = mysql_select_multi("SELECT `id`, `name`, `level`, `vocation`, `town_id`, `lastlogin`, `online`, `rank_id` FROM `players` WHERE `account_id`='$account_id' ORDER BY `level` DESC");
+ $characters = mysql_select_multi("
+ SELECT
+ `p`.`id`,
+ `p`.`name`,
+ `p`.`level`,
+ `p`.`vocation`,
+ `p`.`town_id`,
+ `p`.`lastlogin`,
+ `gm`.`rank_id`,
+ `zp`.`hide_char`,
+ CASE WHEN `po`.`player_id` IS NULL
+ THEN 0
+ ELSE 1
+ END AS `online`
+ FROM `players` AS `p`
+ LEFT JOIN `guild_membership` AS `gm`
+ ON `p`.`id`=`gm`.`player_id`
+ LEFT JOIN `players_online` AS `po`
+ ON `p`.`id`=`po`.`player_id`
+ LEFT JOIN `znote_players` AS `zp`
+ ON `p`.`id`=`zp`.`player_id`
+ WHERE `p`.`account_id`='{$account_id}'
+ ORDER BY `p`.`level` DESC
+ ");
if ($characters !== false) {
$count = count($characters);
diff --git a/myaccount.php b/myaccount.php
index f2cdcbd..9111dfc 100644
--- a/myaccount.php
+++ b/myaccount.php
@@ -5,7 +5,15 @@ include 'layout/overall/header.php';
$undelete_id = @$_GET['cancel_delete_id'];
if($undelete_id) {
$undelete_id = (int)$undelete_id;
- $undelete_q1 = mysql_select_single('SELECT `character_name` FROM `znote_deleted_characters` WHERE `done` = 0 AND `id` = ' . $undelete_id . ' AND `original_account_id` = ' . $session_user_id . ' AND NOW() < `time`');
+ $undelete_q1 = mysql_select_single("
+ SELECT
+ `character_name`
+ FROM `znote_deleted_characters`
+ WHERE `done` = 0
+ AND `id` = {$undelete_id}
+ AND `original_account_id` = {$session_user_id}
+ AND NOW() < `time`
+ ");
if($undelete_q1) {
mysql_delete('DELETE FROM `znote_deleted_characters` WHERE `id` = ' . $undelete_id);
echo 'Pending delete of ' . $undelete_q1['character_name'] . ' has been successfully canceled.
';
@@ -93,7 +101,7 @@ if (!empty($_POST['selected_character'])) {
switch($action) {
// Change character comment PAGE2 (Success).
case 'update_comment':
- if (user_character_account_id($char_name) === $session_user_id) {
+ if ((int)user_character_account_id($char_name) === $session_user_id) {
user_update_comment(user_character_id($char_name), getValue($_POST['comment']));
echo 'Successfully updated comment.';
}
@@ -103,7 +111,7 @@ if (!empty($_POST['selected_character'])) {
// Hide character
case 'toggle_hide':
$hide = (user_character_hide($char_name) == 1 ? 0 : 1);
- if (user_character_account_id($char_name) === $session_user_id) {
+ if ((int)user_character_account_id($char_name) === $session_user_id) {
user_character_set_hide(user_character_id($char_name), $hide);
}
break;
@@ -111,21 +119,13 @@ if (!empty($_POST['selected_character'])) {
// DELETE character
case 'delete_character':
- if (user_character_account_id($char_name) === $session_user_id) {
+ if ((int)user_character_account_id($char_name) === $session_user_id) {
$charid = user_character_id($char_name);
if ($charid !== false) {
- if ($config['ServerEngine'] === 'TFS_10') {
- if (!user_is_online_10($charid)) {
- if (guild_leader_gid($charid) === false) user_delete_character_soft($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.';
- } else {
- $chr_data = user_character_data($charid, 'online');
- if ($chr_data['online'] != 1) {
- if (guild_leader_gid($charid) === false) user_delete_character_soft($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 (!user_is_online_10($charid)) {
+ if (guild_leader_gid($charid) === false) user_delete_character_soft($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.';
}
}
break;
@@ -137,10 +137,8 @@ if (!empty($_POST['selected_character'])) {
$newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';
$player = false;
- if ($config['ServerEngine'] === 'TFS_10') {
- $player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'");
- $player['online'] = (user_is_online_10($player['id'])) ? 1 : 0;
- } else $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '$oldname'");
+ $player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'");
+ $player['online'] = (user_is_online_10($player['id'])) ? 1 : 0;
// Check if user is online
if ($player['online'] == 1) {
@@ -204,13 +202,11 @@ if (!empty($_POST['selected_character'])) {
// Change character sex
case 'change_gender':
- if (user_character_account_id($char_name) === $session_user_id) {
+ if ((int)user_character_account_id($char_name) === $session_user_id) {
$char_id = (int)user_character_id($char_name);
$account_id = user_character_account_id($char_name);
- if ($config['ServerEngine'] == 'TFS_10') {
- $chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
- } else $chr_data = user_character_data($char_id, 'online');
+ $chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
if ($chr_data['online'] != 1) {
// Verify that we are not messing around with data
if ($account_id != $user_data['id']) die("wtf? Something went wrong, try relogging.");
@@ -254,7 +250,7 @@ if (!empty($_POST['selected_character'])) {
// Change character comment PAGE1:
case 'change_comment':
$render_page = false; // Regular "myaccount" page should not render
- if (user_character_account_id($char_name) === $session_user_id) {
+ if ((int)user_character_account_id($char_name) === $session_user_id) {
$comment_data = user_znote_character_data(user_character_id($char_name), 'comment');
?>
@@ -303,21 +299,12 @@ if ($render_page) {
?>
Welcome to your account page,
- Welcome to your account page,
+
Email:
Account security with Two-factor Authentication:
NAME | LEVEL | VOCATION | TOWN | LAST LOGIN | STATUS | HIDE | +NAME | +LEVEL | +VOCATION | +TOWN | +LAST LOGIN | +STATUS | +HIDE | '. $value['name'] .' | '. $value['level'] .' | '. $value['vocation'] .' | '. $value['town_id'] .' | '. $value['lastlogin'] .' | '. $value['online'] .' | '. hide_char_to_name(user_character_hide($value['name'])) .' | '; - echo ''; - $characters[] = $value['name']; - } - ?> + foreach ($char_array as $value): ?> +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | + | + | + | + | + | + |