• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Znote_accounts add table

Jfrye

Mapper, trying to learn scripting
Joined
Jan 8, 2009
Messages
365
Solutions
5
Reaction score
86
Location
Mexico Missouri
I was wandering if anyone could tell me how to add a table to znote_accounts called owner name or player name.

Just wanting to add a small little personal preference to the layout.

I think it goes something like this, but Im honestly not sure as Im still trying to learn all this stuff.

Code:
ALTER TABLE `znote_accounts` ADD `player_name`

EDIT : Im using Znote 1.5
EDIT 2 : Im trying to add a more personal touch to the myaccounts.php page. So if I can add this table to the database, will it read a normal name? like player name= Justin
 
Solution
In the database, you can do this query to add a text field to the znote_accounts row:
SQL:
ALTER TABLE `znote_accounts` ADD `player_name` VARCHAR(30) NOT NULL DEFAULT '' AFTER `flag`;
You can set varchar(30) to (20) or something else to allow players to use more or less characters in their name.

Database structure done.

Then we need to tell Znote AAC to load this resource from db:
ZnoteAAC/init.php at master · Znote/ZnoteAAC · GitHub
PHP:
$user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag', 'player_name');
(add , 'player_name' to the end of the function param of user_znote_account_data).

Var loading from DB done.

($user_data contains current loggedin info from the...
SQL:
ALTER TABLE `znote_accounts` ADD `player_name` VARCHAR(30) NOT NULL DEFAULT '' AFTER `flag`;

You can set varchar(30) to (20) or something else to allow players to use more or less characters in their name.
 
Last edited by a moderator:
Thank you. will I use something like this to update the database column now?

Code:
'player_name' =>  $_POST['player_name']

Here is the register.php if its needed.
Code:
<?php
require_once 'engine/init.php';
logged_in_redirect();
include 'layout/overall/header.php';

if (empty($_POST) === false) {
    // $_POST['']
    $required_fields = array('username', 'password', 'password_again', 'email', 'selected');
    foreach($_POST as $key=>$value) {
        if (empty($value) && in_array($key, $required_fields) === true) {
            $errors[] = 'You need to fill in all fields.';
            break 1;
        }
    }
   
    // check errors (= user exist, pass long enough
    if (empty($errors) === true) {
        /* Token used for cross site scripting security */
        if (!Token::isValid($_POST['token'])) {
            $errors[] = 'Token is invalid.';
        }

        if ($config['use_captcha']) {
            include_once 'captcha/securimage.php';
            $securimage = new Securimage();
            if ($securimage->check($_POST['captcha_code']) == false) {
             $errors[] = 'Captcha image verification was submitted wrong.';
            }
        }
       
        if (user_exist($_POST['username']) === true) {
            $errors[] = 'Sorry, that username already exist.';
        }
       
        // Don't allow "default admin names in config.php" access to register.
        $isNoob = in_array(strtolower($_POST['username']), $config['page_admin_access']) ? true : false;
        if ($isNoob) {
            $errors[] = 'This account name is blocked for registration.';
        }
        if (strtolower($_POST['username']) === true) {
            $errors[] = 'Sorry, that username already exist.';
        }
        if (preg_match("/^[a-zA-Z0-9]+$/", $_POST['username']) == false) {
            $errors[] = 'Your account name can only contain characters a-z, A-Z and 0-9.';
        }
        // name restriction
        $resname = explode(" ", $_POST['username']);
        foreach($resname as $res) {
            if(in_array(strtolower($res), $config['invalidNameTags'])) {
                $errors[] = 'Your username contains a restricted word.';
            }
            else if(strlen($res) == 1) {
                $errors[] = 'Too short words in your name.';
            }
        }
        // end name restriction
        if (strlen($_POST['password']) < 6) {
            $errors[] = 'Your password must be at least 6 characters.';
        }
        if (strlen($_POST['password']) > 100) {
            $errors[] = 'Your password must be less than 100 characters.';
        }
        if ($_POST['password'] !== $_POST['password_again']) {
            $errors[] = 'Your passwords do not match.';
        }
        if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
            $errors[] = 'A valid email address is required.';
        }
        if (user_email_exist($_POST['email']) === true) {
            $errors[] = 'That email address is already in use.';
        }
        if ($_POST['selected'] != 1) {
            $errors[] = 'You are only allowed to have an account if you accept the rules.';
        }
        if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
            $errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
        }
    }
}

?>
<h1>Register Account</h1>
<?php
if (isset($_GET['success']) && empty($_GET['success'])) {
    if ($config['mailserver']['register']) {
        ?>
        <h1>Email authentication required</h1>
        <p>We have sent you an email with an activation link to your submitted email address.</p>
        <p>If you can't find the email within 5 minutes, check your junk/trash inbox as it may be mislocated there.</p>
        <?php
    } else echo 'Congratulations! Your account has been created. You may now login to create a character.';
} elseif (isset($_GET['authenticate']) && empty($_GET['authenticate'])) {
    // Authenticate user, fetch user id and activation key
    $auid = (isset($_GET['u']) && (int)$_GET['u'] > 0) ? (int)$_GET['u'] : false;
    $akey = (isset($_GET['k']) && (int)$_GET['k'] > 0) ? (int)$_GET['k'] : false;
    // Find a match
    $user = mysql_select_single("SELECT `id` FROM `znote_accounts` WHERE `account_id`='$auid' AND `activekey`='$akey' AND `active`='0' LIMIT 1;");
    if ($user !== false) {
        $user = $user['id'];
        // Enable the account to login
        mysql_update("UPDATE `znote_accounts` SET `active`='1' WHERE `id`='$user' LIMIT 1;");
        echo '<h1>Congratulations!</h1> <p>Your account has been created. You may now login to create a character.</p>';
    } else {
        echo '<h1>Authentication failed</h1> <p>Either the activation link is wrong, or your account is already activated.</p>';
    }
} else {
    if (empty($_POST) === false && empty($errors) === true) {
        if ($config['log_ip']) {
            znote_visitor_insert_detailed_data(1);
        }
       
        //Register
        $register_data = array(
            'name'        =>    $_POST['username'],
            'password'    =>    $_POST['password'],
            'email'        =>    $_POST['email'],
            'created'    =>    time(),
            'ip'        =>    ip2long(getIP()),
            'flag'        =>     $_POST['flag'],
            'player_name' =>  $_POST['player_name']
        );
       
        user_create_account($register_data, $config['mailserver']);
        if (!$config['mailserver']['debug']) header('Location: register.php?success');
        exit();
        //End register
       
    } else if (empty($errors) === false){
        echo '<font color="red"><b>';
        echo output_errors($errors);
        echo '</b></font>';
    }
?>
    <form action="" method="post">
        <ul>
            <li>
                Account Name:<br>
                <input type="text" name="username">
            </li>
            <li>
                Password:<br>
                <input type="password" name="password">
            </li>
            <li>
                Password again:<br>
                <input type="password" name="password_again">
            </li>
            <li>
                Email:<br>
                <input type="text" name="email">
            </li>

            <?php
            if ($config['use_captcha']) {
                ?>
                <li>
                    <b>Write the image symbols in the text field to verify that you are a human:</b>
                    <img id="captcha" src="captcha/securimage_show.php" alt="CAPTCHA Image" /><br>
                    <input type="text" name="captcha_code" size="10" maxlength="6" />
                    <a href="#" onclick="document.getElementById('captcha').src = 'captcha/securimage_show.php?' + Math.random(); return false">[ Different Image ]</a><br><br>
                </li>
                <?php
            }
            ?>
            <li>
                <h2>Server Rules</h2>
                <p>The golden rule: Have fun.</p>
                <p>If you get pwn3d, don't hate the game.</p>
                <p>No <a href='http://en.wikipedia.org/wiki/Cheating_in_video_games' target="_blank">cheating</a> allowed.</p>
                <p>No <a href='http://en.wikipedia.org/wiki/Video_game_bot' target="_blank">botting</a> allowed.</p>
                <p>The staff can delete, ban, do whatever they want with your account and your <br>
                    submitted information. (Including exposing and logging your IP).</p>
                <p></p>
            </li>
            <li>
                Do you agree to follow the server rules?<br>
                <select name="selected">
                 <option value="0">Umh...</option>
                 <option value="1">Yes.</option>
                 <option value="2">No.</option>
                </select>
            </li>
            <?php
                /* Form file */
                Token::create();
            ?>
            <li>
                <input type="submit" value="Create Account">
            </li>
        </ul>
    </form>
<?php 
}
include 'layout/overall/footer.php';
?>
 
Well your going to have to edit when they make an account. Have them put their name too. That's in the createaccount.php file....

Make sure you set it to player_name and you can use this:

Open www/engine/function/users.php

and replace: function user_create_account (cnt + f to find)

with this:

Code:
// CREATE ACCOUNT
function user_create_account($register_data, $maildata) {
    array_walk($register_data, 'array_sanitize');
   
    if (config('TFSVersion') == 'TFS_03' && config('salt') === true) {
        $register_data['salt'] = generate_recovery_key(18);
        $register_data['password'] = sha1($register_data['salt'].$register_data['password']);
    } else $register_data['password'] = sha1($register_data['password']);
   
    $ip = $register_data['ip'];
    $created = $register_data['created'];
    $flag = $register_data['flag'];
    $player_name = $register_data['player_name'];
   
    unset($register_data['ip']);
    unset($register_data['created']);
    unset($register_data['flag']);
    unset($register_data['player_name']);
   
    if (config('TFSVersion') == 'TFS_10') $register_data['creation'] = $created;

    $fields = '`'. implode('`, `', array_keys($register_data)) .'`';
    $data = '\''. implode('\', \'', $register_data) .'\'';

    mysql_insert("INSERT INTO `accounts` ($fields) VALUES ($data)");
   
    $account_id = user_id($register_data['name']);
    $activeKey = rand(100000000,999999999);
    $active = ($maildata['register']) ? 0 : 1;
    mysql_insert("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`, `active`, `activekey`, `flag`, `player_name`) VALUES ('$account_id', '$ip', '$created', '$active', '$activeKey', '$flag', '$player_name')");
   
    if ($maildata['register']) {

        $thisurl = config('site_url') . "$_SERVER[REQUEST_URI]";
        $thisurl .= "?authenticate&u=".$account_id."&k=".$activeKey;

        $mailer = new Mail($maildata);

        $title = "Please authenticate your account at $_SERVER[HTTP_HOST].";
       
        $body = "<h1>Please click on the following link to authenticate your account:</h1>";
        $body .= "<p><a href='$thisurl'>$thisurl</a></p>";
        $body .= "<p>Thank you for registering and enjoy your stay at $maildata[fromName].</p>";
        $body .= "<hr><p>I am an automatic no-reply e-mail. Any emails sent back to me will be ignored.</p>";
       
        $mailer->sendMail($register_data['email'], $title, $body, $register_data['name']);
    }
}
 
Thank you again. I will try this tomorrow. As for now I am trying to test how to recall the column from znote_accounts, and it only displays S and not the field value.

I obviously did something wrong, since it does not show the right information. Im sure its right infront of my face, but as I said, Im still trying to learn this stuff.

Code:
<?php
                $name = "SELECT `player_name` FROM `znote_accounts` WHERE `player_name='$name'"; ?>
                    <font color="#eee8dc" size="3"><center>Welcome to your account page, <?php echo $name['player_name']; ?></font>

I tried it this way bc I cannot figure out how to use $znote_acc_data['player_name']. That didnt work either bc it showed nothing. I also tried $znote_account_data $user_data $znote_data and all showed blank
 
Sorry about that. I wasnt thinking.

EDIT : The line Im working on is at 244

Code:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';
#region CANCEL CHARACTER DELETE
$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`');
    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 cancelled.<br/>';
    }
}
#endregion

// Variable used to check if main page should be rendered after handling POST (Change comment page)
$render_page = true;

// Handle POST
if (!empty($_POST['selected_character'])) {
    if (!empty($_POST['action'])) {
        // Validate token
        if (!Token::isValid($_POST['token'])) {
            exit();
        }
        // Sanitize values
        $action = getValue($_POST['action']);
        $char_name = getValue($_POST['selected_character']);

        // Handle actions
        switch($action) {
            // Change character comment PAGE2 (Success).
            case 'update_comment':
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_update_comment(user_character_id($char_name), getValue($_POST['comment']));
                    echo 'Successfully updated comment.';
                }
                break;
            // end

            // Hide character
            case 'toggle_hide':
                $hide = (user_character_hide($char_name) == 1 ? 0 : 1);
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_character_set_hide(user_character_id($char_name), $hide);
                }
                break;
            // end

            // DELETE character
            case 'delete_character':
                if (user_character_account_id($char_name) === $session_user_id) {
                    $charid = user_character_id($char_name);
                    if ($charid !== false) {
                        if ($config['TFSVersion'] === '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.';
                        }
                    }
                }
                break;
            // end

            // CHANGE character name
            case 'change_name':
                $oldname = $char_name;
                $newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';

                $player = false;
                if ($config['TFSVersion'] === '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'");

                // Check if user is online
                if ($player['online'] == 1) {
                    $errors[] = 'Character must be offline first.';
                }

                // Check if player has bough ticket
                $accountId = $player['account_id'];
                $order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' AND `account_id` = '$accountId' LIMIT 1;");
                if ($order === false) {
                    $errors[] = 'Did not find any name change tickets, buy them in our <a href="shop.php">shop!</a>';
                }

                // Check if player and account matches
                if ($session_user_id != $accountId || $session_user_id != $order['account_id']) {
                    $errors[] = 'Failed to sync your account. :|';
                }

                $newname = validate_name($newname);
                if ($newname === false) {
                    $errors[] = 'Your name can not contain more than 2 words.';
                } else {
                    if (empty($newname)) {
                        $errors[] = 'Please enter a name!';
                    } else if (user_character_exist($newname) !== false) {
                        $errors[] = 'Sorry, that character name already exist.';
                    } else if (!preg_match("/^[a-zA-Z_ ]+$/", $newname)) {
                        $errors[] = 'Your name may only contain a-z, A-Z and spaces.';
                    } else if (strlen($newname) < $config['minL'] || strlen($newname) > $config['maxL']) {
                        $errors[] = 'Your character name must be between ' . $config['minL'] . ' - ' . $config['maxL'] . ' characters long.';
                    } else if (!ctype_upper($newname{0})) {
                        $errors[] = 'The first letter of a name has to be a capital letter!';
                    }

                    // name restriction
                    $resname = explode(" ", $_POST['newName']);
                    foreach($resname as $res) {
                        if(in_array(strtolower($res), $config['invalidNameTags'])) {
                            $errors[] = 'Your username contains a restricted word.';
                        } else if(strlen($res) == 1) {
                            $errors[] = 'Too short words in your name.';
                        }
                    }
                }

                if (!empty($newname) && empty($errors)) {
                    echo 'You have successfully changed your character name to ' . $newname . '.';
                    mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
                    mysql_delete("DELETE FROM `znote_shop_orders` WHERE `id`='".$order['id']."' LIMIT 1;");

                } else if (!empty($errors)) {
                    echo '<font color="red"><b>';
                    echo output_errors($errors);
                    echo '</b></font>';
                }

                break;
            // end

            // Change character sex
            case 'change_gender':
                if (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['TFSVersion'] == 'TFS_10') {
                        $chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
                    } else $chr_data = user_character_data($char_id, 'online');
                    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.");

                        // Fetch character tickets
                        $tickets = shop_account_gender_tickets($account_id);
                        if ($tickets !== false || $config['free_sex_change'] == true) {
                            // They are allowed to change gender
                            $last = false;
                            $infinite = false;
                            $tks = 0;
                            // Do we have any infinite tickets?
                            foreach ($tickets as $ticket) {
                                if ($ticket['count'] == 0) $infinite = true;
                                else if ($ticket > 0 && $infinite === false) $tks += (int)$ticket['count'];
                            }
                            if ($infinite === true) $tks = 0;
                            $dbid = (int)$tickets[0]['id'];
                            // If they dont have unlimited tickets, remove a count from their ticket.
                            if ($tickets[0]['count'] > 1) { // Decrease count
                                $tks--;
                                $tkr = ((int)$tickets[0]['count'] - 1);
                                shop_update_row_count($dbid, $tkr);
                            } else if ($tickets[0]['count'] == 1) { // Delete record
                                shop_delete_row_order($dbid);
                                $tks--;
                            }

                            // Change character gender:
                            //
                            user_character_change_gender($char_name);
                            echo 'You have successfully changed gender on character '. $char_name .'.';
                            if ($tks > 0) echo '<br>You have '. $tks .' gender change tickets left.';
                            else if ($infinite !== true) echo '<br>You are out of tickets.';
                        } else echo 'You don\'t have any character gender tickets, buy them in the <a href="shop.php">SHOP</a>!';
                    } else echo 'Your character must be offline.';
                }
                break;
            // end

            // 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) {
                    $comment_data = user_znote_character_data(user_character_id($char_name), 'comment');
                    ?>
                    <!-- Changing comment MARKUP -->
                    <h1>Change comment on:</h1>
                    <form action="" method="post">
                        <ul>
                            <li>
                                <input name="action" type="hidden" value="update_comment">
                                <input name ="selected_character" type="text" value="<?php echo $char_name; ?>" readonly="readonly">
                            </li>
                            <li>
                                <font class="profile_font" name="profile_font_comment">Comment:</font> <br>
                                <textarea name="comment" cols="70" rows="10"><?php echo $comment_data['comment']; ?></textarea>
                            </li>
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <li><input type="submit" value="Update Comment"></li>
                        </ul>
                    </form>
                    <?php
                }
                break;
            //end
        }
    }
}

if ($render_page) {
    $char_count = user_character_list_count($session_user_id);
    $pending_delete = user_pending_deletes($session_user_id);
    if ($pending_delete) {
        foreach($pending_delete as $delete) {
            if(new DateTime($delete['time']) > new DateTime())
                echo '<b>CAUTION!</b> Your character with name <b>' . $delete['character_name'] . ' will be deleted on ' . $delete['time'] . '</b>. <a href="myaccount.php?cancel_delete_id=' . $delete['id'] . '">Cancel this operation.</a><br/>';
            else {
                user_delete_character(user_character_id($delete['character_name']));
                mysql_update('UPDATE `znote_deleted_characters` SET `done` = 1 WHERE `id` = '. $delete['id']. '');
                echo '<b>Character ' . $delete['character_name'] . ' has been deleted</b>. This operation was requested by owner of this account.';
                $char_count--;
            }
        }
    }

    ?>
    <div id="myaccount">
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000"><?php
                $name = "SELECT `player_name` FROM `znote_accounts` WHERE `player_name='$name'"; ?>
                    <font color="#eee8dc" size="3"><center>Welcome to your account page, <?php echo $name['player_name']; ?></font>
                </td>
            </tr>
            <tr>  
                <td bgcolor="#eee8dc">
                    <center><font color="black" >Balance of Premium Time: <b><?php echo $user_data['premdays']; ?> </b>
                </td>
            </tr>
            <tr>
                <td bgcolor="#eee8dc"><?php
                $sql = "SELECT `creation` FROM `players` as p LEFT JOIN `accounts` as a on p.account_id = a.id WHERE p.id='$user_id'";
                $creation_t = mysql_select_single($sql)["creation"];
                //$creation_t = date('m/d/Y', $creation_t);                ?>
                    <font color="black"><center>Created: <b><font color="black"><?php echo getClock($creation_t); ?></font>
                </td>
              
            </tr>
              
        </table>
        <table width="100%" border="0" cellspacing="1" cellpadding="4">  
            <tr>
                <td width="100%">
                  
              
                    <center><a href="changepassword.php"><img src="layout/images/buttons/changepass.png" align="center"></a>
          
                    <a href="recover.php"><img src="layout/images/buttons/lostacc.png" align="right"></a>
                <br>
              
                </td>
            </tr>
        </table>  
        <br>
        <br>
        <br>
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000">
                    <font color="#eee8dc" size="3"><center>Characters</font>
                </td>
            </tr>
        <?php
        // Echo character list!
        $char_array = user_character_list($user_data['id']);
        // Design and present the list
        if ($char_array) {
            ?>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td bgcolor="#800000" width="10%"></td>
                <td bgcolor="#800000" width="50%">
                    <b><font color="#eee8dc"><center>Name</center></font></b>
  
                </td>
                <td bgcolor="#800000" width="30%">
                    <b><font color="#eee8dc"><center>Status</center></font></b>
                </td>
              

            </tr>
          
    </table>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
                <?php
                $characters = array();
                $counter = 1;
                foreach ($char_array as $value)

                {
                    // characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online

                    echo '<tr>';
                    echo '<td width="10%" bgcolor="#eee8dc"><font color="black"><center>'. $counter .'.</font></td>';
                    echo '<td width="50%" bgcolor="#eee8dc"><font color="black">'. $value['name'] .'<br></a>'. $value['level'] .' - '. $value['vocation'] .'</font></td>';
                    echo '<td bgcolor="#eee8dc" width="30%"><font color="black"><center>'. hide_char_to_name(user_character_hide($value['name'])) .'</font></td>';
                  
                    echo '</tr>';
                    $counter++;
                    $characters[] = $value['name'];
                }
            ?>
          
            </table>
            <!-- FORMS TO EDIT CHARACTER-->
            <form action="" method="post">
                <table class="table">
                    <tr><br><a href="createcharacter.php"><img src="layout/images/buttons/createchar.png" align="right"></a>
                        <td>
                            <select id="selected_character" name="selected_character" class="form-control">
                            <?php
                            for ($i = 0; $i < $char_count; $i++) {
                                if (user_character_hide($characters[$i]) == 1) {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>';   
                                } else {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>';   
                                }
                            }
                            ?>
                            </select>
                        </td>
                      
                        <td>
                            <select id="action" name="action" class="form-control" onChange="changedOption(this)">
                                <option value="none" selected>Select action</option>
                                <option value="toggle_hide">Toggle Hide</option>                              
                                <option value="change_comment">Change comment</option>
                                <option value="change_gender">Change gender</option>
                                <option value="change_name">Change name</option>
                                <option value="delete_character" class="needconfirmation">Delete character</option>
                            </select>
                        </td>
                        <td id="submit_form">
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <input id="submit_button" type="submit" value="Submit" class="btn btn-primary btn-block"></input>
                        </td>
                    </tr>
                </table>
            </form>
            <?php
        } else {
            echo '<td>make a character <a href="createcharacter.php">here</a></td>';
        }
        ?>
    </div>
    <script>
        function changedOption(e) {
            // If selection is 'Change name' add a name field in the form
            // Else remove name field if it exists
            if (e.value == 'change_name') {
                var lastCell = document.getElementById('submit_form');
                var x = document.createElement('TD');
                x.id = "new_name";
                x.innerHTML = '<input type="text" name="newName" placeholder="New Name" class="form-control">';
                lastCell.parentNode.insertBefore(x, lastCell);
            } else {
                var child = document.getElementById('new_name');
                if (child) {
                    child.parentNode.removeChild(child);
                }
            }
        }
    </script>
    <script src="engine/js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function(){
            $("#submit_button").click(function(e){
                if ($("#action").find(":selected").attr('class') == "needconfirmation") {
                    var r = confirm("Do you really want to DELETE character: "+$('#selected_character').find(":selected").text()+"?")
                    if (r == false) {
                        e.preventDefault();
                    }
                }
            });
        });
    </script>
    <?php
}
include 'layout/overall/footer.php';
// ZEOTSS: Register visitor
if ($config['zeotss']['enabled'] && $config['zeotss']['visitors']) {
    $curl_connection = curl_init($config['zeotss']['server']."modules/visitor/registervisitor.php");
    curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 1);
    curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 0);
    $post_string = "longip=".ip2long($_SERVER['REMOTE_ADDR'])."&register=1";
    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
    $result = curl_exec($curl_connection);
    if ($config['zeotss']['debug']) data_dump(false, array($result), "CURL DATA");
    curl_close($curl_connection);

    // Check if site is registered on ZEOTSS and can use its utilities:
    $result = json_decode($result);
    if ($result->data->exist === false) {
        ?>
        <script type="text/javascript">
        alert("Error: ZEOTSS site validation failed, have you registered? Register at: <?php echo $config['zeotss']['server']; ?>");
        </script>
        <?php
    }
}
?>
 
I am honestly not the best at php but you can try this...

Code:
player_name = mysql_select_single("SELECT `player_name` FROM `znote_accounts` WHERE `accound_id` == $user_data['id']")
<font color="#eee8dc" size="3"><center>Welcome to your account page, <?php echo $player_name; ?></font>
 
Im looking over it too, but there is something missing here, that is causing the rest of the file to not work. It changes colors in notepad++, meaning it wont read past a certain point. But I am not seeing where. lol
 
try

Code:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';
#region CANCEL CHARACTER DELETE
$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`');
    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 cancelled.<br/>';
    }
}
#endregion

// Variable used to check if main page should be rendered after handling POST (Change comment page)
$render_page = true;

// Handle POST
if (!empty($_POST['selected_character'])) {
    if (!empty($_POST['action'])) {
        // Validate token
        if (!Token::isValid($_POST['token'])) {
            exit();
        }
        // Sanitize values
        $action = getValue($_POST['action']);
        $char_name = getValue($_POST['selected_character']);

        // Handle actions
        switch($action) {
            // Change character comment PAGE2 (Success).
            case 'update_comment':
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_update_comment(user_character_id($char_name), getValue($_POST['comment']));
                    echo 'Successfully updated comment.';
                }
                break;
            // end

            // Hide character
            case 'toggle_hide':
                $hide = (user_character_hide($char_name) == 1 ? 0 : 1);
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_character_set_hide(user_character_id($char_name), $hide);
                }
                break;
            // end

            // DELETE character
            case 'delete_character':
                if (user_character_account_id($char_name) === $session_user_id) {
                    $charid = user_character_id($char_name);
                    if ($charid !== false) {
                        if ($config['TFSVersion'] === '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.';
                        }
                    }
                }
                break;
            // end

            // CHANGE character name
            case 'change_name':
                $oldname = $char_name;
                $newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';

                $player = false;
                if ($config['TFSVersion'] === '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'");

                // Check if user is online
                if ($player['online'] == 1) {
                    $errors[] = 'Character must be offline first.';
                }

                // Check if player has bough ticket
                $accountId = $player['account_id'];
                $order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' AND `account_id` = '$accountId' LIMIT 1;");
                if ($order === false) {
                    $errors[] = 'Did not find any name change tickets, buy them in our <a href="shop.php">shop!</a>';
                }

                // Check if player and account matches
                if ($session_user_id != $accountId || $session_user_id != $order['account_id']) {
                    $errors[] = 'Failed to sync your account. :|';
                }

                $newname = validate_name($newname);
                if ($newname === false) {
                    $errors[] = 'Your name can not contain more than 2 words.';
                } else {
                    if (empty($newname)) {
                        $errors[] = 'Please enter a name!';
                    } else if (user_character_exist($newname) !== false) {
                        $errors[] = 'Sorry, that character name already exist.';
                    } else if (!preg_match("/^[a-zA-Z_ ]+$/", $newname)) {
                        $errors[] = 'Your name may only contain a-z, A-Z and spaces.';
                    } else if (strlen($newname) < $config['minL'] || strlen($newname) > $config['maxL']) {
                        $errors[] = 'Your character name must be between ' . $config['minL'] . ' - ' . $config['maxL'] . ' characters long.';
                    } else if (!ctype_upper($newname{0})) {
                        $errors[] = 'The first letter of a name has to be a capital letter!';
                    }

                    // name restriction
                    $resname = explode(" ", $_POST['newName']);
                    foreach($resname as $res) {
                        if(in_array(strtolower($res), $config['invalidNameTags'])) {
                            $errors[] = 'Your username contains a restricted word.';
                        } else if(strlen($res) == 1) {
                            $errors[] = 'Too short words in your name.';
                        }
                    }
                }

                if (!empty($newname) && empty($errors)) {
                    echo 'You have successfully changed your character name to ' . $newname . '.';
                    mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
                    mysql_delete("DELETE FROM `znote_shop_orders` WHERE `id`='".$order['id']."' LIMIT 1;");

                } else if (!empty($errors)) {
                    echo '<font color="red"><b>';
                    echo output_errors($errors);
                    echo '</b></font>';
                }

                break;
            // end

            // Change character sex
            case 'change_gender':
                if (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['TFSVersion'] == 'TFS_10') {
                        $chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
                    } else $chr_data = user_character_data($char_id, 'online');
                    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.");

                        // Fetch character tickets
                        $tickets = shop_account_gender_tickets($account_id);
                        if ($tickets !== false || $config['free_sex_change'] == true) {
                            // They are allowed to change gender
                            $last = false;
                            $infinite = false;
                            $tks = 0;
                            // Do we have any infinite tickets?
                            foreach ($tickets as $ticket) {
                                if ($ticket['count'] == 0) $infinite = true;
                                else if ($ticket > 0 && $infinite === false) $tks += (int)$ticket['count'];
                            }
                            if ($infinite === true) $tks = 0;
                            $dbid = (int)$tickets[0]['id'];
                            // If they dont have unlimited tickets, remove a count from their ticket.
                            if ($tickets[0]['count'] > 1) { // Decrease count
                                $tks--;
                                $tkr = ((int)$tickets[0]['count'] - 1);
                                shop_update_row_count($dbid, $tkr);
                            } else if ($tickets[0]['count'] == 1) { // Delete record
                                shop_delete_row_order($dbid);
                                $tks--;
                            }

                            // Change character gender:
                            //
                            user_character_change_gender($char_name);
                            echo 'You have successfully changed gender on character '. $char_name .'.';
                            if ($tks > 0) echo '<br>You have '. $tks .' gender change tickets left.';
                            else if ($infinite !== true) echo '<br>You are out of tickets.';
                        } else echo 'You don\'t have any character gender tickets, buy them in the <a href="shop.php">SHOP</a>!';
                    } else echo 'Your character must be offline.';
                }
                break;
            // end

            // 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) {
                    $comment_data = user_znote_character_data(user_character_id($char_name), 'comment');
                    ?>
                    <!-- Changing comment MARKUP -->
                    <h1>Change comment on:</h1>
                    <form action="" method="post">
                        <ul>
                            <li>
                                <input name="action" type="hidden" value="update_comment">
                                <input name ="selected_character" type="text" value="<?php echo $char_name; ?>" readonly="readonly">
                            </li>
                            <li>
                                <font class="profile_font" name="profile_font_comment">Comment:</font> <br>
                                <textarea name="comment" cols="70" rows="10"><?php echo $comment_data['comment']; ?></textarea>
                            </li>
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <li><input type="submit" value="Update Comment"></li>
                        </ul>
                    </form>
                    <?php
                }
                break;
            //end
        }
    }
}

if ($render_page) {
    $char_count = user_character_list_count($session_user_id);
    $pending_delete = user_pending_deletes($session_user_id);
    if ($pending_delete) {
        foreach($pending_delete as $delete) {
            if(new DateTime($delete['time']) > new DateTime())
                echo '<b>CAUTION!</b> Your character with name <b>' . $delete['character_name'] . ' will be deleted on ' . $delete['time'] . '</b>. <a href="myaccount.php?cancel_delete_id=' . $delete['id'] . '">Cancel this operation.</a><br/>';
            else {
                user_delete_character(user_character_id($delete['character_name']));
                mysql_update('UPDATE `znote_deleted_characters` SET `done` = 1 WHERE `id` = '. $delete['id']. '');
                echo '<b>Character ' . $delete['character_name'] . ' has been deleted</b>. This operation was requested by owner of this account.';
                $char_count--;
            }
        }
    }

    ?>
    <div id="myaccount">
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000"><?php
                player_name = mysql_select_single("SELECT `player_name` FROM `znote_accounts` WHERE `accound_id` == $user_data['id']") ?>
                    <font color="#eee8dc" size="3"><center>Welcome to your account page, <?php echo $player_name; ?></font>
                </td>
            </tr>
            <tr>  
                <td bgcolor="#eee8dc">
                    <center><font color="black" >Balance of Premium Time: <b><?php echo $user_data['premdays']; ?> </b>
                </td>
            </tr>
            <tr>
                <td bgcolor="#eee8dc"><?php
                $sql = "SELECT `creation` FROM `players` as p LEFT JOIN `accounts` as a on p.account_id = a.id WHERE p.id='$user_id'";
                $creation_t = mysql_select_single($sql)["creation"];
                //$creation_t = date('m/d/Y', $creation_t);                ?>
                    <font color="black"><center>Created: <b><font color="black"><?php echo getClock($creation_t); ?></font>
                </td>
             
            </tr>
             
        </table>
        <table width="100%" border="0" cellspacing="1" cellpadding="4">  
            <tr>
                <td width="100%">
                 
             
                    <center><a href="changepassword.php"><img src="layout/images/buttons/changepass.png" align="center"></a>
         
                    <a href="recover.php"><img src="layout/images/buttons/lostacc.png" align="right"></a>
                <br>
             
                </td>
            </tr>
        </table>  
        <br>
        <br>
        <br>
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000">
                    <font color="#eee8dc" size="3"><center>Characters</font>
                </td>
            </tr>
        <?php
        // Echo character list!
        $char_array = user_character_list($user_data['id']);
        // Design and present the list
        if ($char_array) {
            ?>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td bgcolor="#800000" width="10%"></td>
                <td bgcolor="#800000" width="50%">
                    <b><font color="#eee8dc"><center>Name</center></font></b>

                </td>
                <td bgcolor="#800000" width="30%">
                    <b><font color="#eee8dc"><center>Status</center></font></b>
                </td>
             

            </tr>
         
    </table>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
                <?php
                $characters = array();
                $counter = 1;
                foreach ($char_array as $value)

                {
                    // characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online

                    echo '<tr>';
                    echo '<td width="10%" bgcolor="#eee8dc"><font color="black"><center>'. $counter .'.</font></td>';
                    echo '<td width="50%" bgcolor="#eee8dc"><font color="black">'. $value['name'] .'<br></a>'. $value['level'] .' - '. $value['vocation'] .'</font></td>';
                    echo '<td bgcolor="#eee8dc" width="30%"><font color="black"><center>'. hide_char_to_name(user_character_hide($value['name'])) .'</font></td>';
                 
                    echo '</tr>';
                    $counter++;
                    $characters[] = $value['name'];
                }
            ?>
         
            </table>
            <!-- FORMS TO EDIT CHARACTER-->
            <form action="" method="post">
                <table class="table">
                    <tr><br><a href="createcharacter.php"><img src="layout/images/buttons/createchar.png" align="right"></a>
                        <td>
                            <select id="selected_character" name="selected_character" class="form-control">
                            <?php
                            for ($i = 0; $i < $char_count; $i++) {
                                if (user_character_hide($characters[$i]) == 1) {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>';  
                                } else {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>';  
                                }
                            }
                            ?>
                            </select>
                        </td>
                     
                        <td>
                            <select id="action" name="action" class="form-control" onChange="changedOption(this)">
                                <option value="none" selected>Select action</option>
                                <option value="toggle_hide">Toggle Hide</option>                              
                                <option value="change_comment">Change comment</option>
                                <option value="change_gender">Change gender</option>
                                <option value="change_name">Change name</option>
                                <option value="delete_character" class="needconfirmation">Delete character</option>
                            </select>
                        </td>
                        <td id="submit_form">
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <input id="submit_button" type="submit" value="Submit" class="btn btn-primary btn-block"></input>
                        </td>
                    </tr>
                </table>
            </form>
            <?php
        } else {
            echo '<td>make a character <a href="createcharacter.php">here</a></td>';
        }
        ?>
    </div>
    <script>
        function changedOption(e) {
            // If selection is 'Change name' add a name field in the form
            // Else remove name field if it exists
            if (e.value == 'change_name') {
                var lastCell = document.getElementById('submit_form');
                var x = document.createElement('TD');
                x.id = "new_name";
                x.innerHTML = '<input type="text" name="newName" placeholder="New Name" class="form-control">';
                lastCell.parentNode.insertBefore(x, lastCell);
            } else {
                var child = document.getElementById('new_name');
                if (child) {
                    child.parentNode.removeChild(child);
                }
            }
        }
    </script>
    <script src="engine/js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function(){
            $("#submit_button").click(function(e){
                if ($("#action").find(":selected").attr('class') == "needconfirmation") {
                    var r = confirm("Do you really want to DELETE character: "+$('#selected_character').find(":selected").text()+"?")
                    if (r == false) {
                        e.preventDefault();
                    }
                }
            });
        });
    </script>
    <?php
}
include 'layout/overall/footer.php';
// ZEOTSS: Register visitor
if ($config['zeotss']['enabled'] && $config['zeotss']['visitors']) {
    $curl_connection = curl_init($config['zeotss']['server']."modules/visitor/registervisitor.php");
    curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 1);
    curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 0);
    $post_string = "longip=".ip2long($_SERVER['REMOTE_ADDR'])."&register=1";
    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
    $result = curl_exec($curl_connection);
    if ($config['zeotss']['debug']) data_dump(false, array($result), "CURL DATA");
    curl_close($curl_connection);

    // Check if site is registered on ZEOTSS and can use its utilities:
    $result = json_decode($result);
    if ($result->data->exist === false) {
        ?>
        <script type="text/javascript">
        alert("Error: ZEOTSS site validation failed, have you registered? Register at: <?php echo $config['zeotss']['server']; ?>");
        </script>
        <?php
    }
}
?>
 
Code:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';
#region CANCEL CHARACTER DELETE
$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`');
    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 cancelled.<br/>';
    }
}
#endregion

// Variable used to check if main page should be rendered after handling POST (Change comment page)
$render_page = true;

// Handle POST
if (!empty($_POST['selected_character'])) {
    if (!empty($_POST['action'])) {
        // Validate token
        if (!Token::isValid($_POST['token'])) {
            exit();
        }
        // Sanitize values
        $action = getValue($_POST['action']);
        $char_name = getValue($_POST['selected_character']);

        // Handle actions
        switch($action) {
            // Change character comment PAGE2 (Success).
            case 'update_comment':
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_update_comment(user_character_id($char_name), getValue($_POST['comment']));
                    echo 'Successfully updated comment.';
                }
                break;
            // end

            // Hide character
            case 'toggle_hide':
                $hide = (user_character_hide($char_name) == 1 ? 0 : 1);
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_character_set_hide(user_character_id($char_name), $hide);
                }
                break;
            // end

            // DELETE character
            case 'delete_character':
                if (user_character_account_id($char_name) === $session_user_id) {
                    $charid = user_character_id($char_name);
                    if ($charid !== false) {
                        if ($config['TFSVersion'] === '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.';
                        }
                    }
                }
                break;
            // end

            // CHANGE character name
            case 'change_name':
                $oldname = $char_name;
                $newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';

                $player = false;
                if ($config['TFSVersion'] === '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'");

                // Check if user is online
                if ($player['online'] == 1) {
                    $errors[] = 'Character must be offline first.';
                }

                // Check if player has bough ticket
                $accountId = $player['account_id'];
                $order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' AND `account_id` = '$accountId' LIMIT 1;");
                if ($order === false) {
                    $errors[] = 'Did not find any name change tickets, buy them in our <a href="shop.php">shop!</a>';
                }

                // Check if player and account matches
                if ($session_user_id != $accountId || $session_user_id != $order['account_id']) {
                    $errors[] = 'Failed to sync your account. :|';
                }

                $newname = validate_name($newname);
                if ($newname === false) {
                    $errors[] = 'Your name can not contain more than 2 words.';
                } else {
                    if (empty($newname)) {
                        $errors[] = 'Please enter a name!';
                    } else if (user_character_exist($newname) !== false) {
                        $errors[] = 'Sorry, that character name already exist.';
                    } else if (!preg_match("/^[a-zA-Z_ ]+$/", $newname)) {
                        $errors[] = 'Your name may only contain a-z, A-Z and spaces.';
                    } else if (strlen($newname) < $config['minL'] || strlen($newname) > $config['maxL']) {
                        $errors[] = 'Your character name must be between ' . $config['minL'] . ' - ' . $config['maxL'] . ' characters long.';
                    } else if (!ctype_upper($newname{0})) {
                        $errors[] = 'The first letter of a name has to be a capital letter!';
                    }

                    // name restriction
                    $resname = explode(" ", $_POST['newName']);
                    foreach($resname as $res) {
                        if(in_array(strtolower($res), $config['invalidNameTags'])) {
                            $errors[] = 'Your username contains a restricted word.';
                        } else if(strlen($res) == 1) {
                            $errors[] = 'Too short words in your name.';
                        }
                    }
                }

                if (!empty($newname) && empty($errors)) {
                    echo 'You have successfully changed your character name to ' . $newname . '.';
                    mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
                    mysql_delete("DELETE FROM `znote_shop_orders` WHERE `id`='".$order['id']."' LIMIT 1;");

                } else if (!empty($errors)) {
                    echo '<font color="red"><b>';
                    echo output_errors($errors);
                    echo '</b></font>';
                }

                break;
            // end

            // Change character sex
            case 'change_gender':
                if (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['TFSVersion'] == 'TFS_10') {
                        $chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
                    } else $chr_data = user_character_data($char_id, 'online');
                    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.");

                        // Fetch character tickets
                        $tickets = shop_account_gender_tickets($account_id);
                        if ($tickets !== false || $config['free_sex_change'] == true) {
                            // They are allowed to change gender
                            $last = false;
                            $infinite = false;
                            $tks = 0;
                            // Do we have any infinite tickets?
                            foreach ($tickets as $ticket) {
                                if ($ticket['count'] == 0) $infinite = true;
                                else if ($ticket > 0 && $infinite === false) $tks += (int)$ticket['count'];
                            }
                            if ($infinite === true) $tks = 0;
                            $dbid = (int)$tickets[0]['id'];
                            // If they dont have unlimited tickets, remove a count from their ticket.
                            if ($tickets[0]['count'] > 1) { // Decrease count
                                $tks--;
                                $tkr = ((int)$tickets[0]['count'] - 1);
                                shop_update_row_count($dbid, $tkr);
                            } else if ($tickets[0]['count'] == 1) { // Delete record
                                shop_delete_row_order($dbid);
                                $tks--;
                            }

                            // Change character gender:
                            //
                            user_character_change_gender($char_name);
                            echo 'You have successfully changed gender on character '. $char_name .'.';
                            if ($tks > 0) echo '<br>You have '. $tks .' gender change tickets left.';
                            else if ($infinite !== true) echo '<br>You are out of tickets.';
                        } else echo 'You don\'t have any character gender tickets, buy them in the <a href="shop.php">SHOP</a>!';
                    } else echo 'Your character must be offline.';
                }
                break;
            // end

            // 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) {
                    $comment_data = user_znote_character_data(user_character_id($char_name), 'comment');
                    ?>
                    <!-- Changing comment MARKUP -->
                    <h1>Change comment on:</h1>
                    <form action="" method="post">
                        <ul>
                            <li>
                                <input name="action" type="hidden" value="update_comment">
                                <input name ="selected_character" type="text" value="<?php echo $char_name; ?>" readonly="readonly">
                            </li>
                            <li>
                                <font class="profile_font" name="profile_font_comment">Comment:</font> <br>
                                <textarea name="comment" cols="70" rows="10"><?php echo $comment_data['comment']; ?></textarea>
                            </li>
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <li><input type="submit" value="Update Comment"></li>
                        </ul>
                    </form>
                    <?php
                }
                break;
            //end
        }
    }
}

if ($render_page) {
    $char_count = user_character_list_count($session_user_id);
    $pending_delete = user_pending_deletes($session_user_id);
    if ($pending_delete) {
        foreach($pending_delete as $delete) {
            if(new DateTime($delete['time']) > new DateTime())
                echo '<b>CAUTION!</b> Your character with name <b>' . $delete['character_name'] . ' will be deleted on ' . $delete['time'] . '</b>. <a href="myaccount.php?cancel_delete_id=' . $delete['id'] . '">Cancel this operation.</a><br/>';
            else {
                user_delete_character(user_character_id($delete['character_name']));
                mysql_update('UPDATE `znote_deleted_characters` SET `done` = 1 WHERE `id` = '. $delete['id']. '');
                echo '<b>Character ' . $delete['character_name'] . ' has been deleted</b>. This operation was requested by owner of this account.';
                $char_count--;
            }
        }
    }

    ?>
    <div id="myaccount">
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000"><?php
                player_name = mysql_select_single("SELECT `player_name` FROM `znote_accounts` WHERE `accound_id` == $user_data['id']"); ?>
                    <font color="#eee8dc" size="3"><center>Welcome to your account page, <?php echo $player_name; ?></font>
                </td>
            </tr>
            <tr> 
                <td bgcolor="#eee8dc">
                    <center><font color="black" >Balance of Premium Time: <b><?php echo $user_data['premdays']; ?> </b>
                </td>
            </tr>
            <tr>
                <td bgcolor="#eee8dc"><?php
                $sql = "SELECT `creation` FROM `players` as p LEFT JOIN `accounts` as a on p.account_id = a.id WHERE p.id='$user_id'";
                $creation_t = mysql_select_single($sql)["creation"];
                //$creation_t = date('m/d/Y', $creation_t);                ?>
                    <font color="black"><center>Created: <b><font color="black"><?php echo getClock($creation_t); ?></font>
                </td>
           
            </tr>
           
        </table>
        <table width="100%" border="0" cellspacing="1" cellpadding="4"> 
            <tr>
                <td width="100%">
               
           
                    <center><a href="changepassword.php"><img src="layout/images/buttons/changepass.png" align="center"></a>
       
                    <a href="recover.php"><img src="layout/images/buttons/lostacc.png" align="right"></a>
                <br>
           
                </td>
            </tr>
        </table> 
        <br>
        <br>
        <br>
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000">
                    <font color="#eee8dc" size="3"><center>Characters</font>
                </td>
            </tr>
        <?php
        // Echo character list!
        $char_array = user_character_list($user_data['id']);
        // Design and present the list
        if ($char_array) {
            ?>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td bgcolor="#800000" width="10%"></td>
                <td bgcolor="#800000" width="50%">
                    <b><font color="#eee8dc"><center>Name</center></font></b>

                </td>
                <td bgcolor="#800000" width="30%">
                    <b><font color="#eee8dc"><center>Status</center></font></b>
                </td>
           

            </tr>
       
    </table>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
                <?php
                $characters = array();
                $counter = 1;
                foreach ($char_array as $value)

                {
                    // characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online

                    echo '<tr>';
                    echo '<td width="10%" bgcolor="#eee8dc"><font color="black"><center>'. $counter .'.</font></td>';
                    echo '<td width="50%" bgcolor="#eee8dc"><font color="black">'. $value['name'] .'<br></a>'. $value['level'] .' - '. $value['vocation'] .'</font></td>';
                    echo '<td bgcolor="#eee8dc" width="30%"><font color="black"><center>'. hide_char_to_name(user_character_hide($value['name'])) .'</font></td>';
               
                    echo '</tr>';
                    $counter++;
                    $characters[] = $value['name'];
                }
            ?>
       
            </table>
            <!-- FORMS TO EDIT CHARACTER-->
            <form action="" method="post">
                <table class="table">
                    <tr><br><a href="createcharacter.php"><img src="layout/images/buttons/createchar.png" align="right"></a>
                        <td>
                            <select id="selected_character" name="selected_character" class="form-control">
                            <?php
                            for ($i = 0; $i < $char_count; $i++) {
                                if (user_character_hide($characters[$i]) == 1) {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>'; 
                                } else {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>'; 
                                }
                            }
                            ?>
                            </select>
                        </td>
                   
                        <td>
                            <select id="action" name="action" class="form-control" onChange="changedOption(this)">
                                <option value="none" selected>Select action</option>
                                <option value="toggle_hide">Toggle Hide</option>                            
                                <option value="change_comment">Change comment</option>
                                <option value="change_gender">Change gender</option>
                                <option value="change_name">Change name</option>
                                <option value="delete_character" class="needconfirmation">Delete character</option>
                            </select>
                        </td>
                        <td id="submit_form">
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <input id="submit_button" type="submit" value="Submit" class="btn btn-primary btn-block"></input>
                        </td>
                    </tr>
                </table>
            </form>
            <?php
        } else {
            echo '<td>make a character <a href="createcharacter.php">here</a></td>';
        }
        ?>
    </div>
    <script>
        function changedOption(e) {
            // If selection is 'Change name' add a name field in the form
            // Else remove name field if it exists
            if (e.value == 'change_name') {
                var lastCell = document.getElementById('submit_form');
                var x = document.createElement('TD');
                x.id = "new_name";
                x.innerHTML = '<input type="text" name="newName" placeholder="New Name" class="form-control">';
                lastCell.parentNode.insertBefore(x, lastCell);
            } else {
                var child = document.getElementById('new_name');
                if (child) {
                    child.parentNode.removeChild(child);
                }
            }
        }
    </script>
    <script src="engine/js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function(){
            $("#submit_button").click(function(e){
                if ($("#action").find(":selected").attr('class') == "needconfirmation") {
                    var r = confirm("Do you really want to DELETE character: "+$('#selected_character').find(":selected").text()+"?")
                    if (r == false) {
                        e.preventDefault();
                    }
                }
            });
        });
    </script>
    <?php
}
include 'layout/overall/footer.php';
// ZEOTSS: Register visitor
if ($config['zeotss']['enabled'] && $config['zeotss']['visitors']) {
    $curl_connection = curl_init($config['zeotss']['server']."modules/visitor/registervisitor.php");
    curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 1);
    curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 0);
    $post_string = "longip=".ip2long($_SERVER['REMOTE_ADDR'])."&register=1";
    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
    $result = curl_exec($curl_connection);
    if ($config['zeotss']['debug']) data_dump(false, array($result), "CURL DATA");
    curl_close($curl_connection);

    // Check if site is registered on ZEOTSS and can use its utilities:
    $result = json_decode($result);
    if ($result->data->exist === false) {
        ?>
        <script type="text/javascript">
        alert("Error: ZEOTSS site validation failed, have you registered? Register at: <?php echo $config['zeotss']['server']; ?>");
        </script>
        <?php
    }
}
?>

Missing a ;
 
Code:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';
#region CANCEL CHARACTER DELETE
$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`');
    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 cancelled.<br/>';
    }
}
#endregion

// Variable used to check if main page should be rendered after handling POST (Change comment page)
$render_page = true;

// Handle POST
if (!empty($_POST['selected_character'])) {
    if (!empty($_POST['action'])) {
        // Validate token
        if (!Token::isValid($_POST['token'])) {
            exit();
        }
        // Sanitize values
        $action = getValue($_POST['action']);
        $char_name = getValue($_POST['selected_character']);

        // Handle actions
        switch($action) {
            // Change character comment PAGE2 (Success).
            case 'update_comment':
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_update_comment(user_character_id($char_name), getValue($_POST['comment']));
                    echo 'Successfully updated comment.';
                }
                break;
            // end

            // Hide character
            case 'toggle_hide':
                $hide = (user_character_hide($char_name) == 1 ? 0 : 1);
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_character_set_hide(user_character_id($char_name), $hide);
                }
                break;
            // end

            // DELETE character
            case 'delete_character':
                if (user_character_account_id($char_name) === $session_user_id) {
                    $charid = user_character_id($char_name);
                    if ($charid !== false) {
                        if ($config['TFSVersion'] === '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.';
                        }
                    }
                }
                break;
            // end

            // CHANGE character name
            case 'change_name':
                $oldname = $char_name;
                $newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';

                $player = false;
                if ($config['TFSVersion'] === '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'");

                // Check if user is online
                if ($player['online'] == 1) {
                    $errors[] = 'Character must be offline first.';
                }

                // Check if player has bough ticket
                $accountId = $player['account_id'];
                $order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' AND `account_id` = '$accountId' LIMIT 1;");
                if ($order === false) {
                    $errors[] = 'Did not find any name change tickets, buy them in our <a href="shop.php">shop!</a>';
                }

                // Check if player and account matches
                if ($session_user_id != $accountId || $session_user_id != $order['account_id']) {
                    $errors[] = 'Failed to sync your account. :|';
                }

                $newname = validate_name($newname);
                if ($newname === false) {
                    $errors[] = 'Your name can not contain more than 2 words.';
                } else {
                    if (empty($newname)) {
                        $errors[] = 'Please enter a name!';
                    } else if (user_character_exist($newname) !== false) {
                        $errors[] = 'Sorry, that character name already exist.';
                    } else if (!preg_match("/^[a-zA-Z_ ]+$/", $newname)) {
                        $errors[] = 'Your name may only contain a-z, A-Z and spaces.';
                    } else if (strlen($newname) < $config['minL'] || strlen($newname) > $config['maxL']) {
                        $errors[] = 'Your character name must be between ' . $config['minL'] . ' - ' . $config['maxL'] . ' characters long.';
                    } else if (!ctype_upper($newname{0})) {
                        $errors[] = 'The first letter of a name has to be a capital letter!';
                    }

                    // name restriction
                    $resname = explode(" ", $_POST['newName']);
                    foreach($resname as $res) {
                        if(in_array(strtolower($res), $config['invalidNameTags'])) {
                            $errors[] = 'Your username contains a restricted word.';
                        } else if(strlen($res) == 1) {
                            $errors[] = 'Too short words in your name.';
                        }
                    }
                }

                if (!empty($newname) && empty($errors)) {
                    echo 'You have successfully changed your character name to ' . $newname . '.';
                    mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
                    mysql_delete("DELETE FROM `znote_shop_orders` WHERE `id`='".$order['id']."' LIMIT 1;");

                } else if (!empty($errors)) {
                    echo '<font color="red"><b>';
                    echo output_errors($errors);
                    echo '</b></font>';
                }

                break;
            // end

            // Change character sex
            case 'change_gender':
                if (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['TFSVersion'] == 'TFS_10') {
                        $chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
                    } else $chr_data = user_character_data($char_id, 'online');
                    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.");

                        // Fetch character tickets
                        $tickets = shop_account_gender_tickets($account_id);
                        if ($tickets !== false || $config['free_sex_change'] == true) {
                            // They are allowed to change gender
                            $last = false;
                            $infinite = false;
                            $tks = 0;
                            // Do we have any infinite tickets?
                            foreach ($tickets as $ticket) {
                                if ($ticket['count'] == 0) $infinite = true;
                                else if ($ticket > 0 && $infinite === false) $tks += (int)$ticket['count'];
                            }
                            if ($infinite === true) $tks = 0;
                            $dbid = (int)$tickets[0]['id'];
                            // If they dont have unlimited tickets, remove a count from their ticket.
                            if ($tickets[0]['count'] > 1) { // Decrease count
                                $tks--;
                                $tkr = ((int)$tickets[0]['count'] - 1);
                                shop_update_row_count($dbid, $tkr);
                            } else if ($tickets[0]['count'] == 1) { // Delete record
                                shop_delete_row_order($dbid);
                                $tks--;
                            }

                            // Change character gender:
                            //
                            user_character_change_gender($char_name);
                            echo 'You have successfully changed gender on character '. $char_name .'.';
                            if ($tks > 0) echo '<br>You have '. $tks .' gender change tickets left.';
                            else if ($infinite !== true) echo '<br>You are out of tickets.';
                        } else echo 'You don\'t have any character gender tickets, buy them in the <a href="shop.php">SHOP</a>!';
                    } else echo 'Your character must be offline.';
                }
                break;
            // end

            // 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) {
                    $comment_data = user_znote_character_data(user_character_id($char_name), 'comment');
                    ?>
                    <!-- Changing comment MARKUP -->
                    <h1>Change comment on:</h1>
                    <form action="" method="post">
                        <ul>
                            <li>
                                <input name="action" type="hidden" value="update_comment">
                                <input name ="selected_character" type="text" value="<?php echo $char_name; ?>" readonly="readonly">
                            </li>
                            <li>
                                <font class="profile_font" name="profile_font_comment">Comment:</font> <br>
                                <textarea name="comment" cols="70" rows="10"><?php echo $comment_data['comment']; ?></textarea>
                            </li>
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <li><input type="submit" value="Update Comment"></li>
                        </ul>
                    </form>
                    <?php
                }
                break;
            //end
        }
    }
}

if ($render_page) {
    $char_count = user_character_list_count($session_user_id);
    $pending_delete = user_pending_deletes($session_user_id);
    if ($pending_delete) {
        foreach($pending_delete as $delete) {
            if(new DateTime($delete['time']) > new DateTime())
                echo '<b>CAUTION!</b> Your character with name <b>' . $delete['character_name'] . ' will be deleted on ' . $delete['time'] . '</b>. <a href="myaccount.php?cancel_delete_id=' . $delete['id'] . '">Cancel this operation.</a><br/>';
            else {
                user_delete_character(user_character_id($delete['character_name']));
                mysql_update('UPDATE `znote_deleted_characters` SET `done` = 1 WHERE `id` = '. $delete['id']. '');
                echo '<b>Character ' . $delete['character_name'] . ' has been deleted</b>. This operation was requested by owner of this account.';
                $char_count--;
            }
        }
    }

    ?>
    <div id="myaccount">
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000"><?php
                $player_name = mysql_select_single("SELECT `player_name` FROM `znote_accounts` WHERE `accound_id` == '$accountId' LIMIT 1"); ?>
                    <font color="#eee8dc" size="3"><center>Welcome to your account page, <?php echo $player_name; ?></font>
                </td>
            </tr>
            <tr> 
                <td bgcolor="#eee8dc">
                    <center><font color="black" >Balance of Premium Time: <b><?php echo $user_data['premdays']; ?> </b>
                </td>
            </tr>
            <tr>
                <td bgcolor="#eee8dc"><?php
                $sql = "SELECT `creation` FROM `players` as p LEFT JOIN `accounts` as a on p.account_id = a.id WHERE p.id='$user_id'";
                $creation_t = mysql_select_single($sql)["creation"];
                //$creation_t = date('m/d/Y', $creation_t);                ?>
                    <font color="black"><center>Created: <b><font color="black"><?php echo getClock($creation_t); ?></font>
                </td>
           
            </tr>
           
        </table>
        <table width="100%" border="0" cellspacing="1" cellpadding="4"> 
            <tr>
                <td width="100%">
               
           
                    <center><a href="changepassword.php"><img src="layout/images/buttons/changepass.png" align="center"></a>
       
                    <a href="recover.php"><img src="layout/images/buttons/lostacc.png" align="right"></a>
                <br>
           
                </td>
            </tr>
        </table> 
        <br>
        <br>
        <br>
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000">
                    <font color="#eee8dc" size="3"><center>Characters</font>
                </td>
            </tr>
        <?php
        // Echo character list!
        $char_array = user_character_list($user_data['id']);
        // Design and present the list
        if ($char_array) {
            ?>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td bgcolor="#800000" width="10%"></td>
                <td bgcolor="#800000" width="50%">
                    <b><font color="#eee8dc"><center>Name</center></font></b>

                </td>
                <td bgcolor="#800000" width="30%">
                    <b><font color="#eee8dc"><center>Status</center></font></b>
                </td>
           

            </tr>
       
    </table>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
                <?php
                $characters = array();
                $counter = 1;
                foreach ($char_array as $value)

                {
                    // characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online

                    echo '<tr>';
                    echo '<td width="10%" bgcolor="#eee8dc"><font color="black"><center>'. $counter .'.</font></td>';
                    echo '<td width="50%" bgcolor="#eee8dc"><font color="black">'. $value['name'] .'<br></a>'. $value['level'] .' - '. $value['vocation'] .'</font></td>';
                    echo '<td bgcolor="#eee8dc" width="30%"><font color="black"><center>'. hide_char_to_name(user_character_hide($value['name'])) .'</font></td>';
               
                    echo '</tr>';
                    $counter++;
                    $characters[] = $value['name'];
                }
            ?>
       
            </table>
            <!-- FORMS TO EDIT CHARACTER-->
            <form action="" method="post">
                <table class="table">
                    <tr><br><a href="createcharacter.php"><img src="layout/images/buttons/createchar.png" align="right"></a>
                        <td>
                            <select id="selected_character" name="selected_character" class="form-control">
                            <?php
                            for ($i = 0; $i < $char_count; $i++) {
                                if (user_character_hide($characters[$i]) == 1) {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>'; 
                                } else {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>'; 
                                }
                            }
                            ?>
                            </select>
                        </td>
                   
                        <td>
                            <select id="action" name="action" class="form-control" onChange="changedOption(this)">
                                <option value="none" selected>Select action</option>
                                <option value="toggle_hide">Toggle Hide</option>                            
                                <option value="change_comment">Change comment</option>
                                <option value="change_gender">Change gender</option>
                                <option value="change_name">Change name</option>
                                <option value="delete_character" class="needconfirmation">Delete character</option>
                            </select>
                        </td>
                        <td id="submit_form">
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <input id="submit_button" type="submit" value="Submit" class="btn btn-primary btn-block"></input>
                        </td>
                    </tr>
                </table>
            </form>
            <?php
        } else {
            echo '<td>make a character <a href="createcharacter.php">here</a></td>';
        }
        ?>
    </div>
    <script>
        function changedOption(e) {
            // If selection is 'Change name' add a name field in the form
            // Else remove name field if it exists
            if (e.value == 'change_name') {
                var lastCell = document.getElementById('submit_form');
                var x = document.createElement('TD');
                x.id = "new_name";
                x.innerHTML = '<input type="text" name="newName" placeholder="New Name" class="form-control">';
                lastCell.parentNode.insertBefore(x, lastCell);
            } else {
                var child = document.getElementById('new_name');
                if (child) {
                    child.parentNode.removeChild(child);
                }
            }
        }
    </script>
    <script src="engine/js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function(){
            $("#submit_button").click(function(e){
                if ($("#action").find(":selected").attr('class') == "needconfirmation") {
                    var r = confirm("Do you really want to DELETE character: "+$('#selected_character').find(":selected").text()+"?")
                    if (r == false) {
                        e.preventDefault();
                    }
                }
            });
        });
    </script>
    <?php
}
include 'layout/overall/footer.php';
// ZEOTSS: Register visitor
if ($config['zeotss']['enabled'] && $config['zeotss']['visitors']) {
    $curl_connection = curl_init($config['zeotss']['server']."modules/visitor/registervisitor.php");
    curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 1);
    curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 0);
    $post_string = "longip=".ip2long($_SERVER['REMOTE_ADDR'])."&register=1";
    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
    $result = curl_exec($curl_connection);
    if ($config['zeotss']['debug']) data_dump(false, array($result), "CURL DATA");
    curl_close($curl_connection);

    // Check if site is registered on ZEOTSS and can use its utilities:
    $result = json_decode($result);
    if ($result->data->exist === false) {
        ?>
        <script type="text/javascript">
        alert("Error: ZEOTSS site validation failed, have you registered? Register at: <?php echo $config['zeotss']['server']; ?>");
        </script>
        <?php
    }
}
?>
 
Now I get error
Code:
string(75) "SELECT `player_name` FROM `znote_accounts` WHERE `accound_id` == '' LIMIT 1" 
(query - SQL error) 
Type: select_single (select single row from database)

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== '' LIMIT 1' at line 1
 
Code:
$player_name = mysql_select_single("SELECT `player_name` FROM `znote_accounts` WHERE `accound_id` = '$accountId' LIMIT 1"); ?>
 
Back to a white page that wont load

Edit, I forgot to copy >

The last code throws off whole layout, and leave the player_name blank
 
PHP:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';
#region CANCEL CHARACTER DELETE
$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`');
    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 cancelled.<br/>';
    }
}
#endregion

// Variable used to check if main page should be rendered after handling POST (Change comment page)
$render_page = true;

// Handle POST
if (!empty($_POST['selected_character'])) {
    if (!empty($_POST['action'])) {
        // Validate token
        if (!Token::isValid($_POST['token'])) {
            exit();
        }
        // Sanitize values
        $action = getValue($_POST['action']);
        $char_name = getValue($_POST['selected_character']);

        // Handle actions
        switch($action) {
            // Change character comment PAGE2 (Success).
            case 'update_comment':
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_update_comment(user_character_id($char_name), getValue($_POST['comment']));
                    echo 'Successfully updated comment.';
                }
                break;
            // end

            // Hide character
            case 'toggle_hide':
                $hide = (user_character_hide($char_name) == 1 ? 0 : 1);
                if (user_character_account_id($char_name) === $session_user_id) {
                    user_character_set_hide(user_character_id($char_name), $hide);
                }
                break;
            // end

            // DELETE character
            case 'delete_character':
                if (user_character_account_id($char_name) === $session_user_id) {
                    $charid = user_character_id($char_name);
                    if ($charid !== false) {
                        if ($config['TFSVersion'] === '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.';
                        }
                    }
                }
                break;
            // end

            // CHANGE character name
            case 'change_name':
                $oldname = $char_name;
                $newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';

                $player = false;
                if ($config['TFSVersion'] === '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'");

                // Check if user is online
                if ($player['online'] == 1) {
                    $errors[] = 'Character must be offline first.';
                }

                // Check if player has bough ticket
                $accountId = $player['account_id'];
                $order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' AND `account_id` = '$accountId' LIMIT 1;");
                if ($order === false) {
                    $errors[] = 'Did not find any name change tickets, buy them in our <a href="shop.php">shop!</a>';
                }

                // Check if player and account matches
                if ($session_user_id != $accountId || $session_user_id != $order['account_id']) {
                    $errors[] = 'Failed to sync your account. :|';
                }

                $newname = validate_name($newname);
                if ($newname === false) {
                    $errors[] = 'Your name can not contain more than 2 words.';
                } else {
                    if (empty($newname)) {
                        $errors[] = 'Please enter a name!';
                    } else if (user_character_exist($newname) !== false) {
                        $errors[] = 'Sorry, that character name already exist.';
                    } else if (!preg_match("/^[a-zA-Z_ ]+$/", $newname)) {
                        $errors[] = 'Your name may only contain a-z, A-Z and spaces.';
                    } else if (strlen($newname) < $config['minL'] || strlen($newname) > $config['maxL']) {
                        $errors[] = 'Your character name must be between ' . $config['minL'] . ' - ' . $config['maxL'] . ' characters long.';
                    } else if (!ctype_upper($newname{0})) {
                        $errors[] = 'The first letter of a name has to be a capital letter!';
                    }

                    // name restriction
                    $resname = explode(" ", $_POST['newName']);
                    foreach($resname as $res) {
                        if(in_array(strtolower($res), $config['invalidNameTags'])) {
                            $errors[] = 'Your username contains a restricted word.';
                        } else if(strlen($res) == 1) {
                            $errors[] = 'Too short words in your name.';
                        }
                    }
                }

                if (!empty($newname) && empty($errors)) {
                    echo 'You have successfully changed your character name to ' . $newname . '.';
                    mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
                    mysql_delete("DELETE FROM `znote_shop_orders` WHERE `id`='".$order['id']."' LIMIT 1;");

                } else if (!empty($errors)) {
                    echo '<font color="red"><b>';
                    echo output_errors($errors);
                    echo '</b></font>';
                }

                break;
            // end

            // Change character sex
            case 'change_gender':
                if (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['TFSVersion'] == 'TFS_10') {
                        $chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
                    } else $chr_data = user_character_data($char_id, 'online');
                    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.");

                        // Fetch character tickets
                        $tickets = shop_account_gender_tickets($account_id);
                        if ($tickets !== false || $config['free_sex_change'] == true) {
                            // They are allowed to change gender
                            $last = false;
                            $infinite = false;
                            $tks = 0;
                            // Do we have any infinite tickets?
                            foreach ($tickets as $ticket) {
                                if ($ticket['count'] == 0) $infinite = true;
                                else if ($ticket > 0 && $infinite === false) $tks += (int)$ticket['count'];
                            }
                            if ($infinite === true) $tks = 0;
                            $dbid = (int)$tickets[0]['id'];
                            // If they dont have unlimited tickets, remove a count from their ticket.
                            if ($tickets[0]['count'] > 1) { // Decrease count
                                $tks--;
                                $tkr = ((int)$tickets[0]['count'] - 1);
                                shop_update_row_count($dbid, $tkr);
                            } else if ($tickets[0]['count'] == 1) { // Delete record
                                shop_delete_row_order($dbid);
                                $tks--;
                            }

                            // Change character gender:
                            //
                            user_character_change_gender($char_name);
                            echo 'You have successfully changed gender on character '. $char_name .'.';
                            if ($tks > 0) echo '<br>You have '. $tks .' gender change tickets left.';
                            else if ($infinite !== true) echo '<br>You are out of tickets.';
                        } else echo 'You don\'t have any character gender tickets, buy them in the <a href="shop.php">SHOP</a>!';
                    } else echo 'Your character must be offline.';
                }
                break;
            // end

            // 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) {
                    $comment_data = user_znote_character_data(user_character_id($char_name), 'comment');
                    ?>
                    <!-- Changing comment MARKUP -->
                    <h1>Change comment on:</h1>
                    <form action="" method="post">
                        <ul>
                            <li>
                                <input name="action" type="hidden" value="update_comment">
                                <input name ="selected_character" type="text" value="<?php echo $char_name; ?>" readonly="readonly">
                            </li>
                            <li>
                                <font class="profile_font" name="profile_font_comment">Comment:</font> <br>
                                <textarea name="comment" cols="70" rows="10"><?php echo $comment_data['comment']; ?></textarea>
                            </li>
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <li><input type="submit" value="Update Comment"></li>
                        </ul>
                    </form>
                    <?php
                }
                break;
            //end
        }
    }
}

if ($render_page) {
    $char_count = user_character_list_count($session_user_id);
    $pending_delete = user_pending_deletes($session_user_id);
    if ($pending_delete) {
        foreach($pending_delete as $delete) {
            if(new DateTime($delete['time']) > new DateTime())
                echo '<b>CAUTION!</b> Your character with name <b>' . $delete['character_name'] . ' will be deleted on ' . $delete['time'] . '</b>. <a href="myaccount.php?cancel_delete_id=' . $delete['id'] . '">Cancel this operation.</a><br/>';
            else {
                user_delete_character(user_character_id($delete['character_name']));
                mysql_update('UPDATE `znote_deleted_characters` SET `done` = 1 WHERE `id` = '. $delete['id']. '');
                echo '<b>Character ' . $delete['character_name'] . ' has been deleted</b>. This operation was requested by owner of this account.';
                $char_count--;
            }
        }
    }

    ?>
    <div id="myaccount">
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000"><?php
                $player_name_info = mysql_select_single("SELECT `player_name` FROM `znote_accounts` WHERE `accound_id` = '$accountId' LIMIT 1");
                $player_name = $player_name_info['player_name']; ?>
              
                    <font color="#eee8dc" size="3"><center>Welcome to your account page, <?php echo $player_name; ?></font>
                </td>
            </tr>
            <tr>
                <td bgcolor="#eee8dc">
                    <center><font color="black" >Balance of Premium Time: <b><?php echo $user_data['premdays']; ?> </b>
                </td>
            </tr>
            <tr>
                <td bgcolor="#eee8dc"><?php
                $sql = "SELECT `creation` FROM `players` as p LEFT JOIN `accounts` as a on p.account_id = a.id WHERE p.id='$user_id'";
                $creation_t = mysql_select_single($sql)["creation"];
                //$creation_t = date('m/d/Y', $creation_t);                ?>
                    <font color="black"><center>Created: <b><font color="black"><?php echo getClock($creation_t); ?></font>
                </td>
          
            </tr>
          
        </table>
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%">
              
          
                    <center><a href="changepassword.php"><img src="layout/images/buttons/changepass.png" align="center"></a>
      
                    <a href="recover.php"><img src="layout/images/buttons/lostacc.png" align="right"></a>
                <br>
          
                </td>
            </tr>
        </table>
        <br>
        <br>
        <br>
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td width="100%" bgcolor="#800000">
                    <font color="#eee8dc" size="3"><center>Characters</font>
                </td>
            </tr>
        <?php
        // Echo character list!
        $char_array = user_character_list($user_data['id']);
        // Design and present the list
        if ($char_array) {
            ?>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tr>
                <td bgcolor="#800000" width="10%"></td>
                <td bgcolor="#800000" width="50%">
                    <b><font color="#eee8dc"><center>Name</center></font></b>

                </td>
                <td bgcolor="#800000" width="30%">
                    <b><font color="#eee8dc"><center>Status</center></font></b>
                </td>
          

            </tr>
      
    </table>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
                <?php
                $characters = array();
                $counter = 1;
                foreach ($char_array as $value)

                {
                    // characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online

                    echo '<tr>';
                    echo '<td width="10%" bgcolor="#eee8dc"><font color="black"><center>'. $counter .'.</font></td>';
                    echo '<td width="50%" bgcolor="#eee8dc"><font color="black">'. $value['name'] .'<br></a>'. $value['level'] .' - '. $value['vocation'] .'</font></td>';
                    echo '<td bgcolor="#eee8dc" width="30%"><font color="black"><center>'. hide_char_to_name(user_character_hide($value['name'])) .'</font></td>';
              
                    echo '</tr>';
                    $counter++;
                    $characters[] = $value['name'];
                }
            ?>
      
            </table>
            <!-- FORMS TO EDIT CHARACTER-->
            <form action="" method="post">
                <table class="table">
                    <tr><br><a href="createcharacter.php"><img src="layout/images/buttons/createchar.png" align="right"></a>
                        <td>
                            <select id="selected_character" name="selected_character" class="form-control">
                            <?php
                            for ($i = 0; $i < $char_count; $i++) {
                                if (user_character_hide($characters[$i]) == 1) {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>';
                                } else {
                                    echo '<option value="'. $characters[$i] . '">'. $characters[$i] .'</option>';
                                }
                            }
                            ?>
                            </select>
                        </td>
                  
                        <td>
                            <select id="action" name="action" class="form-control" onChange="changedOption(this)">
                                <option value="none" selected>Select action</option>
                                <option value="toggle_hide">Toggle Hide</option>                           
                                <option value="change_comment">Change comment</option>
                                <option value="change_gender">Change gender</option>
                                <option value="change_name">Change name</option>
                                <option value="delete_character" class="needconfirmation">Delete character</option>
                            </select>
                        </td>
                        <td id="submit_form">
                            <?php
                                /* Form file */
                                Token::create();
                            ?>
                            <input id="submit_button" type="submit" value="Submit" class="btn btn-primary btn-block"></input>
                        </td>
                    </tr>
                </table>
            </form>
            <?php
        } else {
            echo '<td>make a character <a href="createcharacter.php">here</a></td>';
        }
        ?>
    </div>
    <script>
        function changedOption(e) {
            // If selection is 'Change name' add a name field in the form
            // Else remove name field if it exists
            if (e.value == 'change_name') {
                var lastCell = document.getElementById('submit_form');
                var x = document.createElement('TD');
                x.id = "new_name";
                x.innerHTML = '<input type="text" name="newName" placeholder="New Name" class="form-control">';
                lastCell.parentNode.insertBefore(x, lastCell);
            } else {
                var child = document.getElementById('new_name');
                if (child) {
                    child.parentNode.removeChild(child);
                }
            }
        }
    </script>
    <script src="engine/js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function(){
            $("#submit_button").click(function(e){
                if ($("#action").find(":selected").attr('class') == "needconfirmation") {
                    var r = confirm("Do you really want to DELETE character: "+$('#selected_character').find(":selected").text()+"?")
                    if (r == false) {
                        e.preventDefault();
                    }
                }
            });
        });
    </script>
    <?php
}
include 'layout/overall/footer.php';
// ZEOTSS: Register visitor
if ($config['zeotss']['enabled'] && $config['zeotss']['visitors']) {
    $curl_connection = curl_init($config['zeotss']['server']."modules/visitor/registervisitor.php");
    curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 1);
    curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 0);
    $post_string = "longip=".ip2long($_SERVER['REMOTE_ADDR'])."&register=1";
    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
    $result = curl_exec($curl_connection);
    if ($config['zeotss']['debug']) data_dump(false, array($result), "CURL DATA");
    curl_close($curl_connection);

    // Check if site is registered on ZEOTSS and can use its utilities:
    $result = json_decode($result);
    if ($result->data->exist === false) {
        ?>
        <script type="text/javascript">
        alert("Error: ZEOTSS site validation failed, have you registered? Register at: <?php echo $config['zeotss']['server']; ?>");
        </script>
        <?php
    }
}
?>
 
In the database, you can do this query to add a text field to the znote_accounts row:
SQL:
ALTER TABLE `znote_accounts` ADD `player_name` VARCHAR(30) NOT NULL DEFAULT '' AFTER `flag`;
You can set varchar(30) to (20) or something else to allow players to use more or less characters in their name.

Database structure done.

Then we need to tell Znote AAC to load this resource from db:
ZnoteAAC/init.php at master · Znote/ZnoteAAC · GitHub
PHP:
$user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag', 'player_name');
(add , 'player_name' to the end of the function param of user_znote_account_data).

Var loading from DB done.

($user_data contains current loggedin info from the default accounts table, $user_znote_data contains current loggedin info from the custom znote_accounts table). After you have logged in, this information is basically globally accessible from any page or Znote AAC file.

In register.php, below:
ZnoteAAC/register.php at master · Znote/ZnoteAAC · GitHub
HTML:
            <li>
                Account Name:<br>
                <input type="text" name="username">
            </li>

Add:
HTML:
            <li>
                Your first name:<br>
                <input type="text" name="player_name">
            </li>

If you want this to be required, below:
ZnoteAAC/register.php at master · Znote/ZnoteAAC · GitHub
PHP:
            if (strlen($_POST['flag']) < 1) {
                        $errors[] = 'Please choose country.';
                }
Add:
PHP:
            if (strlen($_POST['player_name']) < 1) {
                        $errors[] = 'Please write your first name.';
                }

To pass it along to the registration function, we need to add it to the register data, replace this:
ZnoteAAC/register.php at master · Znote/ZnoteAAC · GitHub
PHP:
        $register_data = array(
            'name'        =>    $_POST['username'],
            'password'    =>    $_POST['password'],
            'email'        =>    $_POST['email'],
            'created'    =>    time(),
            'ip'        =>    getIPLong(),
            'flag'        =>     $_POST['flag']
        );

With this: (Add a comma symbol after flag, and add a new row for player name)
PHP:
        $register_data = array(
            'name'        =>    $_POST['username'],
            'password'    =>    $_POST['password'],
            'email'        =>    $_POST['email'],
            'created'    =>    time(),
            'ip'        =>    getIPLong(),
            'flag'        =>     $_POST['flag'],
            'player_name'        =>     $_POST['player_name']
        );

Now we move on to the create account function in users.php:
ZnoteAAC/users.php at master · Znote/ZnoteAAC · GitHub

Below:
ZnoteAAC/users.php at master · Znote/ZnoteAAC · GitHub
PHP:
$flag = $register_data['flag'];
Add:
PHP:
$player_name = $register_data['player_name'];

Below:
PHP:
unset($register_data['flag']);
Add:
PHP:
unset($register_data['player_name']);

Replace the SQL query to insert to znote_accounts:
ZnoteAAC/users.php at master · Znote/ZnoteAAC · GitHub
PHP:
mysql_insert("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`, `active`, `activekey`, `flag`) VALUES ('$account_id', '$ip', '$created', '$active', '$activeKey', '$flag')");

With:
PHP:
mysql_insert("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`, `active`, `activekey`, `flag`, `player_name`) VALUES ('$account_id', '$ip', '$created', '$active', '$activeKey', '$flag', '$player_name')");

Registration process done.

To display the name in my account page:
ZnoteAAC/myaccount.php at master · Znote/ZnoteAAC · GitHub
Replace:
HTML:
        <p>Welcome to your account page, <?php echo $user_data['name']; ?><br>

With:
HTML:
        <p>Welcome to your account page, <?php echo $user_znote_data['player_name']; ?><br>

You might also want to change settings.php to allow people to change their names after the registration process as well.
 
Last edited:
Solution
Back
Top