Exemple #1
0
 static function checkEmail($email)
 {
     $checkemail = uc_user_checkemail();
     if ($checkemail > 0) {
         return TRUE;
     } else {
         self::$lastAction = 'checkemail';
         self::$lastErrorCode = $checkemail;
         return FALSE;
     }
 }
Exemple #2
0
 public function checkUcenterEmail($attribute, $params)
 {
     //ucenter
     Yii::import('ext.ucenter.MUcenter', true);
     $flag = uc_user_checkemail($this->email);
     switch ($flag) {
         case -4:
             $this->addError('email', 'Email 格式有误');
             break;
         case -5:
             $this->addError('email', 'Email 不允许注册');
             break;
         case -6:
             $this->addError('email', '该 Email 已经被注册');
             break;
     }
 }
    function ajax_check_name()
    {
        $this->uid != NULL && exit('Acess Denied!');
        $this->toclose();
        $register = M('user');
        if ($register->where(array('name' => $this->post['name']))->count() != 0) {
            exit('重新注册<script>$("#tip_mid").html("该用户名已被使用!");
						$("#tip").css({left:$("#reg_name").offset().left+100,top:$("#reg_name").offset().top-46});
						swing("register_div");</script>	');
        } else {
            if ($register->where(array('email' => $this->post['email']))->count() != 0) {
                exit('重新注册<script>$("#tip_mid").html("该邮箱已被使用!");
						$("#tip").css({left:$("#reg_email").offset().left+100,top:$("#reg_email").offset().top-46});
						swing("register_div");</script>');
            } else {
                if ($this->setting['is_invite_register'] == 1 && ($register->where(array('invitecode' => $this->post['invite_val']))->count() == 0 || $register->where(array('invitecode' => $this->post['invite_val']))->getField('invitecount') < 1)) {
                    exit('重新注册<script>$("#tip_mid").html("该邀请码已失效!");
						$("#tip").css({left:$("#invite_code_input").offset().left+100,top:$("#invite_code_input").offset().top-46});
						swing("register_div");</script>');
                } else {
                    if ($this->setting['register_code'] == 1 && md5($this->post['code']) != $_SESSION['verify']) {
                        exit('重新注册<script>$("#tip_mid").html("验证码输入错误!");
						$("#tip").css({left:$("#reg_code").offset().left+100,top:$("#reg_code").offset().top-46});
						swing("register_div");</script>');
                    } else {
                        if ($this->setting['ucenter_on'] == 1) {
                            if (uc_user_checkemail($this->post['email'] != 1)) {
                                exit('重新注册<script>$("#tip_mid").html("UC:该邮箱不能注册!");
						$("#tip").css({left:$("#reg_email").offset().left+100,top:$("#reg_email").offset().top-46});
						swing("register_div");</script>');
                            } else {
                                if (uc_user_checkname($this->post['name'] != 1)) {
                                    exit('重新注册<script>$("#tip_mid").html("UC:该用户名不能注册!");
						$("#tip").css({left:$("#reg_email").offset().left+100,top:$("#reg_email").offset().top-46});
						swing("register_div");</script>');
                                }
                            }
                        }
                        echo '正在注册...<script>document.register_form.submit();</script>';
                    }
                }
            }
        }
    }
 function doregister()
 {
     $rules = array(array('password', 'require', '密码不能为空!', 1), array('user_realname', 'require', '用户名不能为空!', 1), array('repassword', 'require', '重复密码不能为空!', 1), array('repassword', 'password', '确认密码不正确', 0, 'confirm'));
     if (I('post.reg_type') == 1) {
         if (!sp_check_verify_code()) {
             $this->error("验证码错误!");
         }
         $_POST['email'] = I('post.username');
         array_unshift($rules, array('username', 'require', '邮箱不能为空!', 1), array('email', 'email', '邮箱格式不正确!', 1));
     } else {
         array_unshift($rules, array('username', 'require', '手机号码不能为空!', 1));
         $user_phone = I('post.username');
         if (!preg_match('/^[1][3458]{1}[0-9]{9}$/', $user_phone)) {
             $this->error('手机号码格式有误');
         }
         //手机号码格式检测
         $check = M('Sms')->field('code,add_time')->where(array('phone' => $user_phone))->order('id desc')->find();
         if (empty($_POST['code'])) {
             $this->error('验证码不能为空');
         }
         if (strtolower($check['code']) != strtolower(I('post.code'))) {
             $this->error("手机验证码错误");
         }
         if (time() > $check['add_time'] + 3600) {
             $this->error('验证码已过期,请重新获取');
         }
     }
     $users_model = M("Member");
     if ($users_model->validate($rules)->create() === false) {
         $this->error($users_model->getError());
     }
     extract($_POST);
     //用户名需过滤的字符的正则
     /**$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) < 6 || strlen($password) > 20) {
         $this->error("密码长度至少6位,最多20位!");
     }
     $where['user_login'] = $username;
     $where['user_email'] = $email;
     //    	$where['user_realname']=$user_realname;
     $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("Member");
     $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");
             if ($need_email_active) {
                 //配置为需要邮件激活时
                 if (I('post.reg_type') == 1) {
                     //邮箱注册
                     $need_email_active = true;
                 } else {
                     if (I('post.reg_type') == 2) {
                         //手机号码注册
                         $need_email_active = false;
                     }
                 }
             }
             $data = array('user_login' => $username, 'user_email' => $email, 'user_nicename' => $username, 'user_realname' => $user_realname, 'user_pass' => sp_password($password), 'last_login_ip' => get_client_ip(), '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, "utype" => 0, 'user_phone' => $user_phone);
             $rst = $users_model->add($data);
             if ($rst) {
                 //登入成功页面跳转
                 $data['id'] = $rst;
                 //插入我的账户
                 $account = M("Account");
                 $ac['uid'] = $rst;
                 $ac['money'] = get_point_rule('register');
                 $account->add($ac);
                 $_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"));
         }
     }
 }
 /**
  * 检查 Email 地址
  * @param type $email 邮箱地址
  * @return int 1:成功
  *                      -4:Email 格式有误
  *                      -5:Email 不允许注册
  *                      -6:该 Email 已经被注册
  */
 public function user_checkemail($email)
 {
     if (strlen($email) > 6 && preg_match("/^[\\w\\-\\.]+@[\\w\\-\\.]+(\\.\\w+)+\$/", $email)) {
         if ($this->UCenter) {
             return uc_user_checkemail($email);
         } else {
             $find = M("Member")->where(array("email" => $email))->find();
             if ($find) {
                 return -6;
             }
             return 1;
         }
     }
     return -4;
 }
Exemple #6
0
function king_ajax_register()
{
    global $king;
    if ($king->config('isregister', 'user') == 0) {
        kc_ajax($king->lang->get('user/title/regstop'), $king->config('registertip', 'user'), 0, '', 500, 200);
    }
    if (!kc_post('is')) {
        $s = $king->config('reglicense', 'user');
        $but = kc_htm_a($king->lang->get('portal/user/iaccept'), '{URL:\'' . $king->config('inst') . 'user/index.php\',CMD:\'register\',METHOD:\'GET\',is:1,IS:1}');
        $but .= "<a href=\"javascript:;\" class=\"k_close\">" . $king->lang->get('system/common/cancel') . "</a>";
        $height = 400;
        $title = $king->lang->get('portal/title/reglicense');
        $GLOBALS['ischeck'] = false;
    } else {
        /*
        if($GLOBALS['ismethod']){//POST过程
        	$data=$_POST;
        }
        */
        $data = kc_data(array('username', 'userpass', 'usermail'));
        if ($king->config('blackuser', 'user')) {
            $array_black = explode('|', $king->config('blackuser', 'user'));
            $array_black = array_diff($array_black, array(null));
        } else {
            $array_black = array();
        }
        //username
        $_array = array(array('username', 0, 3, 15), array('username', 14, $king->lang->get('portal/check/reg/u-1'), array('*', '\\', ':', '?', '<', '>', '|', ';', ',', '\'', '!', '~', '$', '#', '@', '^', '(', ')', '{', '}', '=', '+', '%', '/')), array('username', 14, $king->lang->get('portal/check/reg/u-2'), $array_black), array('username', 12, $king->lang->get('portal/check/reg/u-3'), $king->db->getRows_one("select userid from %s_user where username='******'username')) . "';")));
        if ($king->user->isuc && $GLOBALS['ismethod']) {
            //有提交操作的时候才做验证
            $ucheck = uc_user_checkname(kc_post('username'));
            $_array[] = array('username', 12, $king->lang->get('system/check/reg/u' . $ucheck), $ucheck != 1);
        }
        $s = $king->htmForm($king->lang->get('portal/user/name') . ' (3-15)', '<input class="k_in w150" type="text" name="username" value="' . htmlspecialchars(kc_post('username')) . '" maxlength="15" />', $_array);
        //pass
        $_array = array(array('userpass', 0, 6, 30), array('userpass', 17, null, 'userpass1'));
        $s .= $king->htmForm($king->lang->get('portal/user/pass') . ' (6-30)', '<input class="k_in w150" type="password" name="userpass" maxlength="30" />', $_array);
        //repass
        $s .= $king->htmForm($king->lang->get('portal/user/pass1'), '<input class="k_in w150" type="password" name="userpass1" maxlength="30" />');
        //mail
        $_array = array(array('usermail', 0, 6, 32), array('usermail', 5, $king->lang->get('portal/check/reg/u-4')), array('usermail', 14, $king->lang->get('portal/check/reg/u-2'), $array_black), array('usermail', 12, $king->lang->get('portal/check/reg/u-6'), $king->db->getRows_one("select userid from %s_user where usermail='" . $king->db->escape(kc_post('usermail')) . "';")));
        if ($king->user->isuc && $GLOBALS['ismethod']) {
            //有提交操作的时候才做验证
            $ucheck = uc_user_checkemail(kc_post('usermail'));
            $_array[] = array('usermail', 12, $king->lang->get('system/check/reg/u' . $ucheck), $ucheck != 1);
        }
        $s .= $king->htmForm($king->lang->get('portal/user/mail'), '<input class="k_in w250" type="text" name="usermail" value="' . htmlspecialchars($data['usermail']) . '" maxlength="32" />', $_array);
        //verify
        $verify = new KC_Verify_class();
        $s .= $verify->Show();
        $but = kc_htm_a($king->lang->get('portal/user/register'), '{URL:\'' . $king->config('inst') . 'user/index.php\',CMD:\'register\',is:1,IS:1}');
        $height = $king->config('verifyopen') ? 210 + $king->config('verifyheight') : 200;
        $title = $king->lang->get('user/title/reguser');
    }
    if ($GLOBALS['ischeck']) {
        //先提交到ucenter后再提交到本地数据库
        if ($king->user->isuc) {
            $uid = uc_user_register($data['username'], $data['userpass'], $data['usermail']);
            if ($uid < 0) {
                error($king->lang->get('portal/check/reg/u' . $uid));
            }
            if ($uid == 0) {
                error($king->lang->get('portal/error/connect'));
            }
            //发出连接错误
        } else {
            $uid = 0;
            //没有UC的时候,uid设置为0,这样以后同步帐号仅同步uid=0的帐号$king->db->neworder('%s_user',null,'uid');//若没有UC链接的时候uid自动递增
        }
        $array_sql = array('username', 'usermail');
        $array = array();
        foreach ($array_sql as $val) {
            $array[$val] = $data[$val];
        }
        $salt = kc_random(6);
        $md5pass = md5($salt . $data['userpass']);
        $array['userpass'] = $md5pass;
        $array['uid'] = $uid;
        $array['ksalt'] = $salt;
        $array['regdate'] = time();
        $userid = $king->db->insert('%s_user', $array);
        //写Cookie
        $s = $king->user->userLogin($userid, 2592000);
        kc_ajax($king->lang->get('system/common/welcome'), $s . "<p class=\"k_ok\">" . $king->lang->get('portal/user/regok') . "</p>", 1);
    }
    kc_ajax($title, $s, $but, '', 500, $height + $GLOBALS['check_num'] * 15);
}
Exemple #7
0
<?php

/*
	[CYASK] (C)2007 Cyask.com QQ: 240508015
	Revision: 3.0.0 for Discuz
	Date: 2007/4/23
*/
define('CURSCRIPT', 'checkuser');
require './include/common.inc.php';
$username = trim($_GET['username']);
$email = trim($_GET['email']);
if (!empty($username) || !empty($email)) {
    if (!empty($username)) {
        $usernum = uc_user_checkname($username);
        if ($usernum == 1) {
            $text = 'yes';
        } elseif ($usernum == -3) {
            $text = 'no';
        } else {
            $text = 'error';
        }
    } elseif (!empty($email)) {
        $text = uc_user_checkemail($email);
    }
} else {
    $text = 'error';
}
echo $text;
Exemple #8
0
 public function ajax_email()
 {
     $email = isset($_GET['email']) && trim($_GET['email']) ? trim($_GET['email']) : exit('0');
     $uid = isset($_GET['uid']) && trim($_GET['uid']) ? trim($_GET['uid']) : '';
     $where = !empty($uid) ? "`email` = '{$email}' AND `uid` != '{$uid}'" : array('email' => $email);
     if ($this->db->get_one($where)) {
         exit('0');
     } else {
         //UCenter部分
         if ($this->config['ucuse']) {
             pc_base::load_config('uc_config');
             include PHPCMS_PATH . 'api/uc_client/client.php';
             $rs = uc_user_checkemail($email);
             if ($rs < 1) {
                 exit('0');
             }
         }
         exit('1');
     }
 }
Exemple #9
0
 if (empty($_POST['email']) || !preg_match("/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$/", $_POST['email'])) {
     adminmsg('电子邮箱格式错误!', 1);
 }
 $sql['email'] = trim($_POST['email']);
 if (get_user_inusername($sql['username'])) {
     adminmsg('该用户名已经被使用!', 1);
 }
 if (get_user_inemail($sql['email'])) {
     adminmsg('该 Email 已经被注册!', 1);
 }
 if (defined('UC_API')) {
     include_once QISHI_ROOT_PATH . 'uc_client/client.php';
     if (uc_user_checkname($sql['username']) != "1") {
         adminmsg('该用户名已经被使用或者用户名非法!', 1);
         exit;
     } elseif (uc_user_checkemail($sql['email']) != "1") {
         adminmsg('该 Email已经被使用或者非法!', 1);
         exit;
     } else {
         uc_user_register($sql['username'], $sql['password'], $sql['email']);
     }
 }
 $sql['pwd_hash'] = randstr();
 $sql['password'] = md5(md5($sql['password']) . $sql['pwd_hash'] . $QS_pwdhash);
 $sql['reg_time'] = time();
 $sql['reg_ip'] = $online_ip;
 $insert_id = inserttable(table('members'), $sql, true);
 if ($sql['utype'] == "1") {
     $db->query("INSERT INTO " . table('members_points') . " (uid) VALUES ('{$insert_id}')");
     $db->query("INSERT INTO " . table('members_setmeal') . " (uid) VALUES ('{$insert_id}')");
     if (intval($_POST['is_money']) && $_POST['log_amount']) {
 public function checkEmail($email)
 {
     $this->initDiscuzApi();
     $result = uc_user_checkemail($email);
     return $this->convertApiResult($result);
 }
 /**
  * 电子邮件检查
  * @author Vimhui Develop Team
  * @param
  * @return bool
  */
 public function checkEmailExit($email)
 {
     return uc_user_checkemail($email);
 }
Exemple #12
0
 public function check_mail($mail)
 {
     $ret = uc_user_checkemail($mail);
     if ($ret > 0) {
         return $mail;
     } else {
         if ($ret == -4) {
             $this->err->add('Email 格式有误', 282);
         } else {
             if ($ret == -5) {
                 $this->err->add('Email 不允许注册', 283);
             } else {
                 if ($ret == -6) {
                     $this->err->add('该 Email 已经被注册', 284);
                 } else {
                     $this->err->add('服务器内部错误,稍后重试', 285);
                 }
             }
         }
     }
     return false;
 }
 /**
  * uc登陆或者注册。返回数组
  * $result['user'] 用户信息。用于ts系统使用
  * $result['login'] 同步登陆是否成功
  * @param unknown_type $username
  * @param unknown_type $password
  */
 public function ucLogin($username, $password)
 {
     if (isValidEmail($username)) {
         $user = service('Passport')->getLocalUser($username, $password);
         if (UC_SYNC && $user['uid']) {
             $uc_user_ref = ts_get_ucenter_user_ref($user['uid']);
             if ($uc_user_ref['uc_uid']) {
                 $uc_user = uc_user_login($uc_user_ref['uc_uid'], $password, 1);
                 if ($uc_user[0] == -1 || $uc_user[0] == -2) {
                     $uc_user_ref = array();
                 }
             } else {
                 if ($user['uname']) {
                     $res_checkname = uc_user_checkname($user['uname']);
                     if ($res_checkname >= -3 && $res_checkname <= -1) {
                         $error_param = L('username');
                     }
                     $res_checkemail = uc_user_checkemail($username);
                     if ($res_checkemail >= -6 && $res_checkemail <= -4) {
                         $error_param = $error_param ? $error_param . L('and_email') : 'Email';
                     }
                     if ($error_param) {
                         $message_data['title'] = L('sync_ucenter') . $error_param . L('sign_in_failed');
                         $message_data['content'] = L('you_of_site') . $error_param . L('ucenter_sign_in_failed') . $error_param . L('ucenter_clash') . U('home/Account/security') . L('ucenter_reset') . $error_param . '。';
                         $message_data['to'] = $user['uid'];
                         model('Message')->postMessage($message_data, M('user')->getField('uid', 'admin_level=1'));
                     } else {
                         $uc_uid = uc_user_register($user['uname'], $password, $username);
                         ts_add_ucenter_user_ref($user['uid'], $uc_uid, $user['uname']);
                         $uc_user[0] = $uc_uid;
                     }
                 }
             }
         }
     } else {
         if (UC_SYNC) {
             $uc_user = uc_user_login($username, $password);
             if ($uc_user[0] > 0) {
                 $uc_user_ref = ts_get_ucenter_user_ref('', $uc_user[0]);
                 if (!$uc_user_ref) {
                     // 注册
                     if ($this->isValidEmail($uc_user['3']) && $this->isEmailAvailable($uc_user['3'])) {
                         $user['email'] = $uc_user['3'];
                     } else {
                         $message_data['title'] = L('ucenter_sync_email_clash');
                         $message_data['content'] = L('ucenter_email_used') . U('home/Account/bind') . L('ucenter_reset_email');
                     }
                     if (isLegalUsername($uc_user['1']) && !M('user')->where("uname='{$uc_user['1']}'")->count()) {
                         $user['uname'] = $uc_user['1'];
                     }
                     $user['password'] = md5($uc_user['2']);
                     $user['ctime'] = time();
                     $user['is_active'] = 1;
                     $user['uid'] = M('user')->add($user);
                     if ($user['uid']) {
                         $reg_from_ucenter = 1;
                         ts_add_ucenter_user_ref($user['uid'], $uc_user['0'], $uc_user['1']);
                         // 将用户添加到myop_userlog,以使漫游应用能获取到用户信息
                         $userlog = array('uid' => $user['uid'], 'action' => 'add', 'type' => '0', 'dateline' => time());
                         M('myop_userlog')->add($userlog);
                         if (isset($message_data) && !empty($message_data)) {
                             $message_data['to'] = $user['uid'];
                             model('Message')->postMessage($message_data, M('user')->getField('uid', 'admin_level=1'));
                         }
                         //关联操作
                         //$this->registerRelation($user['uid']);
                     } else {
                         $user = array();
                     }
                 } else {
                     if ($username != $uc_user_ref['uc_username']) {
                         ts_update_ucenter_user_ref('', $uc_user_ref['uc_uid'], $username);
                     }
                     $user = M('user')->where("uid={$uc_user_ref['uid']}")->find();
                     if (md5($password) != $user['password']) {
                         M('user')->where("uid={$uc_user_ref['uid']}")->setField('password', md5($password));
                     }
                 }
             }
         } else {
             $uc_user_ref = ts_get_ucenter_user_ref('', '', $username);
             if ($uc_user_ref['uid']) {
                 $user = service('Passport')->getLocalUser($uc_user_ref['uid'], $password);
             }
         }
     }
     $result['login'] = '';
     if ($user) {
         $result['login'] = UC_SYNC && $uc_user[0] ? uc_user_synlogin($uc_user[0]) : '';
     }
     $result['user'] = $user;
     $result['reg_from_ucenter'] = $reg_from_ucenter;
     return $result;
 }
Exemple #14
0
 function checkemail(&$msg, $email)
 {
     $ucresult = uc_user_checkemail($email);
     if ($ucresult == -4) {
         $msg = "Email 格式有误";
     } elseif ($ucresult == -5) {
         $msg = "Email 不允许注册";
     } elseif ($ucresult == -6) {
         $msg = "该 Email 已经被注册";
     }
 }
Exemple #15
0
require './include/common.inc.php';
$url = empty($_GET['url']) ? $_POST['url'] : $_GET['url'];
if ($command == 'registed') {
    if ($cyask_uid) {
        show_message('login_succeed', $url);
    }
    if (check_submit($_POST['registsubmit'], $_POST['formhash'])) {
        $cyask_user = trim($_POST['username']);
        $cyask_user = strtolower($cyask_user);
        $password = trim($_POST['password']);
        $email = $_POST['email'];
        $username_ok = filters_username($cyask_user);
        if (!$username_ok) {
            show_message('regist_name_error', '');
        }
        $email_ok = uc_user_checkemail($email);
        if (!$email_ok) {
            show_message('regist_email_error' . abs($email_ok), '');
        }
        $usernum = uc_user_checkname($cyask_user);
        if ($usernum != 1) {
            show_message('regist_name_used', '');
        } else {
            $password = trim($_POST['password']);
            $cyask_uid = uc_user_register($cyask_user, $password, $email);
            if ($cyask_uid > 0) {
                $dblink->query("INSERT INTO {$dbprefix}members(uid,username,email,adminid,groupid) VALUES('{$cyask_uid}','{$cyask_user}','{$email}','5','0')");
                list($cyask_uid, $username, $passwd, $email) = uc_user_login($cyask_user, $password);
                uc_dsetcookie('auth', uc_authcode($cyask_uid . "\t" . $username . "\t" . $email, 'ENCODE'), 86400 * 365);
                $syninfo = uc_user_synlogin($cyask_uid);
                show_message('regist_succeed', $url);
Exemple #16
0
            exit("true");
        } else {
            exit("false");
        }
    }
    empty($user) ? exit("true") : exit("false");
} elseif ($act == 'check_email') {
    require_once QISHI_ROOT_PATH . 'include/fun_user.php';
    $email = trim($_POST['email']);
    if (strcasecmp(QISHI_DBCHARSET, "utf8") != 0) {
        $email = utf8_to_gbk($email);
    }
    $user = get_user_inemail($email);
    if (defined('UC_API')) {
        include_once QISHI_ROOT_PATH . 'uc_client/client.php';
        if (uc_user_checkemail($email) === 1 && empty($user)) {
            exit("true");
        } else {
            exit("false");
        }
    }
    empty($user) ? exit("true") : exit("false");
} elseif ($act == "top_loginform") {
    $contents = '';
    if ($_COOKIE['QS']['username'] && $_COOKIE['QS']['password']) {
        $contents = '欢迎&nbsp;&nbsp;<a href="{#$user_url#}" style="color:#339900">{#$username#}</a> 登录!&nbsp;&nbsp;{#$pmscount_a#}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{#$user_url#}">[会员中心]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="{#$logout_url#}" >[退出]</a>';
    } elseif ($_SESSION['activate_username'] && defined('UC_API')) {
        $contents = ' &nbsp;&nbsp;您的帐号 {#$activate_username#} 需激活后才可以使用! <a href="{#$activate_url#}" style="color:#339900">立即激活</a>';
    } else {
        $contents = '欢迎来到{#$site_name#}!&nbsp;&nbsp;&nbsp;&nbsp;<a href="{#$login_url#}" >[登录]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="{#$reg_url#}" >[免费注册]</a>';
    }
 function doregister()
 {
     extract($_POST);
     //用户名需过滤的字符的正则
     $stripChar = '?<*.>\'';
     if ($_SESSION['_verify_']['verify'] != strtolower($verify)) {
         $this->error("验证码错误!");
     } else {
         if (preg_match('/[' . $stripChar . ']/is', $name) == 1) {
             $this->error('用户名中包含' . $stripChar . '等非法字符!');
         } else {
             if ($pass != $repass) {
                 $this->error("两次密码输入不一致!");
             } else {
                 if (strlen($pass) < 5 || strlen($pass) > 12) {
                     $this->error("密码长度至少5位,最多12位!");
                 } else {
                     if (ereg("/^[a-z]([a-z0-9]*[-_\\.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\\.][a-z]{2,3}([\\.][a-z]{2})?\$/i;", $email)) {
                         $this->error("邮箱格式不正确!");
                     } else {
                         $where['user_login_name'] = $name;
                         $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($name);
                         }
                         $result = M('Members')->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($name, $pass, $email);
                                 //exit($uc_uid);
                                 if ($uc_uid < 0) {
                                     $uc_register = false;
                                 }
                             }
                             if ($uc_register) {
                                 $data = array('user_login_name' => $name, 'user_email' => $email, 'user_pass' => sp_password($pass), 'last_login_ip' => get_client_ip(), 'create_time' => time(), 'last_login_time' => time(), 'user_status' => '2');
                                 $rst = M('Members')->add($data);
                                 //登入成功页面跳转
                                 $_SESSION["MEMBER_type"] = 'local';
                                 $_SESSION["MEMBER_id"] = $rst;
                                 $_SESSION['MEMBER_name'] = $name;
                                 $_SESSION['MEMBER_status'] = '2';
                                 //发送激活邮件
                                 self::_send_to_active();
                                 $this->success("注册成功!", U("Member/center/index"));
                             } else {
                                 $this->error("注册失败!", U("Member/index/register"));
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #18
0
function checkemail($email)
{
    $email = strtolower(trim($email));
    if (strlen($email) > 32) {
        showmessage('profile_email_illegal', '', array(), array('handle' => false));
    }
    loaducenter();
    $ucresult = uc_user_checkemail($email);
    if ($ucresult == -4) {
        showmessage('profile_email_illegal', '', array(), array('handle' => false));
    } elseif ($ucresult == -5) {
        showmessage('profile_email_domain_illegal', '', array(), array('handle' => false));
    } elseif ($ucresult == -6) {
        showmessage('profile_email_duplicate', '', array(), array('handle' => false));
    }
}
Exemple #19
0
 function registration_errors($errors, $user_login, $user_email)
 {
     if (uc_user_checkname($user_login) < 0) {
         $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'ucenter'));
     }
     if (uc_user_checkemail($user_email) < 0) {
         $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'ucenter'));
     }
     return $errors;
 }
 static function user_checkemail($email)
 {
     global $kekezu;
     if ($kekezu->_sys_config['user_intergration'] == 1) {
         $member_obj = new Keke_witkey_member_class();
         $member_obj->setWhere('email="' . $email . '"');
         $res = $member_obj->count_keke_witkey_member();
         $res = $res == 0 ? 1 : -6;
     } elseif ($kekezu->_sys_config['user_intergration'] == 2) {
         require_once S_ROOT . '/uc_client/client.php';
         $res = uc_user_checkemail($email);
     }
     return $res;
 }
Exemple #21
0
	/**
	 * 检查email
	 * @param string $email	email
	 * @return int {-1:email已经存在 ;-5:邮箱禁止注册;1:成功}
	 */
	public function checkemail($is_return=0) {
		$this->email = isset($this->email) ? $this->email : isset($this->data['email']) ? $this->data['email'] : '';
		if(empty($this->email)) {
			if ($is_return) {
				return -1;
			} else {
				exit('-1');
			}
		}
		//非法关键词判断
		$denyemail = $this->settings['denyemail'];
		if(is_array($denyemail)) {
			$denyemail = implode("|", $denyemail);
			$pattern = '/^('.str_replace(array('\\*', ' ', "\|"), array('.*', '', '|'), preg_quote($denyemail, '/')).')$/i';
			if(preg_match($pattern, $this->email)) {
				if ($is_return) {
					return -5;
				} else {
					exit('-5');
				}
			}
		}
		
		//UCenter部分
		if ($this->config['ucuse']) {
			pc_base::load_config('uc_config');
			require_once PHPCMS_PATH.'api/uc_client/client.php';
			$rs= uc_user_checkemail($this->email);
			if ($rs < 1) {
				exit('-5');
			}
		}

		$r = $this->db->get_one(array('email'=>$this->email));
		if ($is_return) {
			return !empty($r) ? -1 : 1;
		} else {
			!empty($r) ? exit('-1') : exit('1');
		}
	}
Exemple #22
0
 /**
  *
  * 检测邮箱状态 ...
  * @param string $email
  */
 public function check_reg_mail($email, $member_id = 0, $identifier = 0)
 {
     $checkemail = 0;
     //邮箱未传值,未检测
     if ($email) {
         $checkemail = 1;
         //开始检测
         if (!hg_check_email_format($email)) {
             $checkemail = -4;
         }
         if ($checkemail > 0 && $this->settings['ucenter']['open'] && !$identifier) {
             $mMember = new member();
             $ucid = $mMember->checkUc($member_id);
             include_once CUR_CONF_PATH . 'uc_client/client.php';
             if ($ucid) {
                 $ucInfo = uc_get_user($ucid, 1);
                 if ($ucInfo && $ucInfo[2] == $email) {
                     return 1;
                 }
             }
             $checkemail = uc_user_checkemail($email);
         }
         if ($checkemail > 0) {
             if ($member_id) {
                 $where = ' AND member_id!=' . $member_id;
             }
             $sql = 'SELECT count(*) as total FROM ' . DB_PREFIX . 'member_bind WHERE 1 ' . $where . ' AND platform_id=\'' . $email . '\' AND identifier = ' . $identifier;
             $result = $this->db->query_first($sql);
             if ($result['total']) {
                 $checkemail = -6;
             }
         }
     }
     return $checkemail;
 }
Exemple #23
0
     } else {
         $msg = CheckUserID($uid, $msgtitle, false);
     }
     if ($msg == 'ok') {
         $msg = "<font color='#4E7504'><b>√{$msgtitle}可以使用</b></font>";
     } else {
         $msg = "<font color='red'><b>×{$msg}</b></font>";
     }
     echo $msg;
     exit;
 } else {
     if ($dopost == "checkmail") {
         AjaxHead();
         #api{{
         if (defined('UC_API') && @(include_once DEDEROOT . '/uc_client/client.php')) {
             $ucresult = uc_user_checkemail($email);
             if ($ucresult > 0) {
                 echo "<font color='#4E7504'><b>√可以使用</b></font>";
             } elseif ($ucresult == -4) {
                 echo "<font color='red'><b>×Email 格式有误!</b></font>";
             } elseif ($ucresult == -5) {
                 echo "<font color='red'><b>×Email 不允许注册!</b></font>";
             } elseif ($ucresult == -6) {
                 echo "<font color='red'><b>×该 Email 已经被注册!</b></font>";
             }
             exit;
         }
         #/aip}}
         if ($cfg_md_mailtest == 'N') {
             $msg = "<font color='#4E7504'><b>√可以使用</b></font>";
         } else {
Exemple #24
0
	function CheckEmail()
	{
		$email=trim($this->Post['email'] ? $this->Post['email'] : $this->Post['check_value']);
		if (strlen($email) < 5) {
			response_text(__("请输入正确的Email地址"));
		}

		$host=strstr($email,'@');
		if (stristr($this->Config["reg_email_forbid"],$host)!==false)
		{
			$response= __("由于您邮件服务提供商会过滤本站程序发送的有效邮件,请重新填写一个EMAIL地址。");
			response_text($response);
		}
		include(LIB_PATH."validate.han.php");
		$this->ValidateHandler=new ValidateHandler();
		if ($this->ValidateHandler->IsValid($email,"email")==false)
		{
			$response= __("您输入的EMAIL地址格式无效") ;
			response_text($response);
		}

		$response = sprintf(__("对不起,您输入的EMAIL地址 <b>%s</b> 不能注册或已经被他人使用"), $email) ;
		if($this->Config["reg_email_doublee"]!= "1")
		{

			$this->DatabaseHandler->SetTable(TABLE_PREFIX. 'system_members');
			$is_exists=$this->DatabaseHandler->Select('',"email='{$email}'");
			if($is_exists!==false) response_text($response);
		}

		if(true === UCENTER)
		{
			include_once(UC_CLIENT_ROOT . './client.php');

			$uc_result = uc_user_checkemail($email);

			if($uc_result < 0) {
				response_text($response);
			}
		}
		exit ;
	}
function handreg($username, $email, $password)
{
    error_reporting(~E_ALL);
    $username = addslashes($username);
    $email = addslashes($email);
    $password = addslashes($password);
    $ckem = uc_user_checkemail($email);
    if ($ckem == "-6") {
        $remsg['msg'] = '该 Email 已经被注册';
        $remsg['jg'] = '-6';
        return $remsg;
    }
    $uid = uc_user_register($username, $password, $email);
    if ($uid <= 0) {
        if ($uid == -6) {
            $remsg['msg'] = '该 Email 已经被注册';
            $remsg['jg'] = '-6';
            return $remsg;
        } elseif ($uid == -2) {
            $remsg['msg'] = '包含不允许注册的词语';
            $remsg['jg'] = '-2';
            return $remsg;
        } elseif ($uid == -3) {
            $remsg['msg'] = '用户名已经存在';
            $remsg['jg'] = '-3';
            return $remsg;
        } elseif ($uid == -4) {
            $remsg['msg'] = 'Email 格式有误';
            $remsg['jg'] = '-4';
            return $remsg;
        } elseif ($uid == -5) {
            $remsg['msg'] = 'Email 不允许注册';
            $remsg['jg'] = '-5';
            return $remsg;
        } elseif ($uid == -1) {
            $remsg['msg'] = '用户名不合法';
            $remsg['jg'] = '-1';
            return $remsg;
        } else {
            $remsg['msg'] = '未定义';
            $remsg['jg'] = '-7';
            return $remsg;
        }
    } else {
        $remsg['msg'] = '注册成功';
        $remsg['jg'] = '1';
        $remsg['uid'] = $uid;
        include './dorun/Run_Mysql.php';
        mysql_query("insert into " . $mysql_head . "common_member(uid,username,adminid) values('{$uid}','{$username}','0')", $linka);
        mysql_query("insert into " . $mysql_head . "common_member_count(uid) values('{$uid}')", $linka);
        return $remsg;
    }
    /*
    	mysqli_query($dbc,"INSERT INTO pre_common_member(uid,username,adminid) VALUES ('$uid','$login_user_name','0')") and 
                      mysqli_query($dbc,"INSERT INTO pre_common_member_count (uid) values ('$uid')")
    */
}
Exemple #26
0
function uc_user_register($username, $password, $email, $nickname, $questionid = '', $answer = '', $regip = '', $addorg = 1)
{
    if ($nickname && ($status = uc_user_checkname($nickname)) < 0) {
        return $status;
    }
    if (($status = uc_user_checkusername($username)) < 0) {
        return $status;
    }
    if (($status = uc_user_checkemail($email)) < 0) {
        return $status;
    }
    $uid = uc_add_user($username, $password, $email, $nickname, 0, $questionid, $answer, $regip);
    //加入默认机构
    if ($addorg && is_array($uid) && getglobal('setting/defaultdepartment') && DB::fetch_first("select orgid from %t where orgid=%d ", array('organization', getglobal('setting/defaultdepartment')))) {
        C::t('organization_user')->insert($uid['uid'], getglobal('setting/defaultdepartment'));
    }
    return $uid;
}
function checkemail($email)
{
    global $_G;
    $email = strtolower(trim($email));
    if (strlen($email) > 32) {
        showmessage('profile_email_illegal', '', array(), array('handle' => false));
    }
    if ($_G['setting']['regmaildomain']) {
        $maildomainexp = '/(' . str_replace("\r\n", '|', preg_quote(trim($_G['setting']['maildomainlist']), '/')) . ')$/i';
        if ($_G['setting']['regmaildomain'] == 1 && !preg_match($maildomainexp, $email)) {
            showmessage('profile_email_domain_illegal', '', array(), array('handle' => false));
        } elseif ($_G['setting']['regmaildomain'] == 2 && preg_match($maildomainexp, $email)) {
            showmessage('profile_email_domain_illegal', '', array(), array('handle' => false));
        }
    }
    loaducenter();
    $ucresult = uc_user_checkemail($email);
    if ($ucresult == -4) {
        showmessage('profile_email_illegal', '', array(), array('handle' => false));
    } elseif ($ucresult == -5) {
        showmessage('profile_email_domain_illegal', '', array(), array('handle' => false));
    } elseif ($ucresult == -6) {
        showmessage('profile_email_duplicate', '', array(), array('handle' => false));
    }
}
Exemple #28
0
 function in_checkusername()
 {
     $username = $this->fun->accept('username', 'R');
     $email = $this->fun->accept('email', 'R');
     if (!preg_match("/^[^!@~`\\'\"#\$\\%\\^&\\*\\(\\)\\+\\-\\{\\}\\[\\]\\|\\/\\?\\<\\>\\,\\.\\:\\;]{2,16}\$/i", $username) && !empty($username)) {
         exit('false');
     } elseif (!preg_match("/^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+\$/i", $email) && !empty($email)) {
         exit('false');
     }
     if ($this->CON['mem_isucenter']) {
         include_once admin_ROOT . 'public/uc_client/client.php';
         if (!empty($username)) {
             $data = uc_get_user($username);
             if ($data) {
                 exit('false');
             }
         } elseif (!empty($email)) {
             $ucresult = uc_user_checkemail($email);
             if ($ucresult == -6 || $ucresult == -5) {
                 exit('false');
             }
         }
     }
     $db_table = db_prefix . 'member';
     if (!empty($username)) {
         $lockusername = explode(',', $this->CON['mem_lock']);
         if (in_array($username, $lockusername)) {
             exit('false');
         }
         $db_where = " WHERE username='******'";
     } elseif (!empty($email)) {
         $db_where = " WHERE email='{$email}'";
     }
     $countnum = $this->db_numrows($db_table, $db_where);
     if ($countnum > 0) {
         $exportAjax = 'false';
     } else {
         $exportAjax = 'true';
     }
     exit($exportAjax);
 }
 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"));
         }
     }
 }
Exemple #30
0
 function checkemail($email, $ckhas = true)
 {
     if (!isemail($email)) {
         return lang('email_format_error');
     }
     if ($ckhas) {
         #api{{
         if (defined('UC_API') && @(include_once ROOT_PATH . '/uc_client/client.php')) {
             $ucresult = uc_user_checkemail($email);
             if ($ucresult > 0) {
                 return "OK";
             } elseif ($ucresult == -4) {
                 return lang('email_format_error');
             } elseif ($ucresult == -5) {
                 return lang('email_notallow_rege');
             } elseif ($ucresult == -6) {
                 return lang('email_been_rege');
             }
             exit;
         } else {
             #/aip}}
             $row = $this->db->fetch_first("Select * From `{$this->table}` where email like '{$email}' ");
             if (is_array($row)) {
                 return lang('email_been_rege');
             }
             return "OK";
         }
     }
     return "OK";
 }