if (filter_var($_POST['account'], FILTER_VALIDATE_EMAIL) && EmailExists($_POST['account'])) {
            $reset_password_success = Reset_Password($_POST['password'], $_POST['account']);
            if ($reset_password_success == true) {
                $_SESSION['current_status'] = "passwordresetsuccessfully";
            } else {
                $_SESSION['current_status'] = "couldnotresetpassword";
            }
        } else {
            $_SESSION['current_status'] = "passwordresetinvalid";
        }
    } else {
        $_SESSION['current_status'] = "newpasswordblank";
    }
    header('Location: ./');
} elseif (isset($_GET['accountsettings'])) {
    if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) && ($_POST['email'] == Get_User_Email($current_user) || !EmailExists($_POST['email']))) {
        $public_name = isset($_POST['publicname']) && $_POST['publicname'] != "" ? $_POST['publicname'] : "Someone";
        if (query("UPDATE `users` SET `email`='" . $_POST['email'] . "', `public_name`='" . htmlspecialchars($public_name, ENT_QUOTES) . "', `allow_email`=" . ($_POST['allowemails'] != "on" ? 0 : 1) . " WHERE `id`=" . $current_user . ";")) {
            $_SESSION['current_status'] = "accountsettingsupdated";
        } else {
            $_SESSION['current_status'] = "couldnotupdatesettings";
        }
    } else {
        $_SESSION['current_status'] = "accountsettingsinvalid";
    }
    header('Location: ./');
} elseif (isset($_GET['loggedout']) && $current_user <= 0) {
    $notificationMessage = "You have been successfully logged out.<br>You will only be able to use the dictionary saved to your browser.";
} elseif ($current_user > 0) {
    if ($notificationMessage != "") {
        $notificationMessage = "Welcome back, " . Get_Public_Name_By_Id($current_user) . "!<br>" . $notificationMessage;
示例#2
0
    <?php 
}
?>

    <div id="infoScreen" style="display:none;">
        <div id="infoBackgroundFade" class="fixedFade" onclick="HideInfo()"></div>
        <div id="infoPage" class="fixedPage">
            <span id="infoScreenCloseButton" class="clickable rightButton" onclick="HideInfo()">Close</span>
            <div id="infoText"></div>
        </div>
    </div>

    <?php 
if ($current_user > 0) {
    $user_email = Get_User_Email($current_user);
    ?>
    <div id="accountSettingsScreen" style="display:none;">
        <div id="accountSettingsBackgroundFade" class="fixedFade" onclick="HideAccountSettings()"></div>
        <div id="accountSettingsPage" class="fixedPage">
            <span id="accountSettingsScreenCloseButton" class="clickable rightButton" onclick="HideAccountSettings()">Close</span>
            <div class="settingsCol"><form id="accountSettingsForm" method="post" action="?accountsettings">
                <h2>Account Settings</h2>
                <label><span>Email</span>
                    <input type="email" id="accountSettingsEmailField" name="email" value="<?php 
    echo $user_email;
    ?>
" onchange="WarnEmailChange()" />
                    <input type="hidden" id="accountSettingsPreviousEmailField" name="previousemail" value="<?php 
    echo $user_email;
    ?>