/**
  * 在UC和DZX进行用户初始化注册
  * @access protected
  * @return boolen
  */
 function _regToUCDZX()
 {
     global $_G;
     $this->uid = (int) uc_user_register($this->username, $this->password, $this->email, $this->questionid, $this->answer);
     if ($this->uid > 0) {
         //在有UC的情况下,附属论坛的members表password列并不存储真实密码,只是用于cookies登陆状态校样。
         $init_arr = explode(',', $_G['setting']['initcredits']);
         $userdata = array('uid' => $this->uid, 'username' => $this->username, 'password' => md5(rand(100000, 999999)), 'email' => $this->email, 'adminid' => 0, 'groupid' => $this->groupid, 'regdate' => $this->timestamp, 'credits' => $init_arr[0], 'timeoffset' => 9999);
         DB::insert('common_member', $userdata);
         $status_data = array('uid' => $this->uid, 'regip' => $this->ip, 'lastip' => $this->ip, 'lastvisit' => $this->timestamp, 'lastactivity' => $this->timestamp, 'lastpost' => 0, 'lastsendmail' => 0);
         DB::insert('common_member_status', $status_data);
         $profile['uid'] = $this->uid;
         DB::insert('common_member_profile', $profile);
         DB::insert('common_member_field_forum', array('uid' => $this->uid));
         DB::insert('common_member_field_home', array('uid' => $this->uid));
         //初始化积分
         $count_data = array('uid' => $this->uid, 'extcredits1' => $init_arr[1], 'extcredits2' => $init_arr[2], 'extcredits3' => $init_arr[3], 'extcredits4' => $init_arr[4], 'extcredits5' => $init_arr[5], 'extcredits6' => $init_arr[6], 'extcredits7' => $init_arr[7], 'extcredits8' => $init_arr[8]);
         DB::insert('common_member_count', $count_data);
         DB::insert('common_setting', array('skey' => 'lastmember', 'svalue' => $this->username), false, true);
         manyoulog('user', $this->uid, 'add');
         return true;
     } else {
         return false;
     }
 }
예제 #2
0
 static function user_register($username, $password, $email)
 {
     global $kekezu;
     $member_obj = new Keke_witkey_member_class();
     $space_obj = new Keke_witkey_space_class();
     $slt = kekezu::randomkeys(6);
     $pwd = self::get_password($password, $slt);
     if ($kekezu->_sys_config['user_intergration'] == 2) {
         require_once S_ROOT . '/uc_client/client.php';
         $reg_uid = uc_user_register($username, $password, $email);
     }
     die;
     if ($reg_uid > 0 || $kekezu->_sys_config['user_intergration'] == '1') {
         $reg_uid and $member_obj->setUid($reg_uid);
         $member_obj->setEmail($email);
         $member_obj->setUsername($username);
         $member_obj->setPassword($pwd);
         $member_obj->setRand_code($slt);
         $reg_uid = $member_obj->create_keke_witkey_member();
         $space_obj->setUid($reg_uid);
         $kekezu->_sys_config[allow_reg_action] == 1 and $space_obj->setStatus(2) or $space_obj->setStatus(1);
         $space_obj->setUsername($username);
         $space_obj->setPassword($pwd);
         $space_obj->setSec_code($pwd);
         $space_obj->setEmail($email);
         $space_obj->setReg_time(time());
         $space_obj->setReg_ip(kekezu::get_ip());
         $space_obj->create_keke_witkey_space();
         $info = array('uid' => $reg_uid, 'username' => $username, 'email' => $email);
         $kekezu->_sys_config[allow_reg_action] == 1 and self::send_email_action_user($info);
         return $info;
     } else {
         return false;
     }
 }
예제 #3
0
 function register()
 {
     $activeuser = uc_get_user($this->base->post['username']);
     if ($activeuser) {
         $this->base->message('该用户无需注册,请直接登录!<br><a href="index.php?user/login">继续</a>');
     }
     $uid = uc_user_register($this->base->post['username'], $this->base->post['password'], $this->base->post['email']);
     if ($uid <= 0) {
         if ($uid == -1) {
             $this->base->message('用户名不合法');
         } elseif ($uid == -2) {
             $this->base->message('包含要允许注册的词语');
         } elseif ($uid == -3) {
             $this->base->message('用户名已经存在');
         } elseif ($uid == -4) {
             $this->base->message('Email 格式有误');
         } elseif ($uid == -5) {
             $this->base->message('Email 不允许注册');
         } elseif ($uid == -6) {
             $this->base->message('该 Email 已经被注册');
         } else {
             $this->base->message('未定义');
         }
     } else {
         if (isset($this->base->post['access_token'])) {
             $uid = $_ENV['user']->add($this->base->post['username'], $this->base->post['password'], $this->base->post['email'], $uid, $this->base->post['access_token']);
         } else {
             $_ENV['user']->add($this->base->post['username'], $this->base->post['password'], $this->base->post['email'], $uid);
         }
         $_ENV['user']->refresh($uid);
         $ucsynlogin = uc_user_synlogin($uid);
         $this->base->message('注册成功' . $ucsynlogin . '<br><a href="' . $_SERVER['PHP_SELF'] . '">继续</a>');
     }
 }
예제 #4
0
function addUserManually($username, $password, $email = '*****@*****.**')
{
    @(include_once './common.php');
    @(include_once S_ROOT . 'uc_client/client.php');
    global $_SGLOBAL;
    global $_SC;
    $newuid = @uc_user_register($username, $password, $email);
    if ($newuid <= 0) {
        if ($newuid == -1) {
            showmessage('user_name_is_not_legitimate');
        } elseif ($newuid == -2) {
            showmessage('include_not_registered_words');
        } elseif ($newuid == -3) {
            showmessage('user_name_already_exists');
        } elseif ($newuid == -4) {
            showmessage('email_format_is_wrong');
        } elseif ($newuid == -5) {
            showmessage('email_not_registered');
        } elseif ($newuid == -6) {
            showmessage('email_has_been_registered');
        } else {
            showmessage('register_error');
        }
    } else {
        //register succeed
        $q_actionlog = $_SGLOBAL['db']->query("insert into " . $_SC['tablepre'] . "actionlog SET uid ='{$newuid}', action='register', dateline='" . $_SGLOBAL['timestamp'] . "'");
        return $newuid;
    }
}
예제 #5
0
 function register($username, $password, $email, $type = 'g')
 {
     if (empty($username) || empty($password) || !validateEmail($email)) {
         return false;
     }
     $rt = uc_user_register($username . '#' . $type, $password, $email);
     if ($rt > 0) {
         return array('result' => $rt, 'message' => 'register success!!');
     }
     switch ($rt) {
         case -1:
             $return = array('result' => -1, 'message' => 'invalid username!!');
             break;
         case -2:
             $return = array('result' => -2, 'message' => 'illegal words has beed found!!');
             break;
         case -3:
             $return = array('result' => -3, 'message' => 'usename exist!!');
             break;
         case -4:
             $return = array('result' => -4, 'message' => 'invalid email address!!');
             break;
         case -5:
             $return = array('return' => -5, 'message' => 'email not allow!!');
             break;
         case -6:
             $return = array('return' => -6, 'message' => 'email has been used!!');
             break;
     }
     return $return;
 }
예제 #6
0
 /**
  * 注册新用户
  */
 public function register($username, $password, $email, $gender)
 {
     $this->_ucenter_init();
     $uc_uid = uc_user_register($username, $password, $email);
     if ($uc_uid < 0) {
         switch ($uc_uid) {
             case -1:
                 $this->_error = L('invalid_user_name');
                 break;
             case -2:
                 $this->_error = L('blocked_user_name');
                 break;
             case -3:
                 $this->_error = L('username_exists');
                 break;
             case -4:
                 $this->_error = L('email_error');
                 break;
             case -5:
                 $this->_error = L('blocked_email');
                 break;
             case -6:
                 $this->_error = L('email_exists');
                 break;
         }
         return false;
     }
     //返回本地数据
     return array('uc_uid' => $uc_uid, 'username' => $username, 'password' => $password, 'email' => $email, 'gender' => $gender);
 }
예제 #7
0
 function register($_username, $_password, $_email)
 {
     if ($this->ucenter_charset != 'utf-8') {
         $result = uc_user_register(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password, $_email);
     } else {
         $result = uc_user_register($_username, $_password, $_email);
     }
     switch ($result) {
         default:
             $uid = $this->model('account')->user_register($_username, $_password, $_email);
             if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') {
                 $this->model('active')->active_user_by_uid($uid);
             }
             return array('user_info' => $this->model('account')->get_user_info_by_username($_username), 'uc_uid' => $result, 'username' => $_username, 'email' => $_email);
             break;
         case -1:
             return '用户名不合法';
             break;
         case -2:
             return '用户名包含不允许注册的词语';
             break;
         case -3:
             return '用户名已经存在';
             break;
         case -4:
             return 'Email 格式有误';
             break;
         case -5:
             return 'Email 不允许注册';
             break;
         case -6:
             return '该 Email 已经被注册';
             break;
     }
 }
 private function _syncUCenter($uid, $email, $uname, $password)
 {
     if (UC_SYNC) {
         $uc_uid = uc_user_register($uname, $password, $email);
         if ($uc_uid) {
             ts_add_ucenter_user_ref($uid, $uc_uid, $uname);
         }
     }
 }
예제 #9
0
파일: uc.php 프로젝트: noikiy/mdwp
function zuitu_uc_register($email, $username, $password) {
	if (!function_exists('uc_user_login')) return true;
	if (!defined('UC_API')) return true;
	if (strtolower(UC_CHARSET)!='utf-8') { 
		$username = mb_convert_encoding($username, UC_CHARSET, 'UTF-8'); 
		}
	$uid = uc_user_register($username, $password, $email);
	DB::Query('SET NAMES UTF8;');
	return $uid > 0;
}
예제 #10
0
파일: fun_user.php 프로젝트: dalinhuang/yy
function user_register($username, $password, $member_type = 0, $email, $uc_reg = true)
{
    global $db, $timestamp, $_CFG, $online_ip, $QS_pwdhash;
    $member_type = intval($member_type);
    $ck_username = get_user_inusername($username);
    $ck_email = get_user_inemail($email);
    if ($member_type == 0) {
        return -1;
    } elseif (!empty($ck_username)) {
        return -2;
    } elseif (!empty($ck_email)) {
        return -3;
    }
    $pwd_hash = randstr();
    $password_hash = md5(md5($password) . $pwd_hash . $QS_pwdhash);
    $setsqlarr['username'] = $username;
    $setsqlarr['password'] = $password_hash;
    $setsqlarr['pwd_hash'] = $pwd_hash;
    $setsqlarr['email'] = $email;
    $setsqlarr['utype'] = intval($member_type);
    $setsqlarr['reg_time'] = $timestamp;
    $setsqlarr['reg_ip'] = $online_ip;
    $insert_id = inserttable(table('members'), $setsqlarr, true);
    if ($member_type == "1") {
        if (!$db->query("INSERT INTO " . table('members_points') . " (uid) VALUES ('{$insert_id}')")) {
            return false;
        }
        if (!$db->query("INSERT INTO " . table('members_setmeal') . " (uid) VALUES ('{$insert_id}')")) {
            return false;
        }
        $points = get_cache('points_rule');
        include_once QISHI_ROOT_PATH . 'include/fun_company.php';
        set_consultant($insert_id);
        if ($points['reg_points']['value'] > 0) {
            report_deal($insert_id, $points['reg_points']['type'], $points['reg_points']['value']);
            $operator = $points['reg_points']['type'] == "1" ? "+" : "-";
            write_memberslog($insert_id, 1, 9001, $username, "新注册会员,({$operator}{$points['reg_points']['value']}),(剩余:{$points['reg_points']['value']})", 1, 1010, "注册会员系统自动赠送积分", "{$operator}{$points['reg_points']['value']}", "{$points['reg_points']['value']}");
            //积分变更记录
            write_setmeallog($insert_id, $username, "注册会员系统自动赠送:({$operator}{$points['reg_points']['value']}),(剩余:{$points['reg_points']['value']})", 1, '0.00', '1', 1, 1);
        }
        if ($_CFG['reg_service'] > 0) {
            set_members_setmeal($insert_id, $_CFG['reg_service']);
            $setmeal = get_setmeal_one($_CFG['reg_service']);
            write_memberslog($insert_id, 1, 9002, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}", 2, 1011, "开通服务(系统赠送)", "-", "-");
            //套餐变更记录
            write_setmeallog($insert_id, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}", 1, '0.00', '1', 2, 1);
        }
    }
    if (defined('UC_API') && $uc_reg) {
        include_once QISHI_ROOT_PATH . 'uc_client/client.php';
        $uc_reg_uid = uc_user_register($username, $password, $email);
    }
    write_memberslog($insert_id, $member_type, 1000, $username, "注册成为会员");
    return $insert_id;
}
예제 #11
0
 public function UcenterReg($data)
 {
     $db = new dbstuff();
     $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, 0);
     $uid = uc_user_register($data['username'], $data['password'], $data['email']);
     if ($uid <= 0) {
         return $uid;
         /*	if($uid == -1) {
         				return '用户名不合法';
         			} elseif($uid == -2) {
         				return '包含要允许注册的词语';
         			} elseif($uid == -3) {
         				return '用户名已经存在';
         			} elseif($uid == -4) {
         				return 'Email 格式有误';
         			} elseif($uid == -5) {
         				return 'Email 不允许注册';
         			} elseif($uid == -6) {
         				return '该 Email 已经被注册';
         			} else {
         				return '未定义';
         			}*/
     } else {
         $username = $data['username'];
         $sql = "SELECT `username`,`password` FROM " . DZ_DBTABLEPRE . "common_member WHERE `uid`={$uid}";
         $result = $db->query($sql);
         if ($db->num_rows($result) == 0) {
             $sql = "SELECT `username`,`password` FROM " . UC_DBTABLEPRE . "members WHERE `uid`={$uid}";
             $result = $db->query($sql);
             $row = $db->fetch_array($result);
             //激活
             $sql = "insert into " . DZ_DBTABLEPRE . "common_member set regdate='" . time() . "',uid='{$uid}',email='" . $data['email'] . "',username='******'username'] . "',password='******'password'] . "',timeoffset=9999";
             $db->query($sql);
             $sql = "insert into " . DZ_DBTABLEPRE . "common_member_status set uid='{$uid}', regip='{$_SERVER['REMOTE_ADDR']}',lastip='{$_SERVER['REMOTE_ADDR']}',lastvisit=" . time() . ", lastactivity=" . time() . ',lastpost=0, lastsendmail=0';
             $db->query($sql);
             $sql = "insert into " . DZ_DBTABLEPRE . "common_member_profile set uid='{$uid}'";
             $db->query($sql);
             $sql = "insert into " . DZ_DBTABLEPRE . "common_member_field_forum set uid='{$uid}'";
             $db->query($sql);
             $sql = "insert into " . DZ_DBTABLEPRE . "common_member_field_home set uid='{$uid}' ";
             $db->query($sql);
             $sql = "insert into " . DZ_DBTABLEPRE . "common_member_count set uid='{$uid}' ";
             $db->query($sql);
             $db->query('UPDATE ' . DZ_DBTABLEPRE . "common_setting SET svalue='{$data['username']}' WHERE skey='lastmember'");
             //exit;
         }
     }
     unset($db);
     return $uid;
 }
예제 #12
0
 public function register($registration)
 {
     $this->initDiscuzApi();
     if (UC_CHARSET == 'gbk') {
         $registration['nickname'] = iconv('UTF-8', 'gb2312', $registration['nickname']);
     }
     $result = uc_user_register($registration['nickname'], $registration['password'], $registration['email']);
     if ($result < 0) {
         $result = $this->convertApiResult($result);
         throw new \RuntimeException("{$result[0]}:{$result[1]}");
     }
     $registration['id'] = $result;
     return $registration;
 }
예제 #13
0
파일: member.php 프로젝트: boylzj/omguitar
 /**
  * 添加会员
  */
 public function add()
 {
     if (isset($_POST['dosubmit'])) {
         $username = isset($_POST['username']) && trim($_POST['username']) ? trim($_POST['username']) : showmessage(L('nameerror'), HTTP_REFERER);
         $password = isset($_POST['password']) && trim($_POST['password']) ? trim($_POST['password']) : showmessage(L('password_can_not_be_empty'), HTTP_REFERER);
         $email = isset($_POST['email']) && is_email($_POST['email']) ? trim($_POST['email']) : showmessage(L('email_format_incorrect'), HTTP_REFERER);
         $regdate = SYS_TIME;
         if ($this->db->get_one(array('username' => $username))) {
             showmessage(L('user_already_exist'), HTTP_REFERER);
         } elseif ($this->db->get_one(array('email' => $email))) {
             showmessage(L('email_already_exist'), HTTP_REFERER);
         } else {
             if (strlen($password) > 20 || strlen($password) < 6) {
                 showmessage(L('password_len_error'), HTTP_REFERER);
             }
             $old_password = $password;
             list($password, $random) = creat_password($password);
             //UCenter会员注册
             $ucuserid = 0;
             if ($this->config['ucuse']) {
                 pc_base::load_config('uc_config');
                 include PHPCMS_PATH . 'api/uc_client/client.php';
                 $uid = uc_user_register($username, $old_password, $email, $random);
                 switch ($uid) {
                     case '-3':
                     case '-6':
                     case '-2':
                     case '-5':
                     case '-1':
                     case '-4':
                         showmessage(L('ucenter_error_code', array('code' => $uid)), HTTP_REFERER);
                         break;
                     default:
                         $ucuserid = $uid;
                         break;
                 }
             }
             if ($uid = $this->db->insert(array('username' => $username, 'password' => $password, 'random' => $random, 'email' => $email, 'regdate' => $regdate, 'lastdate' => SYS_TIME, 'type' => 'app', 'regip' => ip(), 'appname' => 'phpsso', 'ucuserid' => $ucuserid), 1)) {
                 /*插入消息队列*/
                 $noticedata = array('uid' => $uid, 'username' => $username, 'password' => $password, 'random' => $random, 'email' => $email, 'regip' => ip());
                 messagequeue::add('member_add', $noticedata);
                 showmessage(L('member_add') . L('operation_success'), 'm=admin&c=member&a=manage');
             } else {
                 showmessage(L('database_error'), HTTP_REFERER);
             }
         }
     } else {
         include $this->admin_tpl('member_add');
     }
 }
예제 #14
0
 function user_register($reg_username, $reg_pwd, $reg_email, $reg_code, $check_code = true, $old_pwd = null, $reg_user_type, $reg_user_type_xf, $is_oauth = null)
 {
     global $kekezu;
     global $_lang;
     $reg_uid = null;
     $this->_reg_username = $reg_username = kekezu::escape($reg_username);
     $this->_reg_pwd = md5($reg_pwd);
     $this->_reg_email = $reg_email;
     $this->_check_code = $check_code;
     $this->_reg_user_type = $reg_user_type;
     //增加user_type
     $content = $this->check_all($reg_username, $reg_email, $reg_code, $is_oauth);
     if ($content !== true) {
         $tips['errors']['account'] = $content;
         kekezu::show_msg($tips, NULL, NULL, NULL, 'error');
     }
     if ($kekezu->_sys_config['user_intergration'] == 2) {
         require_once S_ROOT . '/uc_client/client.php';
         $reg_uid = uc_user_register($this->_reg_username, $reg_pwd, $this->_reg_email);
         if ($reg_uid < 0) {
             switch ($reg_uid) {
                 case -1:
                     $msg = '用户名不合法';
                     break;
                 case -2:
                     $msg = '包含不允许注册的词语';
                     break;
                 case -3:
                     $msg = '用户名已经存在';
                     break;
                 case -4:
                     $msg = 'Email 格式有误';
                     break;
                 case -5:
                     $msg = 'Email 不允许注册';
                     break;
                 case -6:
                     $msg = '该 Email 已经被注册';
                     break;
                 default:
                     $msg = '未知错误';
                     break;
             }
             kekezu::show_msg($msg, NULL, 3, NULL, 'warning');
             die;
         }
     }
     return $this->save_userinfo($this->_reg_username, $this->_reg_email, $reg_uid, $this->_reg_user_type, $reg_user_type_xf);
 }
 /**
  * 在UC和DZX进行用户初始化注册
  * @access protected
  * @return boolen
  */
 function _regToUCDZX()
 {
     global $_G;
     $this->uid = (int) uc_user_register($this->username, $this->password, $this->email, $this->questionid, $this->answer);
     //----------------add by zh--------------------------
     $passp = new passport();
     $pass = $passp->useradd($this->uid, $this->username, $this->password, $this->email, $this->ip, $this->groupid, $this->nickname);
     //add
     if (is_array($pass)) {
         $psptuser = $passp->passport_setsession($pass, 2592000, $this->ip);
         //add
     } else {
         if ($pass == "userisexist") {
             uc_user_delete($this->uid);
             $this->uid = -3;
         } else {
             if ($pass == "nicknameexist") {
                 uc_user_delete($this->uid);
                 $this->uid = -7;
             } else {
                 uc_user_delete($this->uid);
                 $this->uid = -8;
             }
         }
     }
     //-------------add end-------------------------------
     if ($this->uid > 0) {
         //在有UC的情况下,附属论坛的members表password列并不存储真实密码,只是用于cookies登陆状态校样。
         $init_arr = explode(',', $_G['setting']['initcredits']);
         $userdata = array('uid' => $this->uid, 'username' => $this->username, 'password' => md5(rand(100000, 999999)), 'email' => $this->email, 'adminid' => 0, 'groupid' => $this->groupid, 'regdate' => $this->timestamp, 'credits' => $init_arr[0], 'timeoffset' => 9999);
         DB::insert('common_member', $userdata);
         $status_data = array('uid' => $this->uid, 'regip' => $this->ip, 'lastip' => $this->ip, 'lastvisit' => $this->timestamp, 'lastactivity' => $this->timestamp, 'lastpost' => 0, 'lastsendmail' => 0);
         DB::insert('common_member_status', $status_data);
         $profile['uid'] = $this->uid;
         $profile['field1'] = $this->nickname;
         //add by zh
         DB::insert('common_member_profile', $profile);
         DB::insert('common_member_field_forum', array('uid' => $this->uid));
         DB::insert('common_member_field_home', array('uid' => $this->uid));
         //初始化积分
         $count_data = array('uid' => $this->uid, 'extcredits1' => $init_arr[1], 'extcredits2' => $init_arr[2], 'extcredits3' => $init_arr[3], 'extcredits4' => $init_arr[4], 'extcredits5' => $init_arr[5], 'extcredits6' => $init_arr[6], 'extcredits7' => $init_arr[7], 'extcredits8' => $init_arr[8]);
         DB::insert('common_member_count', $count_data);
         DB::insert('common_setting', array('skey' => 'lastmember', 'svalue' => $this->username), false, true);
         manyoulog('user', $this->uid, 'add');
         return true;
     } else {
         return false;
     }
 }
예제 #16
0
 /**
  * 会员注册
  * @param  $username 会员名, $password 密码, $email 邮件
  * @return bool
  */
 public function user_register($username, $password, $email)
 {
     $uid = uc_user_register($username, $password, $email);
     if ($uid > 0) {
         $ip = $this->input->ip_address();
         $time = time();
         $userdata = array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'adminid' => 0, 'groupid' => 10, 'regdate' => $time, 'credits' => 0, 'timeoffset' => 9999);
         $this->db_uc->insert('common_member', $userdata);
         $status_data = array('uid' => $uid, 'regip' => $ip, 'lastip' => '', 'lastvisit' => $time, 'lastactivity' => $time, 'lastpost' => 0, 'lastsendmail' => 0);
         $this->db_uc->insert('common_member_status', $status_data);
         $this->db_uc->insert('common_member_profile', array('uid' => $uid));
         $this->db_uc->insert('common_member_field_forum', array('uid' => $uid));
         $this->db_uc->insert('common_member_field_home', array('uid' => $uid));
         $this->db_uc->insert('common_member_count', array('uid' => $uid));
         $this->db_uc->where('skey', 'lastmember');
         $this->db_uc->update('common_setting', array('svalue' => $username));
     }
     return $uid;
 }
예제 #17
0
 static function reg($username, $password, $email, $autologin = false)
 {
     $ip = get_client_ip();
     $zhuce = uc_user_register($username, $password, $email, '', '', $ip);
     if ($zhuce > 0) {
         if ($autologin) {
             self::$uid = $uid;
             self::$username = $username;
             self::$password = md5($password);
             self::$email = $email;
             setcookie(self::$authPre . 'auth', uc_authcode($uid . "\t" . $username . "\t" . md5($password) . "\t" . $email, 'ENCODE'));
         }
         return $zhuce;
         //返回UID
     } else {
         self::$lastAction = 'reg';
         self::$lastErrorCode = $zhuce;
         return FALSE;
     }
 }
예제 #18
0
 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate($oauth = false)
 {
     global $sysSettings;
     if (isset($sysSettings['partner']['mode']) && $sysSettings['partner']['mode'] == 'ucenter') {
         Yii::import('ext.ucenter.MUcenter', true);
         list($ucenterId, $username, $password, $email) = uc_user_login($this->username, $this->password, 2);
         $this->_authenticate($oauth);
         if ($ucenterId > 0 && $this->errorCode == self::ERROR_USERNAME_INVALID) {
             //说明网站数据库中没有,而ucenter中有这个用户,添加用户
             User::model()->addUser($email, $password, array('name' => $username, 'bio' => ' ', 'status' => 'ok'));
             $this->errorCode = self::ERROR_NONE;
         } else {
             if ($ucenterId > 0 && $this->errorCode == self::ERROR_PASSWORD_INVALID) {
                 $this->errorCode = self::ERROR_NONE;
             } else {
                 if ($ucenterId == -1 && $this->errorCode == self::ERROR_NONE) {
                     uc_user_register($this->userInfo->name, $this->password, $this->userInfo->email);
                 }
             }
         }
         $this->setState('ucenterId', $ucenterId);
     } else {
         $this->_authenticate($oauth);
     }
     if ($this->errorCode == self::ERROR_NONE) {
         $userInfo = $this->userInfo;
         $userInfo->upTime = time();
         $userInfo->save();
         //动态设为超级用户
         if ($userInfo->isAdmin) {
             Yii::app()->user->setIsSuperuser(true);
         }
         $this->_id = $userInfo->id;
         //用setState添加的变量会加入Yii::app()->user的属性中
         $this->setState('displayName', $userInfo->name);
     }
     return !$this->errorCode;
 }
예제 #19
0
 public function register($username, $password, $email)
 {
     /**
      * 会员注册
      */
     $uid = uc_user_register($username, $password, $email);
     //UCenter的注册验证函数
     if ($uid <= 0) {
         if ($uid == -1) {
             return '用户名不合法';
         } else {
             if ($uid == -2) {
                 return '包含不允许注册的词语';
             } else {
                 if ($uid == -3) {
                     return '用户名已经存在';
                 } else {
                     if ($uid == -4) {
                         return 'Email 格式有误';
                     } else {
                         if ($uid == -5) {
                             return 'Email 不允许注册';
                         } else {
                             if ($uid == -6) {
                                 return '该 Email 已经被注册';
                             } else {
                                 return '未定义';
                             }
                         }
                     }
                 }
             }
         }
     } else {
         return intval($uid);
         //返回一个非负数
     }
 }
예제 #20
0
 /**
  * 用户注册
  *
  * @param string $username
  * @param string $password
  * @param string $email
  * @return int|string
  */
 public function register($username, $password, $email)
 {
     $uid = uc_user_register($username, $password, $email);
     if ($uid <= 0) {
         if ($uid == -1) {
             return '用户名不合法';
         } elseif ($uid == -2) {
             return '包含不允许注册的词语';
         } elseif ($uid == -3) {
             return '用户名已经存在';
         } elseif ($uid == -4) {
             return 'Email 格式有误';
         } elseif ($uid == -5) {
             return 'Email 不允许注册';
         } elseif ($uid == -6) {
             return '该 Email 已经被注册';
         } else {
             return '未定义';
         }
     } else {
         return intval($uid);
     }
 }
 /**
  * 用户注册
  * @param type $username 用户名
  * @param type $password 明文密码
  * @param type $email
  * @param type $_data 附加数据
  * @return int 大于 0:返回用户 ID,表示用户注册成功
  *                              -1:用户名不合法
  *                              -2:包含不允许注册的词语
  *                              -3:用户名已经存在
  *                              -4:Email 格式有误
  *                              -5:Email 不允许注册
  *                              -6:该 Email 已经被注册
  */
 public function user_register($username, $password, $email, $_data = array())
 {
     //检查用户名
     $ckname = $this->user_checkname($username);
     if ($ckname < 1) {
         return $ckname;
     }
     //检查邮箱
     $ckemail = $this->user_checkemail($email);
     if ($ckemail < 1) {
         return $ckemail;
     }
     if ($this->UCenter) {
         $userid = uc_user_register($username, $password, $email);
         if ($userid > 0) {
             //保存到本地
             $Member = D("Member");
             $encrypt = genRandomString(6);
             $password = $Member->encryption(0, $password, $encrypt);
             $data = array("userid" => $userid, "username" => $username, "password" => $password, "email" => $email, "encrypt" => $encrypt);
             $data = array_merge($_data, $data);
             $Member->add($data);
             return $userid;
         }
     } else {
         $Member = D("Member");
         $encrypt = genRandomString(6);
         $password = $Member->encryption(0, $password, $encrypt);
         $data = array("username" => $username, "password" => $password, "email" => $email, "encrypt" => $encrypt);
         $data = array_merge($_data, $data);
         $userid = $Member->add($data);
         if ($userid) {
             return $userid;
         }
     }
     return 0;
 }
예제 #22
0
 public function create($uname, $passwd, $mail)
 {
     $uid = (int) uc_user_register($this->iconv($uname), $passwd, $mail);
     if ($uid > 0) {
         return $uid;
     } else {
         if ($uid == -1) {
             $this->err->add('用户名不合法', 431);
         } elseif ($uid == -2) {
             $this->err->add('包含要允许注册的词语', 431);
         } elseif ($uid == -3) {
             $this->err->add('用户名已经存在', 431);
         } elseif ($uid == -4) {
             $this->err->add('Email 格式有误', 431);
         } elseif ($uid == -5) {
             $this->err->add('不允许注册', 431);
         } elseif ($uid == -6) {
             $this->err->add('该 Email 已经被注册', 431);
         } else {
             $this->err->add('未定义操作', 431);
         }
     }
     return false;
 }
예제 #23
0
파일: index.php 프로젝트: cwcw/cms
        }
    }
    if ($havedata) {
        show_msg('危险!指定的SupeSite数据库已有数据,如果继续将会清空原有数据!', $step + 1);
    } else {
        show_msg('数据库配置成功,进入下一步操作', $step + 1, 1);
    }
} elseif (submitcheck('opensubmit')) {
    //检查用户身份
    $step = 5;
    include_once S_ROOT . './common.php';
    //UC注册用户
    if (!@(include_once S_ROOT . './uc_client/client.php')) {
        showmessage('system_error');
    }
    $uid = uc_user_register($_POST['username'], $_POST['password'], '*****@*****.**');
    if ($uid == -3) {
        //已存在,登录
        if (!($passport = getpassport($_POST['username'], $_POST['password']))) {
            show_msg('输入的用户名密码不正确,请确认');
        }
        $setarr = array('uid' => $passport['uid'], 'username' => addslashes($passport['username']));
    } elseif ($uid > 0) {
        $setarr = array('uid' => $uid, 'username' => $_POST['username']);
    } else {
        show_msg('输入的用户名无法注册,请重新确认');
    }
    $setarr['dateline'] = $_SGLOBAL['timestamp'];
    $setarr['updatetime'] = $_SGLOBAL['timestamp'];
    $setarr['lastlogin'] = $_SGLOBAL['timestamp'];
    $setarr['ip'] = $_SGLOBAL['onlineip'];
예제 #24
0
 }
 $regipsql = '';
 if ($_G['setting']['regfloodctrl']) {
     if ($regattempts = DB::result_first("SELECT count FROM " . DB::table('common_regip') . " WHERE ip='{$_G['clientip']}' AND count>'0' AND dateline>'{$_G['timestamp']}'-86400")) {
         if ($regattempts >= $_G['setting']['regfloodctrl']) {
             showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $_G['setting']['regfloodctrl']));
         } else {
             $regipsql = "UPDATE " . DB::table('common_regip') . " SET count=count+1 WHERE ip='{$_G['clientip']}' AND count>'0'";
         }
     } else {
         $regipsql = "INSERT INTO " . DB::table('common_regip') . " (ip, count, dateline)\r\n\t\t\t\tVALUES ('{$_G['clientip']}', '1', '{$_G['timestamp']}')";
     }
 }
 $secques = $questionid > 0 ? random(8) : '';
 if (!$activation) {
     $uid = uc_user_register($username, $password, $email, $questionid, $answer, $_G['clientip']);
     if ($uid <= 0) {
         if ($uid == -1) {
             showmessage('profile_username_illegal');
         } elseif ($uid == -2) {
             showmessage('profile_username_protect');
         } elseif ($uid == -3) {
             showmessage('profile_username_duplicate');
         } elseif ($uid == -4) {
             showmessage('profile_email_illegal');
         } elseif ($uid == -5) {
             showmessage('profile_email_domain_illegal');
         } elseif ($uid == -6) {
             showmessage('profile_email_duplicate');
         } else {
             showmessage('undefined_action', NULL);
예제 #25
0
 }
 //邮箱
 $email = isemail(trim($_POST['email'])) ? trim($_POST['email']) : '';
 if (empty($email)) {
     showmessage('email_format_is_wrong');
 }
 if ($_SCONFIG['checkemail']) {
     if ($count = getcount('spacefield', array('email' => $email))) {
         showmessage('email_has_been_registered');
     }
 }
 $num = strpos($email, '@');
 $num = $num > 15 ? 15 : $num;
 $username = substr($email, 0, $num);
 //创建新用户
 $newuid = uc_user_register($username, $password, $email);
 if ($newuid <= 0) {
     if ($newuid == -1) {
         showmessage('user_name_is_not_legitimate');
     } elseif ($newuid == -2) {
         showmessage('include_not_registered_words');
     } elseif ($newuid == -3) {
         showmessage('user_name_already_exists');
     } elseif ($newuid == -4) {
         showmessage('email_format_is_wrong');
     } elseif ($newuid == -5) {
         showmessage('email_not_registered');
     } elseif ($newuid == -6) {
         showmessage('email_has_been_registered');
     } else {
         showmessage('register_error');
예제 #26
0
 /**
  * UC登录或者注册
  * @param string $username
  * @param string $password
  * @param string $is_remember_me 是否记住登录
  * @return bool 
  */
 private function ucLogin($username, $password, $is_remember_me)
 {
     //载入UC客户端SDK
     include_once SITE_PATH . '/api/uc_client/client.php';
     //1. 获取UC信息.
     if ($this->isValidEmail($username)) {
         $use_email = true;
         $uc_login_type = 2;
     } else {
         $use_email = false;
         $uc_login_type = 0;
     }
     $uc_user = uc_user_login($username, $password, $uc_login_type);
     //2. 已经同步过的直接登录
     $uc_user_ref = ts_get_ucenter_user_ref('', $uc_user['0'], '');
     if ($uc_user_ref['uid'] && $uc_user_ref['uc_uid'] && $uc_user[0] > 0) {
         //登录本地帐号
         $result = $uc_user_ref['uid'] > 0 ? $this->_recordLogin($uc_user_ref['uid'], $is_remember_me) : false;
         if ($result) {
             $this->success .= uc_user_synlogin($uc_user[0]);
             return true;
         } else {
             $this->error = '登录失败,请重试';
             return false;
         }
     }
     //3. 关联表无、获取本地帐号信息.
     $ts_user = $this->getLocalUser($username, $password);
     // 调试用-写log
     // $log_message = "============================ \n "
     // 				.date('Y-m-d H:i:s')." \n ".$_SERVER['REQUEST_URI']." \n "
     // 				.var_export($uc_user,true)." \n "
     // 				.var_export($ts_user,true)." \n "
     // 				.var_export($uc_user_ref,true)." \n ";
     // $log_file = SITE_PATH."/ts_uc_log.txt";
     // $result = error_log($log_message,3,$log_file);
     //4. 关联表无、UC有、本地有的
     if ($uc_user[0] > 0 && $ts_user['uid'] > 0) {
         $result = ts_add_ucenter_user_ref($ts_user['uid'], $uc_user[0], $uc_user[1], $uc_user[3]);
         if (!$result) {
             $this->error = '用户不存在或密码错误';
             return false;
         }
         //登录本地帐号
         $result = $this->_recordLogin($ts_user['uid'], $is_remember_me);
         if ($result) {
             $this->success .= uc_user_synlogin($uc_user[0]);
             return true;
         } else {
             $this->error = '登录失败,请重试';
             return false;
         }
     }
     //5. 关联表无、UC有、本地无的
     if ($uc_user[0] > 0 && !$ts_user['uid']) {
         //写入本地系统
         $login_salt = rand(11111, 99999);
         $map['uname'] = $uc_user[1];
         $map['sex'] = 1;
         $map['login_salt'] = $login_salt;
         $map['password'] = md5(md5($uc_user[2]) . $login_salt);
         $map['login'] = $map['email'] = $uc_user[3];
         $map['reg_ip'] = get_client_ip();
         $map['ctime'] = time();
         $map['is_audit'] = 1;
         $map['is_active'] = 1;
         $map['first_letter'] = getFirstLetter($uname);
         //如果包含中文将中文翻译成拼音
         if (preg_match('/[\\x7f-\\xff]+/', $map['uname'])) {
             //昵称和呢称拼音保存到搜索字段
             $map['search_key'] = $map['uname'] . ' ' . model('PinYin')->Pinyin($map['uname']);
         } else {
             $map['search_key'] = $map['uname'];
         }
         $ts_uid = model('User')->add($map);
         if (!$ts_uid) {
             $this->error = '本地用户注册失败,请联系管理员';
             return false;
         }
         //写入关联表
         $result = ts_add_ucenter_user_ref($ts_uid, $uc_user[0], $uc_user[1], $uc_user[3]);
         if (!$result) {
             $this->error = '用户不存在或密码错误';
             return false;
         }
         // 添加至默认的用户组
         $registerConfig = model('Xdata')->get('admin_Config:register');
         $userGroup = empty($registerConfig['default_user_group']) ? C('DEFAULT_GROUP_ID') : $registerConfig['default_user_group'];
         model('UserGroupLink')->domoveUsergroup($ts_uid, implode(',', $userGroup));
         // 添加双向关注用户
         $eachFollow = $registerConfig['each_follow'];
         if (!empty($eachFollow)) {
             model('Follow')->eachDoFollow($ts_uid, $eachFollow);
         }
         // 添加默认关注用户
         $defaultFollow = $registerConfig['default_follow'];
         $defaultFollow = array_diff(explode(',', $defaultFollow), explode(',', $eachFollow));
         if (!empty($defaultFollow)) {
             model('Follow')->bulkDoFollow($ts_uid, $defaultFollow);
         }
         //登录本地帐号
         $result = $this->_recordLogin($ts_uid, $is_remember_me);
         if ($result) {
             $this->success .= uc_user_synlogin($uc_user[0]);
             return true;
         } else {
             $this->error = '登录失败,请重试';
             return false;
         }
     }
     //6. 关联表无、UC无、本地有
     if ($uc_user[0] < 0 && $ts_user['uid'] > 0) {
         //写入UC
         $uc_uid = uc_user_register($ts_user['uname'], $password, $ts_user['email'], '', '', get_client_ip());
         if ($uc_uid > 0) {
             $this->error = 'UC帐号注册失败,请联系管理员';
             return false;
         }
         //写入关联表
         $result = ts_add_ucenter_user_ref($ts_user['uid'], $uc_uid, $ts_user['uname'], $ts_user['email']);
         if (!$result) {
             $this->error = '用户不存在或密码错误';
             return false;
         }
         //登录本地帐号
         $result = $this->_recordLogin($ts_user['uid'], $is_remember_me);
         if ($result) {
             $this->success .= uc_user_synlogin($uc_uid);
             return true;
         } else {
             $this->error = '登录失败,请重试';
             return false;
         }
     }
     //7. 关联表无、UC无、本地无的
     $this->error = '用户不存在';
     return false;
 }
예제 #27
0
 private function _do_email_register()
 {
     if (!sp_check_verify_code()) {
         $this->error("验证码错误!");
     }
     $rules = array(array('user_type', 'require', '请选择用户类型!', 1), array('email', 'require', '邮箱不能为空!', 1), array('password', 'require', '密码不能为空!', 1), array('repassword', 'require', '重复密码不能为空!', 1), array('repassword', 'password', '确认密码不正确', 0, 'confirm'), array('email', 'email', '邮箱格式不正确!', 1));
     $users_model = M("Users");
     if ($users_model->validate($rules)->create() === false) {
         $this->error($users_model->getError());
     }
     $password = $_POST['password'];
     $email = $_POST['email'];
     $user_type = $_POST['user_type'];
     $username = str_replace(array(".", "@"), "_", $email);
     //用户名需过滤的字符的正则
     $stripChar = '?<*.>\'"';
     if (preg_match('/[' . $stripChar . ']/is', $username) == 1) {
         $this->error('用户名中包含' . $stripChar . '等非法字符!');
     }
     // 	    $banned_usernames=explode(",", sp_get_cmf_settings("banned_usernames"));
     // 	    if(in_array($username, $banned_usernames)){
     // 	        $this->error("此用户名禁止使用!");
     // 	    }
     if (strlen($password) < 5 || strlen($password) > 20) {
         $this->error("密码长度至少5位,最多20位!");
     }
     if ($user_type > 3 || $user_type < 1) {
         $this->error("非法操作!");
     }
     $where['user_login'] = $username;
     $where['user_email'] = $email;
     $where['_logic'] = 'OR';
     $ucenter_syn = C("UCENTER_ENABLED");
     $uc_checkemail = 1;
     $uc_checkusername = 1;
     if ($ucenter_syn) {
         include UC_CLIENT_ROOT . "client.php";
         $uc_checkemail = uc_user_checkemail($email);
         $uc_checkusername = uc_user_checkname($username);
     }
     $users_model = M("Users");
     $result = $users_model->where($where)->count();
     if ($result || $uc_checkemail < 0 || $uc_checkusername < 0) {
         $this->error("用户名或者该邮箱已经存在!");
     } else {
         $uc_register = true;
         if ($ucenter_syn) {
             $uc_uid = uc_user_register($username, $password, $email);
             //exit($uc_uid);
             if ($uc_uid < 0) {
                 $uc_register = false;
             }
         }
         if ($uc_register) {
             $need_email_active = C("SP_MEMBER_EMAIL_ACTIVE");
             $data = array('user_login' => $username, 'user_email' => $email, 'user_nicename' => $username, 'user_pass' => sp_password($password), 'last_login_ip' => get_client_ip(0, true), 'create_time' => date("Y-m-d H:i:s"), 'last_login_time' => date("Y-m-d H:i:s"), 'user_status' => $need_email_active ? 2 : 1, "user_type" => $user_type);
             $rst = $users_model->add($data);
             if ($rst) {
                 //登入成功页面跳转
                 $data['id'] = $rst;
                 $_SESSION['user'] = $data;
                 //发送激活邮件
                 if ($need_email_active) {
                     $this->_send_to_active();
                     unset($_SESSION['user']);
                     $this->success("注册成功,激活后才能使用!", U("user/login/index"));
                 } else {
                     $this->success("注册成功!", __ROOT__ . "/");
                 }
             } else {
                 $this->error("注册失败!", U("user/register/index"));
             }
         } else {
             $this->error("注册失败!", U("user/register/index"));
         }
     }
 }
예제 #28
0
 public static function register($username, $return = 0, $groupid = 0)
 {
     global $_G;
     if (!$username) {
         return;
     }
     if (!$_G['wechat']['setting']) {
         $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
     }
     loaducenter();
     $groupid = !$groupid ? $_G['wechat']['setting']['wechat_newusergroupid'] ? $_G['wechat']['setting']['wechat_newusergroupid'] : $_G['setting']['newusergroupid'] : $groupid;
     $password = md5(random(10));
     $email = 'wechat_' . strtolower(random(10)) . '@null.null';
     $usernamelen = dstrlen($username);
     if ($usernamelen < 3) {
         $username = $username . '_' . random(5);
     }
     if ($usernamelen > 15) {
         if (!$return) {
             showmessage('profile_username_toolong');
         } else {
             return;
         }
     }
     $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($_G['setting']['censoruser'] = trim($_G['setting']['censoruser']), '/')) . ')$/i';
     if ($_G['setting']['censoruser'] && @preg_match($censorexp, $username)) {
         if (!$return) {
             showmessage('profile_username_protect');
         } else {
             return;
         }
     }
     if (!$_G['wechat']['setting']['wechat_disableregrule']) {
         loadcache('ipctrl');
         if ($_G['cache']['ipctrl']['ipregctrl']) {
             foreach (explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) {
                 if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) {
                     $ctrlip = $ctrlip . '%';
                     $_G['setting']['regctrl'] = $_G['setting']['ipregctrltime'];
                     break;
                 } else {
                     $ctrlip = $_G['clientip'];
                 }
             }
         } else {
             $ctrlip = $_G['clientip'];
         }
         if ($_G['setting']['regctrl']) {
             if (C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp'] - $_G['setting']['regctrl'] * 3600)) {
                 if (!$return) {
                     showmessage('register_ctrl', NULL, array('regctrl' => $_G['setting']['regctrl']));
                 } else {
                     return;
                 }
             }
         }
         $setregip = null;
         if ($_G['setting']['regfloodctrl']) {
             $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp'] - 86400);
             if ($regip) {
                 if ($regip['count'] >= $_G['setting']['regfloodctrl']) {
                     if (!$return) {
                         showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $_G['setting']['regfloodctrl']));
                     } else {
                         return;
                     }
                 } else {
                     $setregip = 1;
                 }
             } else {
                 $setregip = 2;
             }
         }
         if ($setregip !== null) {
             if ($setregip == 1) {
                 C::t('common_regip')->update_count_by_ip($_G['clientip']);
             } else {
                 C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => 1, 'dateline' => $_G['timestamp']));
             }
         }
     }
     $uid = uc_user_register(addslashes($username), $password, $email, '', '', $_G['clientip']);
     if ($uid <= 0) {
         if (!$return) {
             if ($uid == -1) {
                 showmessage('profile_username_illegal');
             } elseif ($uid == -2) {
                 showmessage('profile_username_protect');
             } elseif ($uid == -3) {
                 showmessage('profile_username_duplicate');
             } elseif ($uid == -4) {
                 showmessage('profile_email_illegal');
             } elseif ($uid == -5) {
                 showmessage('profile_email_domain_illegal');
             } elseif ($uid == -6) {
                 showmessage('profile_email_duplicate');
             } else {
                 showmessage('undefined_action');
             }
         } else {
             return;
         }
     }
     $init_arr = array('credits' => explode(',', $_G['setting']['initcredits']));
     C::t('common_member')->insert($uid, $username, $password, $email, $_G['clientip'], $groupid, $init_arr);
     if ($_G['setting']['regctrl'] || $_G['setting']['regfloodctrl']) {
         C::t('common_regip')->delete_by_dateline($_G['timestamp'] - ($_G['setting']['regctrl'] > 72 ? $_G['setting']['regctrl'] : 72) * 3600);
         if ($_G['setting']['regctrl']) {
             C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp']));
         }
     }
     if ($_G['setting']['regverify'] == 2) {
         C::t('common_member_validate')->insert(array('uid' => $uid, 'submitdate' => $_G['timestamp'], 'moddate' => 0, 'admin' => '', 'submittimes' => 1, 'status' => 0, 'message' => '', 'remark' => ''), false, true);
         manage_addnotify('verifyuser');
     }
     setloginstatus(array('uid' => $uid, 'username' => $username, 'password' => $password, 'groupid' => $groupid), 0);
     //统计
     include_once libfile('function/stat');
     updatestat('register');
     return $uid;
 }
예제 #29
0
function check_adminuser($username, $password, $email)
{
    include ROOT_PATH . CONFIG_UC;
    include ROOT_PATH . './uc_client/client.php';
    $error = '';
    $ucresult = uc_user_login($username, $password);
    list($tmp['uid'], $tmp['username'], $tmp['password'], $tmp['email']) = uc_addslashes($ucresult);
    $ucresult = $tmp;
    if ($ucresult['uid'] <= 0) {
        $uid = uc_user_register($username, $password, $email);
        if ($uid == -1 || $uid == -2) {
            $error = 'admin_username_invalid';
        } elseif ($uid == -4 || $uid == -5 || $uid == -6) {
            $error = 'admin_email_invalid';
        } elseif ($uid == -3) {
            $error = 'admin_exist_password_error';
        }
    } else {
        $uid = $ucresult['uid'];
        $email = $ucresult['email'];
        $password = $ucresult['password'];
    }
    if (!$error && $uid > 0) {
        $password = md5($password);
        uc_user_addprotected($username, '');
    } else {
        $uid = 0;
        $error = empty($error) ? 'error_unknow_type' : $error;
    }
    return array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'error' => $error);
}
예제 #30
0
 }
 if ($mname == 'consume' && strtotime($_POST['validity_end']) < strtotime($_POST['validity_start'])) {
     array_push($checkresults, array('validity_end' => lang('consume_validity_error')));
 }
 //檢查新增到UC註冊
 $ucid = 0;
 $ucname = $ucemail = $ucpwd = '';
 if ($mname == 'shop' && !empty($_POST['ucreg_username'])) {
     if (strlen($_POST['ucreg_password']) < 1 || $_POST['ucreg_password'] != $_POST['ucreg_rtpassword']) {
         array_push($checkresults, array('ucreg_password' => lang('ucreg_rtpwd_error')));
     }
     if (!empty($checkresults)) {
         cpmsg('ucreg_rtpwd_error', '', '', '', true, true, $checkresults);
     }
     require_once B_ROOT . './uc_client/client.php';
     $ucid = uc_user_register($_POST['ucreg_username'], $_POST['ucreg_password'], $_POST['ucreg_email']);
     if ($ucid < 0) {
         if ($ucid == -1) {
             array_push($checkresults, array('ucreg_username' => $lang['user_name_is_not_legitimate']));
         } elseif ($ucid == -2) {
             array_push($checkresults, array('ucreg_username' => $lang['include_not_registered_words']));
         } elseif ($ucid == -3) {
             array_push($checkresults, array('ucreg_username' => $lang['user_name_already_exists']));
         } elseif ($ucid == -4) {
             array_push($checkresults, array('ucreg_email' => $lang['email_format_is_wrong']));
         } elseif ($ucid == -5) {
             array_push($checkresults, array('ucreg_email' => $lang['email_not_registered']));
         } elseif ($ucid == -6) {
             array_push($checkresults, array('ucreg_email' => $lang['email_has_been_registered']));
         } else {
             array_push($checkresults, array('message' => $lang['register_error']));