Exemplo n.º 1
0
 function _reg_check()
 {
     $regstatus = jsg_member_register_check_status();
     if ($regstatus['error']) {
         return $regstatus['error'];
     }
     if (true !== JISHIGOU_FORCED_REGISTER && $regstatus['invite_enable']) {
         if (!$regstatus['normal_enable']) {
             return '本站目前需要有邀请链接才能注册。' . jsg_member_third_party_reg_msg();
         }
     }
     $in_ajax = get_param('in_ajax');
     if ($in_ajax) {
         $this->Post = array_iconv('utf-8', $this->Config['charset'], $this->Post, 1);
     }
     $nickname = trim($this->Post['nickname']);
     $email = trim($this->Post['email']);
     $rets = array('0' => '[未知错误] 有可能是站点关闭了注册功能', '-1' => '不合法', '-2' => '不允许注册', '-3' => '已经存在了', '-4' => '不合法', '-5' => '不允许注册', '-6' => '已经存在了');
     $ret = jsg_member_checkname($nickname, 1);
     if ($ret < 1) {
         return "帐户/昵称 " . $rets[$ret];
     }
     $ret = jsg_member_checkemail($email);
     if ($ret < 1) {
         return "Email " . $rets[$ret];
     }
     $password = trim($this->Post['password']);
     if (strlen($password) < 6) {
         return "密码至少5位以上";
     }
     return '';
 }
Exemplo n.º 2
0
 function DoModifyEmail()
 {
     $uid = MEMBER_ID;
     if (jdisallow($uid)) {
         exit('你无权验证他人的邮箱,点击进入验证自己的邮箱');
     }
     $email = jget('email', 'email');
     $checktype = $this->Post['checktype'];
     $sql = "SELECT `uid`,`ucuid`,`nickname`,`username`,`email`,`role_id`,`email_checked` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}'  LIMIT 0,1";
     $query = $this->DatabaseHandler->Query($sql);
     $members = $query->GetRow();
     if ($email) {
         if ($checktype == 'modify') {
             $jsg_result = jsg_member_checkemail($email, $members['ucuid']);
             if ($jsg_result < 1) {
                 $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。');
                 echo $rets[$jsg_result];
                 die;
             }
             if ($members['email_checked'] == 0) {
                 $sql = "update `" . TABLE_PREFIX . "members` set  `email`='{$email}' where `uid`='{$uid}'";
             } else {
                 $sql = "update `" . TABLE_PREFIX . "members` set  `email2`='{$email}' where `uid`='{$uid}'";
             }
             DB::query($sql);
         }
         jfunc('my');
         $ret = my_member_validate(MEMBER_ID, $email, $members['role_id'] != $this->Config['normal_default_role_id'] ? $members['role_id'] : (int) $this->Config['normal_default_role_id'], 1);
         if ($ret) {
             echo "邮件已重新发送成功";
         } else {
             echo "邮件发送失败,请填写有效的邮箱地址或联系管理员。";
         }
         echo "<script language='Javascript'>";
         echo "parent.document.getElementById('user_email').innerHTML='{$email}';";
         echo "</script>";
         die;
     } else {
         echo "请输入正确的邮箱";
         die;
     }
 }
Exemplo n.º 3
0
 function DoModify()
 {
     $_update = false;
     $uid = (int) $this->Post['uid'];
     if ($uid < 1) {
         $this->Messager("请指定一个正确的UID");
     }
     $this->ID = $uid;
     $member_info = jsg_member_info($uid);
     if (!$member_info) {
         $this->Messager("您要编辑的用户已经不存在了");
     }
     if (!admin_check_allow($uid)) {
         $this->Messager("为安全起见,您没有编辑 <b>{$member_info['nickname']}</b> 用户信息的权限,请使用网站创始人的身份登录后再进行编辑操作。", '', 10);
     }
     if (($this->Post['role_id'] == 4 || $this->Post['role_id'] == 118) && !trim($this->Post['cause'])) {
         $this->Messager("请输入封杀理由", -1);
     }
     $password = get_param('password');
     if ($password == '') {
         unset($this->Post['password']);
     } else {
         $this->Post['password_unhash'] = $password;
         $this->Post['password'] = jsg_member_password($password, $member_info['salt']);
         $_update = true;
     }
     $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-1' => '不合法', '-2' => '不允许注册', '-3' => '已经存在了', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。');
     $nickname = get_param('nickname');
     if ($nickname != $member_info['nickname']) {
         $ret = jsg_member_checkname($nickname, 1, 0, $uid);
         if ($ret < 1) {
             $this->Messager("帐户/昵称 " . $rets[$ret]);
         }
         unset($this->Post['nickname']);
         $_update = true;
     }
     $username = get_param('username');
     if ($username != $member_info['username']) {
         $ret = jsg_member_checkname($username, 0, 0, $uid);
         if ($ret < 1) {
             $this->Messager("个性域名/微博地址 " . $rets[$ret]);
         }
         unset($this->Post['username']);
         $_update = true;
     }
     $email_update = false;
     $email = get_param('email');
     if ($email != $member_info['email']) {
         $ret = jsg_member_checkemail($email);
         if ($ret < 1) {
             $this->Messager($rets[$ret]);
         }
         unset($this->Post['email']);
         $_update = true;
     }
     $this->Post['role_id'] = (int) $this->Post['role_id'];
     if ($this->Post['role_id'] > 0) {
         $role = DB::fetch_first("SELECT * FROM " . DB::table('role') . " WHERE `id`='{$this->Post['role_id']}'");
         if ($role) {
             if (!admin_check_allow($this->Post['role_id'], 1) || true === jsg_member_is_founder($uid) && 'admin' != $role['type']) {
                 unset($this->Post['role_id'], $this->Post['role_type']);
             } else {
                 $this->Post['role_type'] = $role['type'];
             }
             $login_enable = jconf::get('login_enable');
             if (!$role['privilege'] || $role['privilege'] == '') {
                 $login_enable[$uid] = $uid;
             } else {
                 unset($login_enable[$uid]);
             }
             jconf::set('login_enable', $login_enable);
         } else {
             $this->messager("角色已经不存在");
         }
     } else {
         unset($this->Post['role_id'], $this->Post['role_type']);
     }
     $phone = $this->Post['phone'];
     if ($phone) {
         if (!jsg_is_mobile($phone)) {
             $this->Messager("手机号 {$phone} 格式不对哦,请重新输入正确的号码。");
             $phone = '';
             unset($this->Post['phone']);
         } else {
             if (($member_phone_info = jtable('members')->info(array('phone' => $phone))) && $uid != $member_phone_info['uid']) {
                 $this->Messager("手机号 {$phone} 已经被使用在了 【{$member_phone_info['uid']}】{$member_phone_info['nickname']} 帐户上,请返回重新输入!");
             }
         }
     } else {
         $phone = '';
     }
     if (sms_init()) {
         if ($phone) {
             sms_bind($uid, $phone);
         } else {
             sms_unbind($uid);
         }
     }
     if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) {
         $this->Post['companyid'] = max(0, (int) $this->Post['companyid']);
         if ($this->Post['companyid'] == $member_info['companyid']) {
             unset($this->Post['companyid']);
         } else {
             if ($member_info['companyid'] == 0 && $this->Post['companyid'] > 0) {
                 $this->CpLogic->update('company', $this->Post['companyid'], 1, $member_info['topic_count']);
             } elseif ($member_info['companyid'] > 0 && $this->Post['companyid'] == 0) {
                 $this->CpLogic->update('company', $member_info['companyid'], -1, -$member_info['topic_count']);
             } else {
                 $this->CpLogic->update('company', $member_info['companyid'], -1, -$member_info['topic_count']);
                 $this->CpLogic->update('company', $this->Post['companyid'], 1, $member_info['topic_count']);
             }
             $this->Post['company'] = $this->CpLogic->Getone($this->Post['companyid'], 'company', 'name');
         }
         if ($this->Config['department_enable']) {
             $this->Post['departmentid'] = max(0, (int) $this->Post['departmentid']);
             if ($this->Post['departmentid'] == $member_info['departmentid']) {
                 unset($this->Post['departmentid']);
             } else {
                 if ($member_info['departmentid'] == 0 && $this->Post['departmentid'] > 0) {
                     $this->CpLogic->update('department', $this->Post['departmentid'], 1, $member_info['topic_count']);
                 } elseif ($member_info['departmentid'] > 0 && $this->Post['departmentid'] == 0) {
                     $this->CpLogic->update('department', $member_info['departmentid'], -1, -$member_info['topic_count']);
                 } else {
                     $this->CpLogic->update('department', $member_info['departmentid'], -1, -$member_info['topic_count']);
                     $this->CpLogic->update('department', $this->Post['departmentid'], 1, $member_info['topic_count']);
                 }
                 $this->Post['department'] = $this->CpLogic->Getone($this->Post['departmentid'], 'department', 'name');
             }
         }
         if ($this->Post['jobid'] == $member_info['jobid']) {
             unset($this->Post['jobid']);
         } else {
             $this->Post['job'] = jlogic('job')->id2subject($this->Post['jobid']);
         }
         if ($this->Post['companyid']) {
             $chx_cid = $this->Post['companyid'];
             $chx_uid = $member_info['uid'];
             $chx_did = $this->Post['departmentid'] ? $this->Post['departmentid'] : 0;
             $is_cp_usered = DB::fetch_first("SELECT * FROM " . DB::table('cp_user') . " WHERE uid = '{$chx_uid}' AND companyid = '{$chx_cid}' AND departmentid = '{$chx_did}'");
             if ($is_cp_usered) {
                 DB::query("DELETE FROM " . DB::table('cp_user') . " WHERE id = '" . $is_cp_usered['id'] . "'");
             }
         }
     }
     $this->Post['province'] = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['province'] . "'"));
     $this->Post['city'] = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['city'] . "'"));
     if ($this->Post['area']) {
         $this->Post['area'] = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['area'] . "'"));
     }
     if ($this->Post['street']) {
         $this->Post['street'] = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['street'] . "'"));
     }
     $table1 = jtable('members')->update($this->Post, $uid);
     $memberfields = array('site' => $this->Post['site'], 'validate_true_name' => $this->Post['validate_true_name'], 'validate_card_type' => $this->Post['validate_card_type'], 'validate_card_id' => $this->Post['validate_card_id'], 'validate_remark' => $this->Post['validate_remark']);
     $table2 = jtable('memberfields')->update($memberfields, $uid);
     #附表2信息(members_profile)
     $arr2 = array();
     $profileField = array('constellation', 'zodiac', 'telephone', 'address', 'zipcode', 'nationality', 'education', 'birthcity', 'graduateschool', 'pcompany', 'occupation', 'position', 'revenue', 'affectivestatus', 'lookingfor', 'bloodtype', 'height', 'weight', 'alipay', 'icq', 'yahoo', 'taobao', 'site', 'interest', 'linkaddress', 'field1', 'field2', 'field3', 'field4', 'field5', 'field6', 'field7', 'field8');
     foreach ($profileField as $k => $v) {
         isset($this->Post[$v]) && ($arr2[$v] = trim(strip_tags($this->Post[$v])));
     }
     if ($arr2) {
         $this->_updateMemberProfile($arr2, $uid);
     }
     $email_checked = $this->Post['email_checked'] ? $this->Post['email_checked'] : 0;
     if ($email_checked != $member_info['email_checked']) {
         $_update = true;
     }
     if ($_update) {
         $ret = jsg_member_edit($member_info['nickname'], '', $nickname, $this->Post['password_unhash'], $email, $username, 1, 1, $email_checked);
         $rets = array('0' => '没有做任何修改', '-1' => '帐户/昵称 不合法,含有不允许注册的字符,请尝试更换一个。', '-2' => '帐户/昵称 不允许注册,含有被保留的字符,请尝试更换一个。', '-3' => '帐户/昵称 已经存在了,请尝试更换一个。', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。');
         if ($ret < 1 && isset($rets[$ret])) {
             $this->Messager($rets[$ret]);
         }
     }
     load::logic('topic_manage');
     $TopicManageLogic = new TopicManageLogic();
     $role_id = get_param('role_id');
     $cause = get_param('cause');
     if ($role_id == 4 || $role_id == 118) {
         $TopicManageLogic->doForceOut((array) $nickname, $cause, $role_id);
     } elseif ($role_id != 4 && $role_id != 118 && ($member_info['role_id'] == 4 || $member_info['role_id'] == 118)) {
         $TopicManageLogic->doUserFree($uid);
     }
     if ($this->Config['extcredits_enable'] && $this->Post['validate'] && $this->Post['uid'] > 0) {
         update_credits_by_action('vip', $this->Post['uid']);
     }
     Load::logic('credits');
     $CreditsLogic = new CreditsLogic();
     $CreditsLogic->CountCredits($this->Post['uid']);
     $data = array('uid' => $uid, 'rid' => 0, 'relatedid' => MEMBER_ID, 'dateline' => time());
     foreach ($GLOBALS['_J']['config']['credits']['ext'] as $key => $value) {
         $data[$key] = $_POST[$key] - $member_info[$key];
         $remark .= $value['name'] . ' : ' . $_POST[$key . '_remark'] . ' , ';
     }
     $data['remark'] = trim($remark, ', ');
     jtable('credits_log')->insert($data);
     $this->Messager("编辑成功");
 }
Exemplo n.º 4
0
 function editAndCheckEmail()
 {
     $uid = MEMBER_ID;
     if ($uid < 1) {
         $this->Messager('请登录', 'index.php');
     }
     $email = jget('email', 'email');
     if (!$email) {
         $this->Messager('请输入邮箱的Email地址', 'index.php?mod=settings&code=sendmail');
     }
     $member = DB::fetch_first("SELECT `uid`,`ucuid`,`nickname`,`username`,`email`,`role_id`,`email_checked` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}'  LIMIT 0,1");
     if (!$member) {
         $this->Messager('请登录', 'index.php');
     }
     $jsg_result = jsg_member_checkemail($email, $members['ucuid']);
     if ($jsg_result < 1) {
         $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。');
         $this->Messager($rets[$jsg_result], 'index.php?mod=settings&code=sendmail');
     }
     jfunc('my');
     $ret = my_member_validate(MEMBER_ID, $email, $member['role_id'], 1);
     if ($ret) {
         if ($members['email_checked'] == 0) {
             $sql = "update `" . TABLE_PREFIX . "members` set  `email`='{$email}' where `uid`='{$uid}'";
         } else {
             $sql = "update `" . TABLE_PREFIX . "members` set  `email2`='{$email}' where `uid`='{$uid}'";
         }
         $this->DatabaseHandler->Query($sql);
         $this->Messager('发送成功,请到你填写的邮箱中确认。', 'index.php?mod=settings&code=sendmail');
     } else {
         $this->Messager('发送确认邮件失败,请填写有效的邮箱地址或联系管理员。', 'index.php?mod=settings&code=sendmail');
     }
 }
Exemplo n.º 5
0
 function CheckEmail()
 {
     $email = trim($this->Post['email'] ? $this->Post['email'] : $this->Post['check_value']);
     $ret = jsg_member_checkemail($email);
     if ($ret < 1) {
         $rets = array('0' => '[未知错误] 有可能是站点关闭了注册功能', '-4' => 'Email 不合法', '-5' => 'Email 不允许注册', '-6' => 'Email 已经存在了');
         if ($ret == '-6') {
             json_error('已存在');
         }
         json_error($rets[$ret]);
     }
     json_result('可注册');
 }