Example #1
0
 $rank = (int) gpc('rank', 'P', '');
 $exp = (int) gpc('exp', 'P', '');
 /*$user_store_space = (int)gpc('user_store_space','P','');
 		$user_file_types = trim(gpc('user_file_types','P',''));
 		$down_flow_count = (int)gpc('down_flow_count','P','');
 		$view_flow_count = (int)gpc('view_flow_count','P','');*/
 $how_downs = (int) gpc('how_downs', 'P', '');
 $how_money = (int) gpc('how_money', 'P', '');
 if ($settings['online_demo']) {
     $error = true;
     $sysmsg[] = __('online_demo_deny');
 }
 if (checklength($username, 2, 60)) {
     $error = true;
     $sysmsg[] = __('username_error');
 } elseif (is_bad_chars($username)) {
     $error = true;
     $sysmsg[] = __('username_has_bad_chars');
 } else {
     $rs = $db->fetch_one_array("select username from {$tpf}users where username='******' limit 1");
     if ($rs) {
         if (strcasecmp($username, $rs['username']) == 0) {
             $error = true;
             $sysmsg[] = __('username_already_exists');
         }
     }
     unset($rs);
 }
 if (display_plugin('api', 'open_uc_plugin', $settings['connect_uc'], 0)) {
     if ($settings['connect_uc_type'] == 'phpwind') {
         $checkuser = uc_check_username($username);
Example #2
0
function auth_task_guest()
{
    global $db, $tpf, $pd_uid, $pd_gid;
    form_auth(gpc('formhash', 'P', ''), formhash());
    $username = trim(gpc('username', 'P', ''));
    $password = trim(gpc('password', 'P', ''));
    $confirm_password = trim(gpc('confirm_password', 'P', ''));
    $email = trim(gpc('email', 'P', ''));
    $ref = trim(gpc('ref', 'P', ''));
    if (checklength($username, 2, 60)) {
        $error = true;
        $sysmsg[] = __('invalid_username');
    } elseif (is_bad_chars($username)) {
        $error = true;
        $sysmsg[] = __('username_has_bad_chars');
    } else {
        $rs = $db->fetch_one_array("select username from {$tpf}users where username='******' and userid<>'{$pd_uid}' limit 1");
        if ($rs) {
            if (strcasecmp($username, $rs['username']) == 0) {
                $error = true;
                $sysmsg[] = __('username_already_exists');
            }
        }
        unset($rs);
    }
    if (checklength($password, 6, 20)) {
        $error = true;
        $sysmsg[] = __('invalid_password');
    } else {
        if ($password == $confirm_password) {
            $md5_pwd = md5($password);
        } else {
            $error = true;
            $sysmsg[] = __('confirm_password_invalid');
        }
    }
    if (!checkemail($email)) {
        $error = true;
        $sysmsg[] = __('invalid_email');
    } else {
        $rs = $db->fetch_one_array("select email from {$tpf}users where email='{$email}' and userid<>'{$pd_uid}' limit 1");
        if ($rs) {
            if (strcasecmp($email, $rs['email']) == 0) {
                $error = true;
                $sysmsg[] = __('email_already_exists');
            }
            unset($rs);
        }
    }
    if (!$error) {
        $ins = array('username' => $username, 'password' => $md5_pwd, 'email' => $email, 'space_name' => $username . __('file'), 'can_edit' => 0);
        $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$pd_uid}'");
        pd_setcookie('phpdisk_zcore_info', pd_encode("{$pd_uid}\t{$pd_gid}\t{$username}\t{$md5_pwd}\t{$email}"), 86400 * 3);
        $sysmsg[] = __('guest_set_account_success');
        tb_redirect($ref, $sysmsg);
    } else {
        tb_redirect('back', $sysmsg);
    }
}