function DoModifyEmail() { $password_old = $this->Post['password_old']; $email_new = $this->Post['email_new']; $nickname_new = $this->Post['nickname_new']; $username_new = ''; if (!$this->Member['username'] || is_numeric($this->Member['username'])) { $username_new = $this->Post['username_new']; } $ret = jsg_member_edit($this->Member['nickname'], $password_old, $nickname_new, '', $email_new, $username_new); if ($ret < 1) { $rets = array('0' => '没有做任何修改', '-1' => '帐户/昵称 不合法,含有不允许注册的字符,请尝试更换一个。', '-2' => '帐户/昵称 不允许注册,含有被保留的字符,请尝试更换一个。', '-3' => '帐户/昵称 已经存在了,请尝试更换一个。', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。', '-7' => '没有做任何修改。', '-8' => '网站后台已设置了帐户昵称不允许修改,请联系网站管理员。'); $message = $rets[$ret] ? $rets[$ret] : "密码输入错误,请重试"; $this->Messager($message); } jfunc('my'); my_member_validate(MEMBER_ID, $email_new, $this->Member['role_id'], 1); if ($this->Config['reg_email_verify'] and $email_new != $this->Member['email']) { $message = array(); $message[] = "Email 重新激活验证的方法已经发送到注册邮箱 <b>" . $email_new . "</b>,请用邮件中提供的方法进行激活。"; $message[] = "如果24小时内仍没有收到系统发送的系统邮件,请在个人设置/修改密码页面中重新提交或尝试更换成其他的email地址"; $this->Messager($message, null); } else { $this->Messager('确认 Email 已发送,请用邮件中提供的方法激活您的帐号。<br>如果您尚未收到我们发送的系统邮件,请点击个人资料中的“重新接收验证邮件”,或尝试更换另外一个地址', 'index.php?mod=settings&code=base'); } }
function SmsReset() { if (!sms_init()) { $this->Messager('还没有开启手机短信功能', null); } $sms = jpost('sms', 'txt'); $key = jpost('key', 'txt'); $rets = sms_check_verify($sms, $key); if ($rets['error']) { $this->Messager($rets['result'] . " 请返回重试,或者<a href='index.php?mod=get_password'>点此重新发起验证</a>", "index.php?mod=get_password&code=sms_send&sms={$sms}&key={$key}"); } else { if (jpost('reset_pwd_submit')) { $pwd = jpost('password'); if (empty($pwd) || $pwd != jpost('confirm') || strlen($pwd) < 6) { $this->Messager('两次输入的密码不一致!请设置5位以上的密码!', 'index.php?mod=get_password'); } $info = sms_bind_info($sms); $uid = $info['uid']; if (empty($info) || $uid < 1) { $this->Messager('此手机号未绑定任何帐号', null); } $member = jsg_member_info($uid); if (!$member) { $this->Messager("用户ID【{$uid}】已经不存在了", null); } sms_enter_verify($sms); jsg_member_edit($member['nickname'], '', '', $pwd, '', '', 1); $msg = "【{$member['uid']}】{$member['nickname']},您的新密码已重新设置为 {$pwd} ,请注意保管!"; sms_send($sms, $msg, 0); $this->Messager("新密码设置成功,现在为您转入登录界面.", $this->Config['site_url'] . "/index.php?mod=login"); } else { $act_name = '重设您的新密码'; include template('get_password_sms_reset'); } } }
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("编辑成功"); }