Beispiel #1
0
            }
        }
        // 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']) {
Beispiel #2
0
    /* Token used for cross site scripting security */
    if (!Token::isValid($_POST['token'])) {
        $errors[] = 'Token is invalid.';
    }
    $required_fields = array('new_email');
    foreach ($_POST as $key => $value) {
        if (empty($value) && in_array($key, $required_fields) === true) {
            $errors[] = 'You need to fill in all fields.';
            break 1;
        }
    }
    if (empty($errors) === true) {
        if (filter_var($_POST['new_email'], FILTER_VALIDATE_EMAIL) === false) {
            $errors[] = 'A valid email address is required.';
        } else {
            if (user_email_exist($_POST['new_email']) === true && $user_data['email'] !== $_POST['new_email']) {
                $errors[] = 'That email address is already in use.';
            }
        }
    }
}
?>
<h1>Settings</h1>

<?php 
if (isset($_GET['success']) === true && empty($_GET['success']) === true) {
    echo 'Your settings have been updated.';
} else {
    if (empty($_POST) === false && empty($errors) === true) {
        $update_data = array('email' => $_POST['new_email']);
        user_update_account($update_data);