<?php if (!defined('access')) {die("Die gesuchte Ressource wurde entfernt oder umbenannt, oder sie steht vorübergehend nicht zur Verfügung.");} ?>
<p class="page_title" id="accountpanelTitle"><?php echo $_LANG['accountpanel_siteTitle'];?></p>


<?php
if(!empty($_SESSION['user'])) {
    echo '
<p style="text-align:center;">
	<a class="contentButton center" href="index.php?site=accountpanel">' . $_LANG['accountpanel_nav_yourData'] . '</a>
	<a class="contentButton center" href="index.php?site=accountpanel&amp;dLogs">' . $_LANG['accountpanel_nav_donationlogs'] . '</a>
	<a class="contentButton center" href="index.php?site=accountpanel&amp;bLogs">' . $_LANG['accountpanel_nav_buylogs'] . '</a>
	<a class="contentButton center" href="index.php?site=accountpanel&amp;gLogs">' . $_LANG['accountpanel_nav_giftlogs'] . '</a>
</p>
<br  class="clear"/>
<hr />';
    $mixedAccountInformationArray = odbc_fetch_array(odbc_exec($odbc_connect, '
        SELECT
            A.[account],
            A.[password],
            A.[cash],
            D.[m_chLoginAuthority],
            D.[regdate],
            D.[BlockTime],
            D.[email],
            D.[secretquestion],
            D.[secretanswer]
        FROM [' . $_CONFIG['db_databases']['acc'] . '].dbo.[ACCOUNT_TBL] AS A
            LEFT JOIN [' . $_CONFIG['db_databases']['acc'] . '].dbo.[ACCOUNT_TBL_DETAIL] AS D ON D.account = A.account
        WHERE A.account = \'' . cleanSqlInput($_SESSION['user']) . '\''));

    if(empty($mixedAccountInformationArray['secretquestion']) AND empty($mixedAccountInformationArray['secretanswer'])) {
        echo '
<p class="page_subtitle">' . $_LANG['accountpanel_securityInformation_subTitle'] . '</p>';

        if(isset($_POST['setSec_submit'])) {


            $strSetSecErrorArray = array();
            $strSetSecMailAddress = cleanSqlInput($_POST['setSec_mail']);
            $strSetSecMailAddressRepeat = cleanSqlInput($_POST['setSec_mailRepeat']);
            $strSetSecMailProvider = preg_replace("^(.*?)@(.*?)^", "$2", $strSetSecMailAddress);
            $strSetSecBirthday = cleanSqlInput($_POST['setSec_birthday']);
            $intSetSecSecretQuestion = cleanSqlInput($_POST['setSec_secretQuestion']);
            $strSetSecSecretAnswer = cleanSqlInput($_POST['setSec_secretAnswer']);


            if(isSpamming($_POST['inputCheckTimestamp'], $_POST['inputCheckKey'], $_SESSION['inputCheckKey'])) {
                $strSetSecErrorArray[] = $_LANG['error_spam'];
            }
            if(empty($strSetSecMailAddress) OR empty($strSetSecMailAddressRepeat) OR empty($strSetSecBirthday) OR empty($intSetSecSecretQuestion) OR empty($strSetSecSecretAnswer)) {
                $strSetSecErrorArray[] = $_LANG['error_fill_in_all_fields'];
            }
            if(strtolower($strSetSecMailAddress) != strtolower($strSetSecMailAddressRepeat)) {
                $strSetSecErrorArray[] = $_LANG['error_mails_indistinguishable'];
            }
            if(!preg_match('/^[a-zA-Z0-9-_.]+@[a-zA-Z0-9-_.]+\.[a-zA-Z]{2,4}$/', $strSetSecMailAddress)) {
                $strOutputErrorArray[] = $_LANG['error_mail_must_be_valid'];
            }
            if(in_array($strSetSecMailProvider, $_CONFIG['web_mail_provider'])) {
                $strOutputErrorArray[] = $_LANG['error_spam_provider'];
            }
            if(!strtotime($strSetSecBirthday)) {
                $strSetSecErrorArray[] = $_LANG['error_valid_birthday'];
            }
            if(!is_numeric($intSetSecSecretQuestion) OR $strSetSecSecretAnswer != preg_replace('/[^A-Za-z0-9 ]/', '', $strSetSecSecretAnswer)) {
                $strSetSecErrorArray[] = $_LANG['error_no_special_characters_secret_answer'];
            }
            if(count($strSetSecErrorArray) > 0) {
                $strSetSecOutput = createMessage($strSetSecErrorArray, 'fail');
            }
            else {
                @odbc_exec($odbc_connect, '
                    UPDATE  [' . $_CONFIG['db_databases']['acc'] . '].dbo.[ACCOUNT_TBL_DETAIL]
                    SET     [email] = \'' . $strSetSecMailAddress . '\',
                            [secretquestion] = ' . $intSetSecSecretQuestion . ',
                            [secretanswer] = \'' . $strSetSecSecretAnswer . '\',
                            [birthday] = \'' . $strSetSecBirthday . '\'
                    WHERE   [account] = \'' . $mixedAccountInformationArray['account'] . '\'
                ');
                 $strSetSecOutput = createMessage($_LANG['success_account_securityinformation_safed'], 'success');
            }
        }
        else {
            $strSetSecOutput = createMessage($_LANG['notify_data_not_changeable'], 'hint');
        }

        echo $strSetSecOutput;
        echo '
<hr />
<form method="post" name="setSec">

	<input type="hidden" name="inputCheckTimestamp" value="' . time() . '" />
	<input type="hidden" name="inputCheckKey" value="' . random_string() . '" />

	<input type="email" name="setSec_mail" id="setSec_mail" placeholder="e.mail@e-mail.com" required="required"/> <input type="email" name="setSec_mailRepeat" class="email" placeholder="' . $_LANG['mail_repeat'] . '" required="required"/>
	    <label class="labelRegistration" for="setSec_mail">' . $_LANG['mail'] . ' :</label>

	<input type="text" name="setSec_birthday" id="setSec_birthday" placeholder="' . $_LANG['birthday'] . '" required="required"/>
	    <label class="labelRegistration" for="setSec_birthday">' . $_LANG['birthday'] . ' :</label><br />

	<select name="setSec_secretQuestion" id="setSec_secretQuestion" required="required">
		<option value="" selected="selected"></option>';
		foreach($_CONFIG['allg_secretquestions'] as $id => $frage) {
			echo '<option value="'.$id.'" >'.$frage.'</option>';
		}
        echo '
	</select>
	    <label class="labelRegistration" for="setSec_secretQuestion">' . $_LANG['secret_question'] . ' :</label><br />

	<input type="text" name="setSec_secretAnswer" id="setSec_secretAnswer" placeholder="' . $_LANG['secret_answer'] . '" required="required"/>
	    <label class="labelRegistration" for="setSec_secretAnswer">' . $_LANG['secret_answer'] . ' :</label>

    <hr />
	<input type="submit" name="setSec_submit" value="' . $_LANG['button_send_security_data'] . '" style="margin:10px 0px 10px 190px;" />
</form>';
    }
    elseif(isset($_GET['changeMail']) AND $mixedAccountInformationArray['BlockTime'] < date('Ymd')) {
        echo '
 <p class="page_subtitle">' . $_LANG['accountpanel_changeMail_subTitle'] . '</p>';

        if(isset($_POST['chgmail_submit'])) {
            $errors = array();

            if(isSpamming($_POST['inputCheckTimestamp'], $_POST['inputCheckKey'], $_SESSION['inputCheckKey'])) {
                $errors[] = $_LANG['error_spam'];
            }
            if(empty($_POST['chgmail_newmail']) OR empty($_POST['chgmail_confirmmail']) OR empty($_POST['chgmail_pw'])) {
                $errors[] = $_LANG['error_fill_in_all_fields'];
            }
            if(md5($_CONFIG['allg_svr_salt'].$_POST['chgmail_pw']) != $mixedAccountInformationArray['password']) {
                $errors[] = $_LANG['error_password_wrong'];
            }
            if(!preg_match('/^[a-zA-Z0-9-_.]+@[a-zA-Z0-9-_.]+\.[a-zA-Z]{2,4}$/', $_POST['chgmail_newmail'])) {
                $errors[] = $_LANG['error_mail_must_be_valid'];
            }
			if(in_array($_POST['chgmail_newmail'], $_CONFIG['web_mail_provider'])) {
				$strOutputErrorArray[] = $_LANG['error_spam_provider'];
			}
            if($_POST['chgmail_newmail'] != $_POST['chgmail_confirmmail']) {
                $errors[] = $_LANG['error_mails_indistinguishable'];
            }
            if(count($errors) > 0) {
                echo createMessage($errors, 'fail');
            }
            else {
                $oldmail = $mixedAccountInformationArray['email'];
                $newemail = cleanSqlInput($_POST['chgmail_newmail']);
                $account = cleanSqlInput($_SESSION['user']);
                $key = random_string();
                $time = time();
                mail_CM($oldmail, $newemail, $account, $key);

                @odbc_exec($odbc_connect, '
                    INSERT INTO [' . $_CONFIG['db_databases']['web'] . '].[dbo].[VALIDATE] (
                        [key],
                        [type],
                        [account],
                        [timestamp],
                        [fieldAlfa]
                    ) VALUES (
                        \''.$key.'\',
                        2,
                        \''.$account.'\',
                        '.$time.',
                        \''.$newemail.'\'
                    )
                ');
                echo createMessage($_LANG['success_confirm_changeMail'], 'success');
            }
        }
        else {
            echo '
<div class="hint">
    Beachte, dass du einen Bestätigungslink an deine alte E-Mail Addresse gesendet bekommst, ohne den deine neue angegebene E-Mail Addresse nicht übernommen wird.
</div>';
        }
        echo '
<form action="" method="post">
    <input type="hidden" name="inputCheckTimestamp" value="' . time() . '" />
    <input type="hidden" name="inputCheckKey" value="' . random_string() . '" />

    <input type="password" name="chgmail_pw" id="chgmail_pw" class="password" required="required"/>
        <label class="labelRegistration" for="chgmail_pw" style="width:250px;">Aktuelles Passwort :</label>

    <input type="text" name="chgmail_newmail" id="chgmail_newmail" class="email" required="required"/>
        <label class="labelRegistration" for="chgmail_newmail" style="width:250px;">Neue E-Mail Addresse :</label>

    <input type="text" name="chgmail_confirmmail" id="chgmail_confirmmail" class="email" required="required"/>
        <label class="labelRegistration" for="chgmail_confirmmail" style="width:250px;">Neue E-Mail Addresse bestätigen :</label>

    <hr />
    <input type="submit" name="chgmail_submit" value="' . $_LANG['change_mail'] . '" class="button_70"/>
</form>';
    }
    elseif(isset($_GET['changePassword']) AND $mixedAccountInformationArray['BlockTime'] < date('Ymd')) {
        echo '
<p class="page_subtitle">' . $_LANG['accountpanel_changePassword_subTitle'] . '</p>';

        if(isset($_POST['chgpw_submit'])) {
            $errors = array();

            if(isSpamming($_POST['inputCheckTimestamp'], $_POST['inputCheckKey'], $_SESSION['inputCheckKey'])) {
                $errors[] = $_LANG['error_spam'];
            }
            if(empty($_POST['chgpw_oldpw']) OR empty($_POST['chgpw_newpw']) OR empty($_POST['chgpw_confirmpw'])) {
                $errors[] = $_LANG['error_fill_in_all_fields'];
            }
            if(md5($_CONFIG['allg_svr_salt'].$_POST['chgpw_oldpw']) != $mixedAccountInformationArray['password']) {
                $errors[] = $_LANG['error_password_wrong'];
            }
            if(strlen($_POST['chgpw_newpw']) < 6 OR strlen($_POST['chgpw_newpw']) > 12) {
                $errors[] = $_LANG['error_password_length'];
            }
            if($_POST['chgpw_newpw'] != $_POST['chgpw_confirmpw']) {
                $errors[] = $_LANG['error_passwords_indistinguishable'];
            }
            if(count($errors) > 0) {
                echo createMessage($errors, 'fail');
            }
            else {
                if(
                    odbc_exec($odbc_connect, '
                    UPDATE 	[' . $_CONFIG['db_databases']['acc'] . '].dbo.[ACCOUNT_TBL]
                    SET 	[id_no2] = [password],
                            [id_no1] = \''. md5($_CONFIG['allg_svr_salt'].cleanSqlInput($_POST['chgpw_newpw'])).'\',
                            [password] = \''. md5($_CONFIG['allg_svr_salt'].cleanSqlInput($_POST['chgpw_newpw'])).'\'
                    WHERE 	[account] = \''. $mixedAccountInformationArray['account'] .'\'')
                    AND
                        odbc_exec($odbc_connect, '
                        UPDATE 	[' . $_CONFIG['db_databases']['acc'] . '].dbo.[ACCOUNT_TBL_DETAIL]
                        SET 	[latestpassword] = \''. md5($_CONFIG['allg_svr_salt'].cleanSqlInput($_POST['chgpw_newpw'])).'\'
                        WHERE 	[account] = \''. $mixedAccountInformationArray['account'] .'\'')
                ) {
                    echo createMessage($_LANG['success_password_changed'], 'success');
                }
                else {
					echo createMessage($_LANG['error_password_not_changed'], 'success');
                }
            }
        }
        echo '
        <form action="" method="post">
            <input type="hidden" name="inputCheckTimestamp" value="' . time() . '" />
            <input type="hidden" name="inputCheckKey" value="' . random_string() . '" />
            <table>
                <tr>
                    <td width="200px">' . $_LANG['accountpanel_changePassword_actual_password'] . ' :</td>
                    <td><input type="password" name="chgpw_oldpw" class="password" required="required"/>
                </tr>
                <tr>
                    <td>' . $_LANG['accountpanel_changePassword_new_password'] . ' :</td>
                    <td><input type="password" name="chgpw_newpw" class="password" required="required"/>
                </tr>
                <tr>
                    <td>' . $_LANG['repeat'] . ' ' . $_LANG['accountpanel_changePassword_new_password'] . ' :</td>
                    <td><input type="password" name="chgpw_confirmpw" class="password" required="required"/>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="submit" name="chgpw_submit" value="' . $_LANG['change_password'] . '" class="button_70"/>
                </tr>
            </table>
        </form>';}
    elseif(isset($_GET['dLogs'])) {
        $mixedDonationLogs = @odbc_exec($odbc_connect, 'SELECT * FROM [' . $_CONFIG['db_databases']['web'] . '].dbo.[LOG_DONATIONS] WHERE account=\''.cleanSqlInput($_SESSION['user']).'\' ORDER BY timestamp DESC');

        echo '
<p class="page_subtitle">' . $_LANG['accountpanel_donationlogs_siteTitle'] . '</p>';
        if(odbc_num_rows($mixedDonationLogs) > 0) {
echo '
<div class="table">
<div class="thead">
<div class="tr">
    <div class="p20">' . $_LANG['type'] . '</div>
    <div class="p15 center">' . $_CONFIG['web_currencies']['real']['name'] . '</div>
    <div class="p15 center">' . $_CONFIG['web_currencies']['donate']['name'] . '</div>
    <div class="p25 center">' . $_LANG['state'] . '</div>
    <div class="p25 center">' . $_LANG['date_time'] . '</div>
</div>
</div>
<div class="tbody">';
            while($mixedDonationLogsArray = odbc_fetch_array($mixedDonationLogs)) {
                if($mixedDonationLogsArray['state'] == 0) {$mixedDonationLogsArray['state'] = 'Ausstehend';}
                elseif($mixedDonationLogsArray['state'] == 1) {$mixedDonationLogsArray['state'] = '<span class="green">Gutgeschrieben</span>';}
                elseif($mixedDonationLogsArray['state'] == 2) {$mixedDonationLogsArray['state'] = '<span class="red">Abgelehnt</span>';}

				echo '
<div class="tr">
    <div class="p20">' . donate_format($mixedDonationLogsArray['type']) . '</div>
    <div class="p15 center">' . $mixedDonationLogsArray['worth'] . ' &euro;</div>
    <div class="p15 center">' . $mixedDonationLogsArray['points'] . '</div>
    <div class="p25 center">' . $mixedDonationLogsArray['state'] . '</div>
    <div class="p25 center">' . date($_CONFIG['web_date_format']['full'], $mixedDonationLogsArray['timestamp']) . ' Uhr</div>
</div>';
            }
			echo '
</div>
</div>';
        }
        else {
            echo createMessage($_LANG['notify_not_donated'], 'hint');
        }
    }
    elseif(isset($_GET['bLogs'])) {
        $mixedBuyingLogs = odbc_exec($odbc_connect, 'SELECT * FROM [' . $_CONFIG['db_databases']['web'] . '].[dbo].[LOG_PURCHASES] WHERE [account] = \'' . cleanSqlInput($_SESSION['user']) . '\' ORDER BY [datetime] DESC');

        echo '
<p class="page_subtitle">' . $_LANG['accountpanel_buylogs_siteTitle'] . '</p>';
        if(odbc_num_rows($mixedBuyingLogs) > 0) {
            echo '
<div class="table">
<div class="thead">
<div class="tr">
    <div class="p15 center">&nbsp;</div>
    <div class="p35">' . $_LANG['name'] . '</div>
    <div class="p25 center">' . $_LANG['price'] . '</div>
    <div class="p25 center">' . $_LANG['date_time'] . '</div>
</div>
</div>
<div class="tbody">';
            while($mixedBuyingLogsArray = odbc_fetch_array($mixedBuyingLogs)) {
                echo '
<div class="tr">
    <div class="p15 center">' . $mixedBuyingLogsArray['itemcount'] . 'x</div>
    <div class="p35">' . $mixedBuyingLogsArray['itemname'] . '&nbsp;</div>
    <div class="p25 center">' . $mixedBuyingLogsArray['itemworth'] . '&nbsp;</div>
    <div class="p25 center">' . date($_CONFIG['web_date_format']['full'], strtotime($mixedBuyingLogsArray['datetime'])) . ' Uhr</div>
</div>';
            }
            echo '
</div>
</div>';
        }
        else {
			echo createMessage($_LANG['notify_nothing_bought'], 'hint');
        }

    }
    elseif(isset($_GET['gLogs'])) {
        $mixedGiftingLogs = odbc_exec($odbc_connect, 'SELECT * FROM [' . $_CONFIG['db_databases']['web'] . '].[dbo].[LOG_GIFTS] WHERE [accfrom] = \''.cleanSqlInput($_SESSION['user']).'\' ORDER BY [datetime] DESC');

        echo '
<p class="page_subtitle">' . $_LANG['accountpanel_giftlogs_siteTitle'] . '</p>';
        if(odbc_num_rows($mixedGiftingLogs) > 0) {
            echo '
<div class="table">
	<div class="thead">
		<div class="tr">
			<div class="p10 center">&nbsp;</div>
			<div class="p25">' . $_LANG['name'] . '</div>
			<div class="p15 center">' . $_LANG['price'] . '</div>
			<div class="p25 center">' . $_LANG['receiver'] . '</div>
			<div class="p25 center">' . $_LANG['date_time'] . '</div>
		</div>
	</div>
	<div class="tbody">';
            while($mixedGiftingLogsArray = odbc_fetch_array($mixedGiftingLogs)) {
                echo '
<div class="tr">
    <div class="p10 center">' . $mixedGiftingLogsArray['itemcount'] . 'x</div>
    <div class="p25">' . $mixedGiftingLogsArray['itemname'] . '</div>
    <div class="p15 center">' . $mixedGiftingLogsArray['itemworth'] . '</div>
    <div class="p25 center">' . $mixedGiftingLogsArray['charto'] . '</div>
    <div class="p25 center">' . date($_CONFIG['web_date_format']['full'], strtotime($mixedGiftingLogsArray['datetime'])) . ' Uhr</div>
</div>';
            }
            echo '
</div>
</div>';
        }
        else {
            echo createMessage($_LANG['notify_nothing_gifted'], 'hint');
        }
    }
    else {

        if($_GET['do'] == 'guildrejoin') {
            $resGuildRejoinRequest = @odbc_exec($odbc_connect, 'SELECT [account], [m_tGuildMember] FROM [' . $_CONFIG['db_databases']['chr'] . '].dbo.[CHARACTER_TBL] WHERE [m_szName] = \''.cleanSqlInput($_GET['name']).'\'');

            if(@odbc_result($resGuildRejoinRequest, 'm_tGuildMember') > date('YmdHis', time()) AND @odbc_result($resGuildRejoinRequest, 'account') == $_SESSION['user']) {
                odbc_exec($odbc_connect, 'UPDATE [' . $_CONFIG['db_databases']['chr'] . '].dbo.[CHARACTER_TBL] SET [m_tGuildMember] = 20121023160610 WHERE [m_szName] = \''.cleanSqlInput($_GET['name']).'\'');
            }
        }

        $mixedActiveCharacterInformation = @odbc_exec($odbc_connect, '
            SELECT
                C.[m_idPlayer],
                C.[m_szName],
                C.[m_dwSex],
                C.[m_nLevel],
                C.[MultiServer],
                C.[m_nJob],
                C.[TotalPlayTime],
                C.[BlockTime],
                C.[CreateTime],
                C.[m_tGuildMember],
                GT.[m_szGuild]
            FROM [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[CHARACTER_TBL] AS C
                LEFT JOIN [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[GUILD_MEMBER_TBL] AS GMT ON GMT.[m_idPlayer] = C.[m_idPlayer]
                LEFT JOIN [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[GUILD_TBL] AS GT ON GT.[m_idGuild] = GMT.[m_idGuild]
            WHERE C.[account] = \'' . cleanSqlInput($_SESSION['user']) . '\' AND [isblock] = \'F\'
            ORDER BY [playerslot] ASC
        ');
        $mixedDeletedCharacterInformation = @odbc_exec($odbc_connect, '
            SELECT
                C.[m_idPlayer],
                C.[m_szName],
                C.[m_dwSex],
                C.[m_nLevel],
                C.[MultiServer],
                C.[m_nJob],
                C.[TotalPlayTime],
                C.[BlockTime],
                C.[CreateTime]
            FROM [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[CHARACTER_TBL] AS C
            WHERE [account] = \'' . cleanSqlInput($_SESSION['user']) . '\' AND [isblock] != \'F\'
            ORDER BY [playerslot] ASC
        ');
        $strLastWebsiteLogin = @odbc_fetch_array(@odbc_exec($odbc_connect, '
            SELECT TOP 1
                [ip],
                [timestamp]
            FROM (
                SELECT TOP 2
                    [ip],
                    [timestamp]
                FROM
                [' . $_CONFIG['db_databases']['web'] . '].[dbo].[LOG_LOGIN]
                WHERE [account] = \'' . $mixedAccountInformationArray['account'] . '\'
                ORDER BY [timestamp] DESC
            ) AS A
            ORDER BY [timestamp] ASC
        '));
        $strLastIngameLogin = @odbc_fetch_array(@odbc_exec($odbc_connect, '
            SELECT  [remoteIP],
                    [Start_Time]
            FROM  [' . $_CONFIG['db_databases']['log'] . '].[dbo].[LOG_LOGIN_TBL]
            WHERE [account] = \'' . $mixedAccountInformationArray['account'] . '\'
            ORDER BY [Start_Time] DESC
        '));



        if($mixedAccountInformationArray['BlockTime'] >= date('Ymd')) {
            $status = '<b><span class="red">' . $_LANG['banned'] . ' <i>(' . $_LANG['until'] . ' '.substr($mixedAccountInformationArray['BlockTime'],6,2).'.'.substr($mixedAccountInformationArray['BlockTime'],4,2).'.'.substr($mixedAccountInformationArray['BlockTime'],0,4).')</i></span></b>';
        }
        else {
            $status = $_LANG['unbanned'];
        }


        echo '
<div class="accPanelInformation">
	<h2>' . $_LANG['general_information'] . ':</h2>
	<p><span class="title1">' . $_LANG['account'] . ':</span>'.cleanHtmlOutput($mixedAccountInformationArray['account']).'</p>
	<p><span class="title1">' . $_LANG['state'] . ':</span>'.$status.'</p>
	<p><span class="title1">' . $_LANG['group'] . ':</span>'.authgroup($mixedAccountInformationArray['m_chLoginAuthority']).'</p>
	<p><span class="title1">' . $_CONFIG['web_currencies']['donate']['name'] . ':</span><a href="index.php?site=donate"><img src="images/icons/shop/priceadd.png" alt="' . $_CONFIG['web_currencies']['donate']['name'] . ' (' . $_CONFIG['web_currencies']['donate']['symbol'] . ')"/></a> '.$_SESSION['cash'].' ' . $_CONFIG['web_currencies']['donate']['symbol'] . 's</p>
	<p><span class="title1">' . $_CONFIG['web_currencies']['vote']['name'] . ':</span><img src="images/icons/shop/votepoints.png" alt="' . $_CONFIG['web_currencies']['vote']['name'] . ' (' . $_CONFIG['web_currencies']['vote']['symbol'] . ')"/> '.$_SESSION['votepoints'].' ' . $_CONFIG['web_currencies']['vote']['symbol'] . 's</p>
</div>
<div class="accPanelInformation">
	<h2>' . $_LANG['security_information'] . ':</h2>
	<p><span class="title2">&nbsp;</span><a href="index.php?site=accountpanel&changePassword">' . $_LANG['change_password'] . '</a> | <a href="index.php?site=accountpanel&changeMail">' . $_LANG['change_mail'] . '</a></p>
	<p><span class="title2">' . $_LANG['mail'] . ':</span>'.cleanHtmlOutput($mixedAccountInformationArray['email']).'</p>
	<p><span class="title2">' . $_LANG['ip'] . ':</span>' . $_SERVER['REMOTE_ADDR'] . '</p>
	<p><span class="title2">' . $_LANG['accountpanel_details_last_websitelogin'] . ':</span>' . date($_CONFIG['web_date_format']['full'], $strLastWebsiteLogin['timestamp']) . ' <span class="acht kursiv">(' .  $strLastWebsiteLogin['ip'] . ')</span></p>
	<p><span class="title2">' . $_LANG['accountpanel_details_last_ingamelogin'] . ':</span>' . date($_CONFIG['web_date_format']['full'], strtotime($strLastIngameLogin['Start_Time'])) . ' <span class="acht kursiv">(' .  $strLastIngameLogin['remoteIP'] . ')</span></p>
</div>
<br class="clear"/>
<hr />';
        if(odbc_num_rows($mixedActiveCharacterInformation) > 0) {
            echo '
<h3>' . $_LANG['accountpanel_details_char_active'] . ' ' . $_LANG['characters'] . '</h3>';

            while($mixedCharacterInformationArray = @odbc_fetch_array($mixedActiveCharacterInformation)) {
                if($mixedCharacterInformationArray['m_tGuildMember'] > date('YmdHis', time()) AND empty($mixedCharacterInformationArray['m_szGuild'])) {
                    $m_tGuildMember = '<a href="index.php?site=accountpanel&amp;do=guildrejoin&amp;name=' . $mixedCharacterInformationArray['m_szName'] . '">Gildenwartezeit zurücksetzen</a>';
                }
                else {
                    $m_tGuildMember = '';
                }
echo '
<div class="characterWindow">
	<p class="name">' . cleanHtmlOutput($mixedCharacterInformationArray['m_szName']) . '</p>
	<p class="rank">' . getjob($mixedCharacterInformationArray['m_nJob']) . '</p>
	<br class="clear" />
	<hr />
	<p><span class="px120 bold">' . $_LANG['level'] . '</span>' . $mixedCharacterInformationArray['m_nLevel'] . '</p>
	<p><span class="px120 bold">' . $_LANG['state'] . '</span>' . getUserOnlineState($mixedCharacterInformationArray['MultiServer'], 1) . '</p>
	<p class="padding"><span class="px120 bold">' . $_LANG['created_on'] . '</span>' . date($_CONFIG['web_date_format']['date'], strtotime($mixedCharacterInformationArray['CreateTime'])) . '</p>
	<p><span class="px120 bold">' . $_LANG['playtime'] . '</span>' . sectohrs($mixedCharacterInformationArray['TotalPlayTime']) . '</p>
	<p><span class="px120 bold">' . $_LANG['guild'] . '</span>' . $mixedCharacterInformationArray['m_szGuild'] . '</p>
	<p><span class="px120 bold"></span>' . $m_tGuildMember . '</p>
</div>';
            }
        
            echo '
<br class="clear"/>';
		}

        if(odbc_num_rows($mixedDeletedCharacterInformation) > 0) {
            echo '
<hr /> 
<h3>' . $_LANG['accountpanel_details_char_delete'] . ' ' . $_LANG['characters'] . '</h3>';
            while($mixedCharacterInformationArray = @odbc_fetch_array($mixedDeletedCharacterInformation)) {
                echo '
<div class="characterWindow">
	<p><span class="px120 bold">' . $_LANG['name'] . '</span>' . cleanHtmlOutput($mixedCharacterInformationArray['m_szName']) . '</p>
	<p class="padding"><span class="px120 bold">' . $_LANG['level'] . '</span>' . cleanHtmlOutput($mixedCharacterInformationArray['m_nLevel']) . '</p>
	<p><span class="px120 bold">' . $_LANG['class'] . '</span>' . getjob($mixedCharacterInformationArray['m_nJob']) . '</p>
	<p class="padding"><span class="px120 bold">' . $_LANG['created_on'] . '</span>' . date($_CONFIG['web_date_format']['date'], strtotime($mixedCharacterInformationArray['CreateTime'])) . '</p>
	<p><span class="px120 bold">' . $_LANG['playtime'] . '</span>' . sectohrs($mixedCharacterInformationArray['TotalPlayTime']) . '</p>
	<p><span class="px120 bold">' . $_LANG['deleted_on'] . '</span>' . date($_CONFIG['web_date_format']['date'], strtotime($mixedCharacterInformationArray['BlockTime'])) . '</p>
</div>';

            }
            echo '
<br class="clear"/>';
		}
    }
}
else {
    echo createMessage($_LANG['error_not_logged'], 'fail');
}