Exemplo n.º 1
0
 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');
     }
 }
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 edit($oldnickname, $oldpw = '', $nickname = '', $password = '', $email = '', $username = '', $ignoreoldpw = 0, $inadmin = 0, $email_checked = 0)
 {
     $oldmember = array();
     if (!$ignoreoldpw) {
         $rets = $this->login_check($oldnickname, $oldpw);
         if ($rets['uid'] < 1) {
             return $rets['uid'] - 10;
         } else {
             $oldmember = $rets;
         }
     } else {
         $oldmember = jsg_get_member($oldnickname, 'nickname', 0);
     }
     $uc_password = $uc_email = '';
     $newmember = array();
     if ($nickname && $nickname != $oldmember['nickname'] && (true !== UCENTER || true === UCENTER_MODIFY_NICKNAME || $ignoreoldpw)) {
         if ($oldmember['nickname'] && !$GLOBALS['_J']['config']['edit_nickname_enable'] && !$ignoreoldpw) {
             return -8;
         }
         $ret = $this->checkname($nickname, 1, 0, $oldmember['uid']);
         if ($ret < 1) {
             return $ret;
         }
         $newmember['nickname'] = $nickname;
     }
     if ($password) {
         $salt = $oldmember['salt'] ? $oldmember['salt'] : jsg_member_salt();
         $password_hash = jsg_member_password($password, $salt);
         if ($password_hash != $oldmember['password']) {
             $newmember['password'] = $password_hash;
             $newmember['salt'] = $salt;
         }
         $uc_password = $password;
     }
     if ($username && $username != $oldmember['username'] && (!$oldmember['username'] || is_numeric($oldmember['username']) || $ignoreoldpw)) {
         $ret = $this->checkname($username, 0, 0, $oldmember['uid']);
         if ($ret < 1) {
             return $ret;
         }
         $newmember['username'] = $username;
     }
     if ($email && $email != $oldmember['email']) {
         $ret = $this->checkemail($email);
         if ($ret < 1) {
             return $ret;
         }
         if ($GLOBALS['_J']['config']['reg_email_verify'] && !$inadmin) {
             $newmember['role_id'] = $oldmember['role_id'] && $oldmember['role_id'] != $GLOBALS['_J']['config']['no_verify_email_role_id'] ? $oldmember['role_id'] : $GLOBALS['_J']['config']['no_verify_email_role_id'];
             jfunc('my');
             my_member_validate($oldmember['uid'], $email, (int) ($oldmember['role_id'] != $GLOBALS['_J']['config']['no_verify_email_role_id'] ? $oldmember['role_id'] : $GLOBALS['_J']['config']['normal_default_role_id']));
         }
         if (!$inadmin && $oldmember['email_checked'] > 0) {
             $newmember['email2'] = $email;
         } else {
             $newmember['email'] = $email;
         }
         $uc_email = $email;
     }
     if ($email && $inadmin) {
         $newmember['email_checked'] = $email_checked;
         if ($oldmember['role_id'] == '5' && $email_checked > 0) {
             $newmember['role_id'] = '3';
         }
     }
     if ($inadmin && $oldmember['email_checked'] > 0 && $email_checked == 0) {
         $newmember['email2'] = '';
     }
     if (true === UCENTER && $oldmember['ucuid'] > 0 && ($uc_password || $uc_email)) {
         $ret = uc_user_edit($oldnickname, $oldpw, $uc_password, $uc_email, $ignoreoldpw);
         if ($ret < 0 && -7 != $ret && -8 != $ret) {
             return $ret;
         }
     }
     if ($newmember) {
         $ret = jtable('members')->update($newmember, $oldmember['uid']);
     } else {
         return -7;
     }
     #if NEDU
     if (defined('NEDU_MOYO')) {
         ndata('sync')->member()->modify($oldmember['uid']);
     }
     #endif
     return 1;
 }