Example #1
0
if (OFF == config_get_global('allow_signup')) {
    print_header_redirect('login_page.php');
    exit;
}
if (ON == config_get('signup_use_captcha') && get_gd_version() > 0 && helper_call_custom_function('auth_can_change_password', array())) {
    # captcha image requires GD library and related option to ON
    $t_key = utf8_strtolower(utf8_substr(md5(config_get('password_confirm_hash_magic_string') . $t_form_key), 1, 5));
    if ($t_key != $f_captcha) {
        trigger_error(ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR);
    }
    # Clear captcha cache
    session_delete(CAPTCHA_IMG);
}
email_ensure_not_disposable($f_email);
# notify the selected group a new user has signed-up
if (user_signup($f_username, $f_email)) {
    email_notify_new_account($f_username, $f_email);
}
form_security_purge('signup');
html_page_top1();
html_page_top2a();
?>

<br />
<div align="center">
<table class="width50" cellspacing="1">
<tr>
	<td class="center">
		<b><?php 
echo lang_get('signup_done_title');
?>
Example #2
0
 private function get_user($p_parsed_from)
 {
     if ($this->_mail_use_reporter) {
         // Always report as mail_reporter
         $t_reporter_id = $this->_mail_reporter_id;
     } else {
         // Try to get the reporting users id
         $t_reporter_id = $this->get_userid_from_email($p_parsed_from['email']);
         if (!$t_reporter_id) {
             if ($this->_mail_auto_signup) {
                 // So, we have to sign up a new user...
                 $t_new_reporter_name = $this->prepare_username($p_parsed_from);
                 if ($t_new_reporter_name !== FALSE && $this->validate_email_address($p_parsed_from['email'])) {
                     if (user_signup($t_new_reporter_name, $p_parsed_from['email'])) {
                         # notify the selected group a new user has signed-up
                         email_notify_new_account($t_new_reporter_name, $p_parsed_from['email']);
                         $t_reporter_id = user_get_id_by_email($p_parsed_from['email']);
                         $t_reporter_name = $t_new_reporter_name;
                         $t_realname = $this->prepare_realname($p_parsed_from, $t_reporter_name);
                         if ($t_realname !== FALSE) {
                             user_set_realname($t_reporter_id, $t_realname);
                         }
                     }
                 }
                 if (!$t_reporter_id) {
                     $this->custom_error('Failed to create user based on: ' . $p_parsed_from['From']);
                 }
             }
         }
         if ((!$t_reporter_id || !user_is_enabled($t_reporter_id)) && $this->_mail_fallback_mail_reporter) {
             // Fall back to the default mail_reporter
             $t_reporter_id = $this->_mail_reporter_id;
         }
     }
     if ($t_reporter_id && user_is_enabled($t_reporter_id)) {
         if (!isset($t_reporter_name)) {
             $t_reporter_name = user_get_field($t_reporter_id, 'username');
         }
         $t_authattemptresult = auth_attempt_script_login($t_reporter_name);
         # last attempt for fallback
         if ($t_authattemptresult === FALSE && $this->_mail_fallback_mail_reporter && $t_reporter_id != $this->_mail_reporter_id && user_is_enabled($this->_mail_reporter_id)) {
             $t_reporter_id = $this->_mail_reporter_id;
             $t_reporter_name = user_get_field($t_reporter_id, 'username');
             $t_authattemptresult = auth_attempt_script_login($t_reporter_name);
         }
         if ($t_authattemptresult === TRUE) {
             user_update_last_visit($t_reporter_id);
             return (int) $t_reporter_id;
         }
     }
     // Normally this function does not get here unless all else failed
     $this->custom_error('Could not get a valid reporter. Email will be ignored');
     return FALSE;
 }
if (OFF == config_get('allow_signup')) {
    util_header_redirect($g_login_page);
}
print_html_top();
print_head_top();
print_title($g_window_title);
print_css($g_css_inc_file);
print_meta_inc($g_meta_inc_file);
print_head_bottom();
print_body_top();
print_header($g_page_title);
print_top_page($g_top_page_inc);
if (isset($submit)) {
    $t_username = gpc_get_string('f_username');
    $t_email = gpc_get_string('f_email');
    if (user_signup($t_username, $t_email)) {
        echo <<<EOT
\t\t\t\t<div align="center">
\t\t\t\t\t<p>An e-mail is sent to <a href="mailto:{$t_email}">{$t_email}</a> with the login details. It is recommended to change your password on first login.</p>
\t\t\t\t\t[ <a href="{$g_login_page}"><strong>Login</strong></a> ]
\t\t\t\t</div>
EOT;
    } else {
        # @@@@ proper error
        echo "Unable to signup user.<br />";
    }
    print_bottom_page($g_bottom_page_inc);
    print_footer(__FILE__);
    print_body_bottom();
    print_html_bottom();
    exit;
Example #4
0
                echo "<script language='javascript'>";
                echo " location='/main/footer.php';";
                echo "</script>";
            } else {
                echo "<script>alert('{$result}'); history.go(-1);</script>";
            }
        }
    }
}
if (isset($_POST["submit"])) {
    $submit_type = $_POST["submit"];
    if ($submit_type == "Login") {
        user_login($username, $password);
    } else {
        if ($submit_type == "SignUp") {
            user_signup($username, $password);
        }
    }
} else {
    if (isset($_POST["device"])) {
        if ($username == "") {
            $obj->status = 'error';
            $obj->errString = 'please input your username';
        } else {
            if ($password == "") {
                $obj->status = 'error';
                $obj->errString = 'please input your password';
            } else {
                $result = check_username_password($username, $password, $token);
                $obj->username = $username;
                if ($result == 'ok') {