Пример #1
0
function dldc_reqister($username, $password, $email, $firstname, $lastname)
{
    if (!dldc_is_valid_username($username)) {
        dldc_error('Invalid username. Start with a letter and then add 2-23 digits, letters or underscores.');
    } elseif (!dldc_is_valid_password($password)) {
        dldc_error('Your password is not secure enough for this service.');
    } elseif ($password !== Common::getPostString('password_retype')) {
        dldc_error('You have to confirm your password by retyping it.');
    } elseif (empty($email)) {
        dldc_error('Please fill in an email address.');
    } else {
        dldc_cleanup();
        # DELETE YOUR OLD "PLAYER"!
        if (!DLDC_User::create($username, $password, $email, $firstname, $lastname)) {
            dldc_error('An error occured!');
        } else {
            dldc_message('You have been successfully registered!');
        }
    }
}