} 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;
    } else {
        $notificationMessage = "Welcome back, " . Get_Public_Name_By_Id($current_user) . "!";
    }
}
Example #2
0
                    <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;
    ?>
" />
                </label>
                <div id="accountSettingsEmailChangeWarning" style="display:none;font-weight:bold;color:#dd5500;font-size:11px;margin-bottom:10px;">If you change your email address, please note that you will no longer be able to log in with your old email address, <?php 
    echo $user_email;
    ?>
.<br>Change it back unless you are completely sure that you want to change your email address!</div>
                <label><span>Public Name <span class="clickable inline-button" onclick="ExplainPublicName()">?</span></span>
                    <input type="text" id="accountSettingsPublicNameField" name="publicname" value="<?php 
    echo Get_Public_Name_By_Id($current_user);
    ?>
" />
                </label>
                <label style="display:inline;"><b>Allow Emails</b>
			        <input type="checkbox" id="createAccountAllowEmailsField" name="allowemails" checked="checked" />
			    </label> <span class="clickable inline-button" onclick="ExplainAllowEmails()">?</span>
                <div id="accountSettingsError" style="font-weight:bold;color:red;"></div>
                <button type="submit" id="accountSettingsSubmitButton" onclick="ValidateAccountSettings(); return false;">Save Settings</button>
                <br>
            </form></div>
            <div class="settingsCol">
                <br>
                <h2>Reset Your Password</h2>
                <p style="font-size: 12px;">Click the button below to reload the page and show the Reset Password form. Filling out this form will instantly change your password, and you will need to log in using the new password from that point forward.</p>
                <span id="resetPassword" class="clickable" onclick="this.innerHTML='Loading...';LoggedInResetPassword();" style="margin-top:20px;">Reset Password</span>