| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?php
- CURSCRIPT != 'wap' && exit('FORBIDDEN');
- $action = in_array($action, array('sendmail', 'sendsms', 'resetpage', 'resetpwd')) ? $action : '';
- $authcodesettings = read_static_cache('authcodesettings');
- require_once MYMPS_MEMBER . '/include/common.func.php';
- if ($action == 'sendmail') {
- $email = isset($email) ? mhtmlspecialchars($email) : '';
- if ($authcodesettings['forgetpass'] == 1 && !($randcode = mymps_chk_randcode($checkcode))) {
- redirectmsg('验证码输入错误', '?mod=forgetpass');
- exit();
- }
- empty($email) && redirectmsg('请填写电子邮箱地址', '?mod=forgetpass');
- $user_info = $db->getRow('SELECT * FROM `' . $db_mymps . 'member` WHERE email = \'' . $email . '\'');
- if ($user_info['userid']) {
- require MYMPS_INC . '/email.fun.php';
- $code = base64_encode($user_info['id'] . '.' . md5($user_info['id'] . '+' . $user_info['userpwd']) . '.' . $timestamp);
- globalassign();
- if (send_pwd_email($user_info['id'], $user_info['userid'], $email, $code, $mayimobile['mobiledomain'])) {
- include mymps_tpl('member_forgetpass_2');
- }
- else {
- $msg = '发送邮件失败,请联系客服:' . $mymps_global['SiteTel'] . '重设密码!';
- redirectmsg($msg, 'index.php?mod=forgetpass');
- exit();
- }
- }
- else {
- $msg = '该电子邮箱或用户名不存在!请联系客服';
- redirectmsg($msg, 'index.php?mod=forgetpass');
- exit();
- }
- }
- else if ($action == 'sendsms') {
- require_once MYMPS_ROOT . '/include/sms.fun.php';
- $mobile = isset($mobile) ? mhtmlspecialchars($mobile) : '';
- if ($authcodesettings['forgetpass'] == 1 && !($randcode = mymps_chk_randcode($checkcode))) {
- redirectmsg('验证码输入错误,请返回重新输入');
- }
- empty($mobile) && redirectmsg('请填写您的手机号码!');
- $user_info = $db->getRow('SELECT * FROM `' . $db_mymps . 'member` WHERE mobile = \'' . $mobile . '\'');
- if ($user_info['userid']) {
- $smsconfig = get_sms_config();
- $smsconfig['sms_service'] && include MYMPS_ROOT . '/include/' . $smsconfig['sms_service'] . '/mymps.php';
- if (!send_pwdsms($smsconfig['sms_user'], $smsconfig['sms_pwd'], $mobile, $smsconfig['sms_pwdtpl'])) {
- $msg = '验证码发送失败!请联系客服';
- redirectmsg($msg, 'index.php?mod=forgetpass');
- exit();
- }
- else {
- $uid = $user_info['id'];
- $userid = $user_info['userid'];
- $email = $user_info['email'];
- include mymps_tpl('member_forgetpass_2');
- }
- }
- else {
- $msg = '该手机号尚未注册用户!请联系客服';
- redirectmsg($msg, 'index.php?mod=forgetpass');
- exit();
- }
- }
- else if ($action == 'resetpwd') {
- $uid = $uid ? intval($uid) : '';
- $userid = $userid ? trim($userid) : '';
- $userpwd = $userpwd ? trim($userpwd) : '';
- $email = $email ? trim($email) : '';
- $mobile = $mobile ? trim($mobile) : '';
- $smscheckcode = $smscheckcode ? intval($smscheckcode) : '';
- if ($mymps_global['cfg_member_verify'] == 4) {
- if (!mymps_chk_smsrandcode($smscheckcode, $mobile)) {
- redirectmsg('密码修改失败,手机验证码输入不正确或与手机号不匹配!', '?mod=forgetpass');
- }
- }
- if (empty($userpwd)) {
- errormsg('请输入你的新密码!');
- }
- if (PASSPORT_TYPE == 'phpwind') {
- require MYMPS_ROOT . '/pw_client/uc_client.php';
- $pw_user = uc_user_get($userid);
- $result = uc_user_edit($pw_user['uid'], $pw_user['username'], '', md5($userpwd), '');
- }
- else if (PASSPORT_TYPE == 'ucenter') {
- require MYMPS_ROOT . '/uc_client/client.php';
- $result = uc_user_edit($userid, $userpwd, $userpwd, $email, 1);
- }
- if (!empty($userpwd)) {
- $db->query('UPDATE `' . $db_mymps . 'member` SET userpwd=\'' . md5($userpwd) . ('\' WHERE id = \'' . $uid . '\''));
- redirectmsg('密码修改成功!请输入账号密码重新登录', 'index.php?mod=login');
- exit();
- }
- else {
- redirectmsg('密码修改失败,请联系客服', 'index.php?mod=forgetpass');
- exit();
- }
- }
- else if (empty($action)) {
- if ($_obf_YW1wO2NvZGU_) {
- $code = $_obf_YW1wO2NvZGU_;
- }
- $uid = $uid ? intval($uid) : '';
- $code = $code ? mhtmlspecialchars($code) : '';
- if ($code) {
- $arr = explode('.', base64_decode($code));
- $uid = $arr[0];
- $user_info = $db->getRow('SELECT id,userid,userpwd,email FROM `' . $db_mymps . 'member` WHERE id = \'' . $uid . '\'');
- if ($timestamp - $arr[2] < 1800 && $arr[1] == md5($user_info['id'] . '+' . $user_info['userpwd'])) {
- $userid = $user_info['userid'];
- $uid = $user_info['id'];
- $email = $user_info['email'];
- include mymps_tpl('member_forgetpass_2');
- }
- else {
- $status = 'error';
- $msg = '该密码重设链接已失效!';
- redirectmsg($msg, 'index.php?mod=forgetpass');
- }
- }
- else {
- $mymps_imgcode = $authcodesettings['forgetpass'];
- include mymps_tpl('member_forgetpass');
- }
- }
- ?>
|