コード例 #1
0
ファイル: check_bind.php プロジェクト: h3len/Project
 public function checkUc()
 {
     try {
         $identifierUserSystem = new identifierUserSystem();
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         $check_Bind = new check_Bind();
         if ($this->input['platform_id']) {
             $platform_id = $this->input['platform_id'];
             $type = $this->input['type'];
         } elseif ($this->input['member_name']) {
             $user_name = trim($this->input['member_name']);
             $member_id = $check_Bind->bind_to_memberid($user_name, 'uc', false, $identifier);
             //优先检测uc类型
             $type = 'uc';
             if (empty($member_id)) {
                 $member_id = $check_Bind->bind_to_memberid($user_name, 'm2o', false, $identifier);
                 $type = 'm2o';
             }
             if (empty($member_id)) {
                 $member_id = $check_Bind->bind_to_memberid($user_name, 'shouji', false, $identifier);
                 $type = 'shouji';
             }
             if (empty($member_id)) {
                 $platform_id = $this->input['member_name'];
                 $type = $this->input['type'];
             }
         }
         $is_bind = 0;
         if (empty($member_id)) {
             $member_id = $check_Bind->bind_to_memberid($platform_id, $type, true, $identifier);
         }
         $is_bind = $check_Bind->check_uc($member_id, $type);
         $this->addItem_withkey('is_bind', $is_bind);
         $this->output();
     } catch (Exception $e) {
         $this->errorOutput($e->getMessage(), $e->getCode());
     }
 }
コード例 #2
0
ファイル: member.php プロジェクト: h3len/Project
 /**
  *
  *用户名状态检测
  */
 public function check_membername_exists()
 {
     try {
         $member_name = $this->input['member_name'];
         $identifierUserSystem = new identifierUserSystem();
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         $ret_verify = $this->mMember->verify_member_name($member_name, 0, $identifier);
         switch ($ret_verify) {
             case -1:
                 $this->errorOutput(MEMBER_NAME_ILLEGAL);
                 break;
             case -2:
                 $this->errorOutput(PROHIBITED_WORDS);
                 break;
             case -3:
                 $this->errorOutput(UC_MEMBER_NAME_REGISTER);
                 break;
             case -4:
                 $this->errorOutput(MEMBER_NAME_EXCEEDS_MAX);
                 break;
             case -5:
                 $this->errorOutput(USERNAME_BELOW_MINIMUM);
                 break;
             case -6:
                 $this->errorOutput(MEMBER_NAME_ERROR);
                 break;
             case -7:
                 $this->errorOutput(MEMBER_NAME_REGISTER);
                 break;
             default:
                 $this->addItem(array('member_name' => $member_name));
                 $this->output();
                 break;
         }
     } catch (Exception $e) {
         $this->errorOutput($e->getMessage(), $e->getCode());
     }
 }
コード例 #3
0
ファイル: member_update.php プロジェクト: h3len/Project
 public function reset_password()
 {
     $this->check_verifycode();
     $verifycode = trim($this->input['verifycode']);
     $member_name = trim($this->input['member_name']);
     $password = trim($this->input['password']);
     $type = isset($this->input['type']) ? intval($this->input['type']) : -1;
     //验证码类型
     $identifierUserSystem = new identifierUserSystem();
     $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
     //多用户系统
     if (!$verifycode) {
         $this->errorOutput(VERIFY_NULL);
     }
     if (!$password) {
         $this->errorOutput(NO_NEW_PASSWORD);
     }
     if ($type == '-1' && hg_check_email_format($member_name)) {
         $member_type = 'email';
         $type = 1;
     } elseif ($type == '-1' && hg_verify_mobile($member_name)) {
         $member_type = 'shouji';
         $type = 0;
     } else {
         if ($type == 0) {
             $member_type = 'shouji';
         } else {
             if ($type == 1) {
                 $member_type = 'email';
             }
         }
     }
     $condition = " AND platform_id = '" . $member_name . "' AND mb.type='{$member_type}' AND mb.identifier=" . $identifier . "";
     $field = 'mb.member_id,platform_id,mb.type';
     $bind_info = $this->mMember->get_bind_info($condition, $field);
     $bind_info = $bind_info[0];
     if (empty($bind_info)) {
         $this->errorOutput(NO_MEMBER);
     }
     $data = array();
     $data['member_id'] = $bind_info['member_id'];
     //根据验证码修改密码、
     if (!$type) {
         if ($this->mSmsServer->get_verifycode_info($member_name, $verifycode)) {
             //验证成功之后删除
             $this->mSmsServer->mobile_verifycode_delete($member_name, $verifycode);
             if ($this->settings['ucenter']['open']) {
                 $_member_name = $member_name;
                 $is_password = $this->mMember->uc_user_edit($_member_name, '', $password, '', 1);
             }
             if ($password && ($is_password >= 0 || !$this->settings['ucenter']['open'])) {
                 $salt = hg_generate_salt();
                 $data['salt'] = $salt;
                 $md5_password = md5(md5($password) . $salt);
                 $data['password'] = $md5_password;
             } elseif ($password && ($is_password < 0 && $this->settings['ucenter']['open'])) {
                 $this->errorOutput('UC密码同步失败');
             }
             if ($this->mMember->update($data)) {
                 $bind_info['status'] = 1;
                 $this->addItem($bind_info);
                 $this->output();
             }
         } else {
             $this->errorOutput(MOBILE_VERIFY_FAILED);
         }
     } else {
         if ($this->memberverifycode->get_verifycode_info($member_name, $verifycode, $type, $action = 1)) {
             //验证成功之后删除
             $this->memberverifycode->verifycode_delete($member_name, $verifycode, $type, $action = 1);
             if ($this->settings['ucenter']['open']) {
                 $_member_name = $member_name;
                 $is_password = $this->mMember->uc_user_edit($_member_name, '', $password, '', 1);
             }
             if ($password && ($is_password > 0 || !$this->settings['ucenter']['open'])) {
                 $salt = hg_generate_salt();
                 $data['salt'] = $salt;
                 $md5_password = md5(md5($password) . $salt);
                 $data['password'] = $md5_password;
             } elseif ($password && ($is_password < 0 && $this->settings['ucenter']['open'])) {
                 $this->errorOutput('UC密码同步失败');
             }
             if ($this->mMember->update($data)) {
                 $bind_info['status'] = 1;
                 $this->addItem($bind_info);
                 $this->output();
             }
         } else {
             $this->errorOutput(EMAIL_VERIFY_FAILED);
         }
     }
 }
コード例 #4
0
ファイル: register.php プロジェクト: h3len/Project
 /**
  *  检查手机号 格式 是否被注册
  */
 public function checkmobile()
 {
     try {
         $identifierUserSystem = new identifierUserSystem();
         $mobile = $this->input['mobile'] ? $this->input['mobile'] : 0;
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         if ($mobile && !hg_verify_mobile($mobile)) {
             $this->errorOutput(MOBILE_NUMBER_FORMAT_ERROR);
         } else {
             if ($mobile || defined('NO_VERIFY_MOBILEBIND') && NO_VERIFY_MOBILEBIND) {
                 $check_bind = new check_Bind();
                 if ($check_bind->checkmembernamereg($mobile, $identifier)) {
                     $this->errorOutput(MOBILE_REG_BIND);
                 }
             }
         }
     } catch (Exception $e) {
         $this->errorOutput($e->getMessage(), $e->getCode());
     }
 }
コード例 #5
0
ファイル: member_credits.php プロジェクト: h3len/Project
 private function get_condition()
 {
     $condition = '';
     if (($gid = (int) $this->input['groupid']) > 0 || ($gradeid = (int) $this->input['gradeid']) > 0) {
         $this->memberCredits->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member as m ON m.member_id = mc.u_id');
         $gid && ($condition = ' AND m.gid = \'' . $gid . '\'');
         $gradeid && ($condition = ' AND m.gradeid = \'' . $gradeid . '\'');
         $this->memberCredits->setWhere($condition);
     } else {
         if (isset($this->input['startcredit1']) || isset($this->input['endcredit1'])) {
             if (($startcredit1 = (int) $this->input['startcredit1']) || isset($this->input['startcredit1'])) {
                 $condition = ' AND credit1>=' . $startcredit1;
                 $this->memberCredits->setWhere($condition);
             }
             if ((($endcredit1 = (int) $this->input['endcredit1']) || isset($this->input['endcredit1'])) && $endcredit1 >= $startcredit1) {
                 $condition = ' AND ' . 'credit1<=' . $endcredit1;
                 $this->memberCredits->setWhere($condition);
             }
         } else {
             if (isset($this->input['startcredit2']) || isset($this->input['endcredit2'])) {
                 if (($startcredit2 = (int) $this->input['startcredit2']) || isset($this->input['startcredit2'])) {
                     $condition = ' AND credit2>=' . $startcredit2;
                     $this->memberCredits->setWhere($condition);
                 }
                 if ((($endcredit2 = (int) $this->input['endcredit2']) || isset($this->input['endcredit2'])) && $endcredit2 >= $startcredit2) {
                     $condition = ' AND ' . 'credit2<=' . $endcredit2;
                     $this->memberCredits->setWhere($condition);
                 }
             } else {
                 if (($fbid = (int) $this->input['fbid']) > 0) {
                     $feedback = new feedback();
                     $membersId = $feedback->get_feed_members($fbid, '0,1');
                     if (!$membersId) {
                         throw new Exception(FEEDBACK_ID_NO_MEMBER, 200);
                     }
                     $this->memberCredits->setWhere(array('u_id' => $membersId['member_id']));
                 } else {
                     if ($spreadCode = trim($this->input['spreadcode'])) {
                         $this->memberCredits->setJoin(' LEFT JOIN ' . DB_PREFIX . 'spread_record as sr ON mc.u_id=sr.fuid');
                         $condition = " AND sr.spreadcode = '" . $spreadCode . "'";
                         $this->memberCredits->setWhere($condition);
                     } else {
                         if (($invite_userid = (int) $this->input['invite_userid']) > 0) {
                             $_invite = new invite();
                             $fuidArr = $_invite->select_uid_to_fuid($invite_userid, 'mi.fuid', 'fuid', 3, false);
                             if (!$fuidArr) {
                                 throw new Exception(MEMBER_NO_INVITE_MEMBERS, 200);
                             }
                             $this->memberCredits->setWhere(array('u_id' => $fuidArr));
                         } else {
                             if (($medalid = (int) $this->input['medalid']) > 0) {
                                 $this->memberCredits->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member_medal as mm ON mm.member_id=mc.u_id');
                                 $condition = " AND mm.medalid = " . $medalid . " AND (mm.expiration=0 OR mm.expiration>" . TIMENOW . ")";
                                 $this->memberCredits->setWhere($condition);
                             } else {
                                 if ($member_type = trim($this->input['member_type'])) {
                                     $this->memberCredits->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member_bind as mb ON mb.member_id=mc.u_id');
                                     $condition = ' AND mb.type = \'' . $member_type . '\'';
                                     $this->memberCredits->setWhere($condition);
                                 } else {
                                     if ($this->input['start_time'] || $this->input['end_time']) {
                                         $this->memberCredits->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member as m ON m.member_id = mc.u_id');
                                         if ($start_time = trim(urldecode($this->input['start_time']))) {
                                             $start_time = strtotime($start_time);
                                             $condition = " AND m.create_time >= " . (int) $start_time;
                                             $this->memberCredits->setWhere($condition);
                                         }
                                         if ($end_time = trim(urldecode($this->input['end_time']))) {
                                             $end_time = strtotime($end_time);
                                             if ($end_time >= $start_time) {
                                                 $condition = " AND m.create_time <= " . (int) $end_time;
                                                 $this->memberCredits->setWhere($condition);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (($appid = (int) $this->input['mappid']) > 0) {
         $this->memberCredits->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member as m ON m.member_id = mc.u_id');
         $condition = " AND m.appid = " . $appid;
         $this->memberCredits->setWhere($condition);
     }
     if (isset($this->input['identifier'])) {
         $identifierUserSystem = new identifierUserSystem();
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         $this->memberCredits->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member as m ON m.member_id = mc.u_id');
         $condition = " AND m.identifier = " . $identifier;
         $this->memberCredits->setWhere($condition);
     }
     $this->memberCredits->setAs('mc');
     return $condition;
 }
コード例 #6
0
ファイル: member.php プロジェクト: h3len/Project
 private function get_condition()
 {
     $condition = '';
     //搜索标签
     if ($this->input['searchtag_id']) {
         $searchtag = $this->searchtag_detail(intval($this->input['searchtag_id']));
         foreach ((array) $searchtag['tag_val'] as $k => $v) {
             if (in_array($k, array('_id'))) {
                 //防止左边栏分类搜索无效
                 continue;
             }
             $this->input[$k] = $v;
         }
     }
     //搜索标签
     if (isset($this->input['k']) && !empty($this->input['k']) || (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0')) {
         if (isset($this->input['k']) && !empty($this->input['k'])) {
             $key = trim($this->input['k']);
         } elseif (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0') {
             $key = trim($this->input['key']);
         }
         $binary = '';
         //不区分大小些
         if (defined('IS_BINARY') && !IS_BINARY) {
             $binary = 'binary ';
         }
         $condition .= ' AND ' . $binary . ' m.member_name like \'%' . $key . '%\'';
     }
     if (isset($this->input['identifier']) && ($this->input['identifier'] > 0 || $this->input['identifier'] === "0")) {
         $identifierUserSystem = new identifierUserSystem();
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         $condition .= " AND m.identifier = " . $identifier;
     }
     if ($this->input['invite_user']) {
         if ($inviteUserId = $this->Members->get_member_id($this->input['invite_user'], false, false, '', $identifier)) {
             $fuidArr = $this->get_Invitees_user($inviteUserId, 'mi.fuid', 'fuid', '3', false);
             if ($fuidArr) {
                 $this->input['member_id'] = implode(',', $fuidArr);
             } else {
                 $this->errorOutput(MEMBER_NO_INVITE_MEMBERS);
             }
         } else {
             $this->errorOutput(NOT_INVITE_MEMBER);
         }
     }
     if ($spreadCode = trim($this->input['spreadCode'])) {
         $condition .= " AND sr.spreadcode = '" . $spreadCode . "'";
         $this->isSpread = 1;
     }
     if ($this->input['member_id']) {
         $condition .= " AND m.member_id IN (" . trim($this->input['member_id']) . ")";
     }
     if (isset($this->input['_id']) && intval($this->input['_id']) || isset($this->input['gid']) && intval($this->input['gid'])) {
         $gid = $this->input['_id'] ? intval($this->input['_id']) : intval($this->input['gid']);
         $condition .= " AND m.gid = " . $gid;
     }
     if (isset($this->input['gradeid']) && $this->input['gradeid'] != -1) {
         $condition .= " AND m.gradeid = " . $this->input['gradeid'];
     }
     if ($this->input['medalid'] && $this->input['medalid'] != -1) {
         $condition .= " AND mm.medalid = " . intval($this->input['medalid']) . " AND (mm.expiration=0 OR mm.expiration>" . TIMENOW . ")";
     }
     if (isset($this->input['member_type']) && $this->input['member_type'] != -1) {
         $member_type = $this->input['member_type'];
         $condition .= ' AND mb.type = \'' . $member_type . '\'';
     }
     if (isset($this->input['isBlackList']) && $this->input['isBlackList'] == 1) {
         $condition .= ' AND (mbl.deadline = -1 OR mbl.deadline != 0 AND mbl.deadline>' . TIMENOW . ')';
     }
     if (isset($this->input['status']) && $this->input['status'] != -1) {
         $condition .= " AND m.status = " . intval($this->input['status']);
     }
     if (isset($this->input['isVerify']) && $this->input['isVerify'] != -1) {
         $condition .= " AND m.isVerify = " . intval($this->input['isVerify']);
     }
     if (isset($this->input['member_appid']) && $this->input['member_appid'] != -1) {
         $condition .= " AND m.appid = " . intval($this->input['member_appid']);
     }
     if ($identifierName = trim($this->input['identifierName'])) {
         $condition .= ' AND ius.iusname like \'%' . $identifierName . '%\'';
         $this->isIus = 1;
     }
     if ($this->input['device_token']) {
         $condition .= " AND m.reg_device_token like '%" . trim($this->input['device_token']) . "%'";
     }
     if ($this->input['ip']) {
         $condition .= " AND m.ip like '%" . trim($this->input['ip']) . "%'";
     }
     if (isset($this->input['is_avatar']) && $this->input['is_avatar'] != -1) {
         if ($this->input['is_avatar']) {
             $condition .= " AND ( m.avatar != '' AND m.avatar !='a:0:{}')";
         } else {
             $condition .= " AND (m.avatar = '' OR m.avatar ='a:0:{}')";
         }
     }
     if (isset($this->input['is_mobile']) && $this->input['is_mobile'] != -1) {
         if ($this->input['is_mobile']) {
             $condition .= " AND m.mobile != ''";
         } else {
             $condition .= " AND m.mobile = ''";
         }
     } elseif (!empty($this->input['mobile'])) {
         $condition .= " AND m.mobile Like '%" . $this->input['mobile'] . "%'";
     }
     if (!empty($this->input['email'])) {
         $condition .= " AND m.email Like '%" . $this->input['email'] . "%'";
     }
     if ($this->input['start_time']) {
         $start_time = strtotime(trim(urldecode($this->input['start_time'])));
         $condition .= " AND m.create_time >= " . $start_time;
     }
     if ($this->input['end_time']) {
         $end_time = strtotime(trim(urldecode($this->input['end_time'])));
         $condition .= " AND m.create_time <= " . $end_time;
     }
     if (isset($this->input['date_search']) && !empty($this->input['date_search'])) {
         $today = strtotime(date('Y-m-d'));
         $tomorrow = strtotime(date('y-m-d', TIMENOW + 24 * 3600));
         switch (intval($this->input['date_search'])) {
             case 1:
                 //所有时间段
                 break;
             case 2:
                 //昨天的数据
                 $yesterday = strtotime(date('y-m-d', TIMENOW - 24 * 3600));
                 $condition .= " AND m.create_time > '" . $yesterday . "' AND m.create_time < '" . $today . "'";
                 break;
             case 3:
                 //今天的数据
                 $condition .= " AND m.create_time > '" . $today . "' AND m.create_time < '" . $tomorrow . "'";
                 break;
             case 4:
                 //最近3天
                 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600));
                 $condition .= " AND m.create_time > '" . $last_threeday . "' AND m.create_time < '" . $tomorrow . "'";
                 break;
             case 5:
                 //最近7天
                 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600));
                 $condition .= " AND m.create_time > '" . $last_sevenday . "' AND m.create_time < '" . $tomorrow . "'";
                 break;
             default:
                 //所有时间段
                 break;
         }
     }
     return $condition;
 }
コード例 #7
0
ファイル: bind.php プロジェクト: h3len/Project
 /**
  * 
  * 补充新浪绑定,QQ绑定等第三方绑定信息为正常M2O账号 ...
  * 目的是为了解决 新浪、QQ等第三方平台首次直接登陆系统后,资料信息不完善问题
  */
 public function supplementaryBindInfo()
 {
     try {
         $identifierUserSystem = new identifierUserSystem();
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         $member_name = $this->input['member_name'];
         $nick_name = $this->input['nick_name'];
         if (empty($member_name)) {
             $this->errorOutput(NO_MEMBER_NAME);
         }
         //如果是m2o注册类型屏蔽字检测
         if ($this->settings['App_banword']) {
             include ROOT_PATH . 'lib/class/banword.class.php';
             $banword = new banword();
             $member_name_banword = $banword->exists($member_name);
             if ($member_name_banword && is_array($member_name_banword)) {
                 $this->errorOutput(MEMBER_NAME_INVALID);
             }
         }
         switch ($this->mMember->verify_member_name($member_name, $user_id, $identifier)) {
             case -1:
                 $this->errorOutput(MEMBER_NAME_ILLEGAL);
                 break;
             case -2:
                 $this->errorOutput(PROHIBITED_WORDS);
                 break;
             case -3:
                 $this->errorOutput(UC_MEMBER_NAME_REGISTER);
                 break;
             case -4:
                 $this->errorOutput(MEMBER_NAME_EXCEEDS_MAX);
                 break;
             case -5:
                 $this->errorOutput(USERNAME_BELOW_MINIMUM);
                 break;
             case -6:
                 $this->errorOutput(MEMBER_NAME_ERROR);
                 break;
             case -7:
                 $this->errorOutput(MEMBER_NAME_REGISTER);
                 break;
             default:
                 break;
         }
         $mobile_verifycode = trim($this->input['mobile_verifycode']);
         $email_verifycode = trim($this->input['email_verifycode']);
         $email = $this->input['email'];
         if (empty($email)) {
             $this->errorOutput(NO_EMAIL);
         }
         $reg_mail = $this->Members->check_reg_mail($email, 0, $identifier);
         if ($reg_mail == -4) {
             $this->errorOutput(EMAIL_FORMAT_ERROR);
         } elseif ($reg_mail == -5) {
             $this->errorOutput(EMAIL_NO_REGISTER);
         } elseif ($reg_mail == -6) {
             $this->errorOutput(EMAIL_HAS_BINDED);
         }
         if ($email && isset($this->input['email_verifycode'])) {
             if ($this->memberverifycode->get_verifycode_info($email, $email_verifycode, 1, $action = 1)) {
                 //验证成功之后删除
                 $this->memberverifycode->verifycode_delete($member_name, $email_verifycode, 1, $action = 1);
             } else {
                 $this->errorOutput(VERIFY_FAILED);
             }
             $this->isemailverify = 1;
         }
         $mobile = $this->input['mobile'];
         //简单验证手机号格式
         if ($mobile && !hg_verify_mobile($mobile)) {
             $this->errorOutput(MOBILE_NUMBER_FORMAT_ERROR);
         } else {
             if ($mobile && (isset($this->input['mobile_verifycode']) || defined('NO_VERIFY_MOBILEBIND') && NO_VERIFY_MOBILEBIND)) {
                 $check_bind = new check_Bind();
                 if ($check_bind->checkmembernamereg($mobile, $identifier)) {
                     $this->errorOutput(MOBILE_REG_BIND);
                 }
             }
         }
         if ($mobile && isset($this->input['mobile_verifycode'])) {
             //验证码
             $verifycode = $this->mSmsServer->get_verifycode_info($mobile, $mobile_verifycode);
             if (empty($verifycode)) {
                 $this->errorOutput(VERIFY_FAILED);
             }
             //删除验证码
             $this->mSmsServer->mobile_verifycode_delete($mobile, $mobile_verifycode);
             if (TIMENOW > $verifycode['create_time'] + VERIFYCODE_EXPIRED_TIME) {
                 $this->errorOutput(VERIFY_EXPIRED);
             }
             $this->ismobileverify = 1;
         }
         $password = $this->input['password'];
         $user_id = $this->user['user_id'];
         if (!$user_id) {
             $this->errorOutput(NO_MEMBER_ID);
         }
         $cond = ' AND member_id = ' . $user_id;
         $memberInfo = $this->Members->get_member_info($cond);
         if (!$memberInfo) {
             $this->errorOutput(NO_MEMBER);
         }
         if ($memberInfo['type'] == 'm2o' || $memberInfo['type'] == 'uc') {
             $this->errorOutput(UPDATEM2O);
         }
         $updateMemberInfo['member_id'] = $user_id;
         $updateMemberInfo['type'] = 'm2o';
         $updateMemberInfo['type_name'] = 'M2O';
         $updateMemberInfo['member_name'] = $member_name;
         if (empty($password)) {
             $this->errorOutput(NO_PASSWORD);
         }
         $salt = hg_generate_salt();
         $updateMemberInfo['salt'] = $salt;
         $md5_password = md5(md5($password) . $salt);
         $updateMemberInfo['password'] = $md5_password;
         $email && ($updateMemberInfo['email'] = $email);
         $mobile && ($updateMemberInfo['mobile'] = $mobile);
         $this->mMember->update($updateMemberInfo);
         $membersql = new membersql();
         $this->mMember->bind_update(array('is_primary' => 0), $membersql->where(array('member_id' => $memberInfo['member_id'], 'type' => $memberInfo['type'])));
         $platform_id = $user_id;
         $inuc = 0;
         if (!$identifier && $this->settings['ucenter']['open']) {
             $register_data = array('member_name' => $member_name, 'password' => $password, 'email' => $email);
             $registerInfo = $this->mMember->uc_register($register_data);
             if ($registerInfo['member_id'] > 0) {
                 $inuc = $platform_id = $registerInfo['member_id'];
             }
         }
         //M2O绑定关系
         $bind_data = array('member_id' => $user_id, 'platform_id' => $platform_id, 'nick_name' => $nick_name, 'type' => 'm2o', 'type_name' => 'M2O', 'bind_time' => TIMENOW, 'bind_ip' => hg_getip(), 'inuc' => $inuc, 'is_primary' => 1, 'identifier' => $identifier, 'reg_device_token' => 'www', 'reg_udid' => $udid);
         $ret_bind = $this->mMember->bind_create($bind_data);
         //如果注册时填写邮箱则可以同时入绑定表
         if ($email) {
             if ($this->isemailverify || defined('NO_VERIFY_EMAILBIND') && NO_VERIFY_EMAILBIND) {
                 $_bind_data = $bind_data;
                 $_bind_data['platform_id'] = $email;
                 $_bind_data['is_primary'] = 0;
                 $_bind_data['type'] = 'email';
                 $_bind_data['type_name'] = '邮箱';
                 $_ret_bind = $this->mMember->bind_create($_bind_data);
                 if (empty($_ret_bind)) {
                     $this->errorOutput(BIND_DATA_ADD_FAILED);
                 }
                 unset($_bind_data, $_ret_bind);
             }
         }
         if ($mobile) {
             if ($this->ismobileverify || defined('NO_VERIFY_MOBILEBIND') && NO_VERIFY_MOBILEBIND) {
                 $_bind_data = $bind_data;
                 $_bind_data['platform_id'] = $mobile;
                 $_bind_data['is_primary'] = 0;
                 $_bind_data['type'] = 'shouji';
                 $_bind_data['type_name'] = '手机';
                 $_ret_bind = $this->mMember->bind_create($_bind_data);
                 if (empty($_ret_bind)) {
                     $this->errorOutput(BIND_DATA_ADD_FAILED);
                 }
                 unset($_bind_data, $_ret_bind);
             }
         }
         if ($inuc) {
             $_updateBind = array('inuc' => $inuc);
             $this->mMember->bind_update($_updateBind, ' WHERE member_id = ' . $user_id);
         }
         $this->addItem($bind_data);
         $this->output();
     } catch (Exception $e) {
         $this->errorOutput($e->getMessage(), $e->getCode());
     }
 }
コード例 #8
0
ファイル: login.php プロジェクト: h3len/Project
 /**
  * 验证会员
  * $member_name 会员名
  * $password 密码
  * $type 登陆类型
  * $appid
  * $appkey
  */
 public function verify_member()
 {
     try {
         $encrypt = $this->input['encrypt'] ? intval($this->input['encrypt']) : 0;
         $platform_id = trim($this->input['platform_id']);
         $password = $encrypt ? passport_decrypt(trim($this->input['password']), CUSTOM_APPKEY) : trim($this->input['password']);
         $type = trim($this->input['type']);
         $_type = trim($this->input['_type']);
         //防止本地M2O同步至UC后,再次验证本地密码BUG。
         $identifierUserSystem = new identifierUserSystem();
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         $ip = hg_getip();
         $need_password_type = array('shouji', 'm2o', 'email');
         $appid = intval($this->input['appid']);
         $appkey = trim($this->input['appkey']);
         //会员名
         if (!$platform_id) {
             $this->errorOutput(NO_MEMBER_NAME);
         }
         //密码
         if (!$password && in_array($type, $need_password_type)) {
             $this->errorOutput(NO_PASSWORD);
         }
         $condition = " AND mb.platform_id = '" . $platform_id . "' AND mb.type = '" . $type . "' AND mb.identifier = '" . $identifier . '\'';
         $_bind = $this->mMember->get_bind_info($condition);
         $bind = array();
         if (is_array($_bind) && count($_bind) > 1) {
             foreach ($_bind as $v) {
                 if ($v['inuc'] > 0) {
                     $bind = $v;
                     break;
                 }
             }
         } elseif (is_array($_bind)) {
             $bind = $_bind[0];
         }
         $member_id = intval($bind['member_id']);
         $platform_id = $bind['platform_id'];
         $condition = " AND m.member_id = " . $member_id;
         $fileds_array = array('member_id', 'member_name', 'password', 'salt', 'avatar', 'type', 'type_name', 'gid', 'gradeid', 'guid', 'signature', 'mobile', 'email', 'isVerify', 'identifier', 'last_login_device');
         $fields = implode(',', $fileds_array);
         $member_info = $this->mMember->get_member_info($condition, $fields);
         $member_info = $member_info[0];
         if (empty($member_info)) {
             $this->errorOutput(LOGIN_NOMEMBER_ERROR);
         }
         $isComplete = isUserComplete($member_info['type']);
         if (in_array($type, $need_password_type) && $_type != 'uc') {
             $encrypt_num = intval($this->input['encrypt_num']);
             if ($encrypt_num == 1) {
                 $md5_password = md5($password . $member_info['salt']);
             } else {
                 $md5_password = md5(md5($password) . $member_info['salt']);
             }
             if ($md5_password != $member_info['password']) {
                 $this->errorOutput(PASSWORD_ERROR);
             }
         } else {
             //验证新浪微博、腾讯微博、QQ、人人、豆瓣 等 用户信息
             //暂时不作处理
         }
         //积分规则调用
         $credit_rules = $this->Members->credits_rule('members_login_login', $member_info['member_id'], $coef = 1, $update = 1, APP_UNIQUEID);
         $copywriting_credit = copywriting_credit(array($credit_rules));
         $check_Bind = new check_Bind();
         $inuc = $check_Bind->check_uc($member_id, $type);
         if (!$inuc && ($_type == 'm2o' || $type == 'm2o') && $member_info['email']) {
             if ($inuc = $this->mMember->syncUcRegister($member_id, $member_info['member_name'], $password, $member_info['email'])) {
                 $platform_id = $inuc;
             }
         }
         $return = array('user_id' => $member_info['member_id'], 'platform_id' => (string) $platform_id, 'inuc' => $inuc, 'user_name' => $member_info['member_name'], 'nick_name' => $bind['nick_name'], 'type' => $member_info['type'], 'avatar' => $member_info['avatar'], 'copywriting' => '登录成功', 'copywriting_credit' => $copywriting_credit, 'isVerify' => $member_info['isVerify'], 'identifier' => $member_info['identifier'], 'isComplete' => $isComplete);
         $return = array_merge($return, $member_info);
         $this->addItem($return);
         $this->output();
     } catch (Exception $e) {
         $this->errorOutput($e->getMessage(), $e->getCode());
     }
 }
コード例 #9
0
ファイル: member_update.php プロジェクト: h3len/Project
 public function create()
 {
     try {
         $member_name = trim($this->input['member_name']);
         $nick_name = trim($this->input['nick_name']);
         if (!$nick_name) {
             $nick_name = $member_name;
         }
         $password = trim($this->input['password']);
         $mobile = $this->input['mobile'] ? intval($this->input['mobile']) : '';
         $email = $this->input['email'] ? trim($this->input['email']) : '';
         $signature = $this->input['signature'] ? trim(urldecode($this->input['signature'])) : '';
         $identifierUserSystem = new identifierUserSystem();
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         if (!$member_name) {
             $this->errorOutput(NO_MEMBER_NAME);
         }
         if (!$password) {
             $this->errorOutput(NO_PASSWORD);
         }
         if (!hg_verify_mobile($mobile) && !empty($mobile)) {
             $this->errorOutput(MOBILE_NUMBER_FORMAT_ERROR);
         }
         $reg_mail = $this->Members->check_reg_mail($email, 0, $identifier);
         if ($reg_mail == -4) {
             $this->errorOutput(EMAIL_FORMAT_ERROR);
         } elseif ($reg_mail == -5) {
             $this->errorOutput(EMAIL_NO_REGISTER);
         } elseif ($reg_mail == -6) {
             $this->errorOutput(EMAIL_HAS_BINDED);
         }
         //头像
         $avatar = array();
         if ($_FILES['avatar']['tmp_name']) {
             $avatar = $_FILES['avatar'];
         }
         //验证会员名
         $ret_verify = $this->mMember->verify_member_name($member_name, 0, $identifier);
         switch ($ret_verify) {
             case -1:
                 $this->errorOutput(MEMBER_NAME_ILLEGAL);
                 break;
             case -2:
                 $this->errorOutput(PROHIBITED_WORDS);
                 break;
             case -3:
                 $this->errorOutput(UC_MEMBER_NAME_REGISTER);
                 break;
             case -4:
                 $this->errorOutput(MEMBER_NAME_EXCEEDS_MAX);
                 break;
             case -5:
                 $this->errorOutput(USERNAME_BELOW_MINIMUM);
                 break;
             case -6:
                 $this->errorOutput(MEMBER_NAME_ERROR);
                 break;
             case -7:
                 $this->errorOutput(MEMBER_NAME_REGISTER);
                 break;
             default:
                 break;
         }
         //更新积分
         $credits = array();
         if ($this->input['credit'] && is_array($this->input['credit'])) {
             foreach ($this->input['credit'] as $key => $val) {
                 if ($val !== '') {
                     $credits[$key] = intval($val);
                 }
             }
             if ($grade_credits_type = $this->Members->get_grade_credits_type(1)) {
                 if (isset($credits[$grade_credits_type['db_field']]) && $credits[$grade_credits_type['db_field']] < 0) {
                     $this->errorOutput($grade_credits_type['title'] . '不允许为负数');
                 }
             }
         }
         $register_data = array();
         if ($this->input['member_type'] == 'm2o' && $this->settings['ucenter']['open'] && !$identifier) {
             $register_data['member_name'] = $member_name;
             $register_data['password'] = $password;
             $register_data['email'] = $email;
             $register_data = $this->mMember->uc_register($register_data);
             if (!is_array($register_data) && $register_data <= 0) {
                 if ($register_data == -1) {
                     $this->errorOutput(MEMBER_NAME_ILLEGAL);
                 } elseif ($register_data == -2) {
                     $this->errorOutput(PROHIBITED_WORDS);
                 } elseif ($register_data == -3) {
                     $this->errorOutput(UC_MEMBER_NAME_REGISTER);
                 } elseif ($register_data == -4) {
                     $this->errorOutput(EMAIL_FORMAT_ERROR);
                 } elseif ($register_data == -5) {
                     $this->errorOutput(EMAIL_NO_REGISTER);
                 } elseif ($register_data == -6) {
                     $this->errorOutput(EMAIL_HAS_BINDED);
                 } else {
                     $this->errorOutput(UC_REGISTER_ERROR);
                 }
             }
         }
         //随机串
         $salt = hg_generate_salt();
         //密码md5
         $md5_password = md5(md5($password) . $salt);
         if ($type = $this->input['member_type'] ? trim($this->input['member_type']) : 'm2o') {
             $platformInfo = $this->Members->get_platform_name($type);
             if (empty($platformInfo)) {
                 $this->errorOutput(REG_MEMBER_TYPE_ERROR);
             }
             $type_name = $platformInfo['name'];
         }
         $ip = hg_getip();
         $data = array('guid' => guid(), 'member_name' => $member_name, 'password' => $md5_password, 'mobile' => $mobile, 'email' => $email, 'signature' => $signature, 'salt' => $salt, 'type' => $type, 'type_name' => $type_name, 'status' => $this->settings['member_status'], 'identifier' => $identifier, 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'ip' => $ip, 'reg_device_token' => 'admin', 'reg_udid' => 'admin');
         //会员数据入库
         $ret = $this->mMember->create($data);
         if (!$ret['member_id']) {
             $this->errorOutput(MEMBER_DATA_ADD_FAILED);
         }
         $member_id = $ret['member_id'];
         if ($credits && is_array($credits)) {
             $credit_log = array('app_uniqueid' => APP_UNIQUEID, 'mod_uniqueid' => MOD_UNIQUEID, 'action' => $this->input['a'], 'method' => 'admin_reg_members', 'relatedid' => $this->user['user_id'], 'title' => '积分变更', 'remark' => '管理员操作');
             $this->Members->credits($credits, $member_id, $coef = 1, false, false, true, null, array(), $credit_log);
         }
         //更新用户组
         $gid = intval($this->input['groupid']);
         $groupexpiry = $this->input['groupexpiry'] ? trim($this->input['groupexpiry']) : 0;
         $this->Members->updategroup($member_id, $gid, $groupexpiry);
         //更新黑名单
         $deadline = !empty($this->input['blacklist']) ? !empty($this->input['isblack']) ? $this->input['isblack'] : -1 : 0;
         $this->Members->blacklist_set($member_id, $deadline);
         //更新勋章
         $medalid = !empty($this->input['medal_id']) ? $this->input['medal_id'] : array();
         $this->member_medal->edit_member_medal($member_id, $medalid);
         $data['member_id'] = $member_id;
         $this->mMemberInfo->extension_edit($member_id, $this->input['member_info'], $_FILES);
         //扩展信息编辑
         //绑定表
         if ($type == 'm2o') {
             $platform_id = $this->settings['ucenter']['open'] && $register_data['member_id'] > 0 && !$identifier ? $register_data['member_id'] : $member_id;
         } elseif ($type == 'shouji') {
             $platform_id = $member_name;
         }
         $bind_data = array('member_id' => $member_id, 'platform_id' => $platform_id, 'nick_name' => $nick_name, 'type' => $type, 'type_name' => $type_name, 'bind_time' => TIMENOW, 'bind_ip' => $ip, 'is_primary' => 1, 'identifier' => $identifier, 'inuc' => $this->settings['ucenter']['open'] && !$identifier && $register_data['member_id'] > 0 ? $register_data['member_id'] : 0, 'reg_device_token' => 'admin', 'reg_udid' => 'admin');
         $ret_bind = $this->mMember->bind_create($bind_data);
         if (empty($ret_bind)) {
             $this->errorOutput(BIND_DATA_ADD_FAILED);
         }
         $this->registerCreditRules($member_id, $type);
         //如果注册时填写邮箱则可以同时入绑定表
         if ($data['email']) {
             $_bind_data = $bind_data;
             $_bind_data['platform_id'] = $data['email'];
             $_bind_data['is_primary'] = 0;
             $_bind_data['type'] = 'email';
             $_bind_data['type_name'] = '邮箱';
             $_ret_bind = $this->mMember->bind_create($_bind_data);
             if (empty($_ret_bind)) {
                 $this->errorOutput(BIND_DATA_ADD_FAILED);
             }
             unset($_bind_data, $_ret_bind);
         }
         if ($data['mobile']) {
             $_bind_data = $bind_data;
             $_bind_data['platform_id'] = $data['mobile'];
             $_bind_data['is_primary'] = 0;
             $_bind_data['type'] = 'shouji';
             $_bind_data['type_name'] = '手机';
             $_ret_bind = $this->mMember->bind_create($_bind_data);
             if (empty($_ret_bind)) {
                 $this->errorOutput(BIND_DATA_ADD_FAILED);
             }
             unset($_bind_data, $_ret_bind);
         }
         //头像入库
         if (!empty($avatar)) {
             $avatar = $this->mMember->add_material($avatar, $member_id);
             if (!empty($avatar)) {
                 $update_data = array('member_id' => $member_id, 'avatar' => maybe_serialize($avatar));
                 $ret_updata = $this->mMember->update($update_data);
                 if (!$ret_updata['member_id']) {
                     $this->errorOutput(AVATAR_ADD_FAILED);
                 }
             }
         }
         //会员痕迹
         $member_trace_data = array('member_id' => $this->user['user_id'], 'member_name' => $this->user['user_name'], 'content_id' => $member_id, 'title' => $member_name, 'type' => 'adminreg', 'op_type' => '管理员注册会员', 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'create_time' => TIMENOW, 'ip' => hg_getip(), 'device_token' => 'admin', 'udid' => 'admin');
         $this->mMember->member_trace_create($member_trace_data);
         $this->addItem($member_id);
         $this->output();
     } catch (Exception $e) {
         $this->errorOutput($e->getMessage(), $e->getCode());
     }
 }
コード例 #10
0
ファイル: send_mail.php プロジェクト: h3len/Project
 /**
  *
  * 获取找回密码邮箱验证码接口...
  */
 public function getResetPasswordlinkMail()
 {
     $memberId = 0;
     $link_url = $this->input['link_url'];
     $identifierUserSystem = new identifierUserSystem();
     $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
     //多用户系统
     if ($memberName = trimall($this->input['member_name'])) {
         $this->email = $memberName;
         $nick_name = '用户';
         if (hg_check_email_format($memberName)) {
             $condition = " AND platform_id='" . $memberName . "' AND mb.type='email' AND mb.identifier=" . $identifier . "";
             $leftjoin = " LEFT JOIN " . DB_PREFIX . "member_bind as mb ON m.member_id=mb.member_id ";
             $memberInfo = $this->Members->get_member_info($condition, $field = ' mb.* ', $leftjoin, '', false);
             $nick_name = $memberInfo['nick_name'];
         }
         $this->type = 'resetpassword';
         $this->appuniqueid = 'resetpassword_link';
         $this->tspace = array(hg_verify_mobile($memberName) ? hg_hide_mobile($memberName) : $memberName);
         $this->verify_email();
         $this->_expire_time = $this->settings['email_token_limit']['time_limit'] ? TIMENOW + $this->settings['email_token_limit']['time_limit'] : TIMENOW + 1000;
         $condition = " AND email='" . $memberName . "' AND status=0";
         $email_token_info = $this->email_token->show($condition, ' ORDER BY id DESC ', 'limit 1');
         if (!$email_token_info) {
             $this->token = $this->makeToken(16);
         } else {
             $this->token = $email_token_info[0]['token'];
             //如果该验证码已经过期就重新生成验证码
             if ($email_token_info[0]['expire_time'] < TIMENOW) {
                 $this->token = $this->makeToken(16);
             } else {
                 //如果没有过期,过期时间还是原来的
                 $this->_expire_time = $email_token_info[0]['expire_time'];
             }
         }
         $url = $link_url . '&email=' . $memberName . '&token=' . $this->token;
         $this->bspace = array($memberName, $nick_name, $url);
         $sendInfo = $this->generate_link_email();
         if ($sendInfo) {
             $output = array('email' => $sendInfo['email']);
             $this->addItem($output);
         }
         $this->output();
     } else {
         $this->errorOutput(NO_MEMBER_NAME);
     }
 }