Пример #1
0
<?php

session_start();
include_once "../inc/constants.inc.php";
include_once "../inc/class.users.inc.php";
$userObj = new SpinnereyeUsers();
if (!empty($_POST['action']) && isset($_SESSION['LoggedIn']) && $_SESSION['LoggedIn'] == 1) {
    if ($userObj->confirmAccount() === TRUE) {
        switch ($_POST['action']) {
            case 'changeemail':
                $status = $userObj->updateEmail() ? "changed" : "failed";
                header("Location: /account.php?email={$status}");
                break;
            case 'changepassword':
                $status = $userObj->updatePassword() ? "changed" : "nomatch";
                header("Location: /account.php?password={$status}");
                break;
            case 'deleteaccount':
                $userObj->deleteAccount();
                break;
            case 'testinput':
                error_log('testinput');
                $userObj->checkUsername();
                break;
            default:
                header("Location: /");
                break;
        }
    } else {
        $status = 'failed';
        header("Location: /account.php?password={$status}");