<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ~~~ <?php /** * 找回密碼_步驟 ** 判斷帳號類型 ** 手機發送驗證碼||郵箱發送驗證碼 ** 修改密碼 **/ public function findpass() { $step = I('get.step'); if($step == 1 || $step == null || !$step){ //step1 if(IS_POST){ $account = I('post.account') ? trim(I('post.account')) : ''; if(!$account) $this->error('帳號不能為空!'); $M = M('member'); //驗證帳號是否存在 $Account = $M->field('mtel,email')->where(" mtel = '$account' or email = '$account' ")->select(); if(!$Account) $this->error('賬戶未注冊'); $this->assign('account',$account); $type = 0; //賬號類型:0空,1手機,-1郵箱 //分辨帳號類型 if(preg_match('/^1[3456789]\d{9}$/',$account)) $type = 1; if(preg_match('/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/',$account)) $type = -1; //跳轉步驟二 $this->assign('type',$type); $this->step = 2; $this->display(); }else{ //!IS_POST $this->step = 1; $this->display(); } }elseif($step == 2 ){ //step2 if(IS_POST){ $account = I('post.account') ? trim(I('post.account')) : ''; $code = I('post.code') ? trim(I('post.code')) : ''; if(!$code) $this->error('驗證碼不能為空!'); if(!$account) $this->error('帳號不能為空!'); if($scode = authcode(cookie('code'),'DECODE')){ $scode = explode('#',$scode); if($scode[2] != $account) $this->error('驗證碼無效!'); if(time() - $scode[1] > 5*60) $this->error('驗證碼已過期!'); if($scode[0] != $code) $this->error('驗證碼錯誤!'); //跳轉步驟三 $this->assign('account',$account); $this->step = 3; $this->display(); }else $this->error('驗證碼無效!'); }else{ //!IS_POST $this->error('非法操作!'); } }elseif($step == 3 ){ //step3 if(IS_POST){ $account = I('post.account') ? trim(I('post.account')) : ''; $orgpass = I('post.orgpass') ? trim(I('post.orgpass')) : ''; $compass = I('post.compass') ? trim(I('post.compass')) : ''; if(!$account) $this->error('帳號不能為空!'); if(!$orgpass) $this->error('不能設置空密碼!'); if(!$compass) $this->error('確認密碼不能為空!'); if($compass != $orgpass) $this->error('密碼不一致!'); $M = M('member'); $oldpass = $M->field('password,mid')->where(" mtel = '$account' or email = '$account' ")->find(); $data['password'] = md5($compass); $data['mid'] = $oldpass['mid']; if($data['password'] == $oldpass['password']) $this->error('舊密碼與新密碼一致'); if($M->save($data) !== false){ $this->success('修改密碼成功','Index/index'); }else $this->error('修改密碼失敗'); }else{ //!IS_POST $this->error('非法操作!'); } }else $this->error('非法操作!'); } public function sendVeifyCode() { $account = I('post.account') ? trim(I('post.account')) : ''; if(!$account) $this->error('帳號不能為空!'); $yzm = I('post.yzm') ? trim(I('post.yzm')) : ''; $captcha = cookie('captcha'); //驗證碼檢測 if(!$yzm || !$captcha) $this->error('驗證碼不能為空!'); $captcha = authcode(cookie('captcha'),'DECODE'); $captchaArr = explode('#',$captcha); if(count($captchaArr) != 2 || $captchaArr[0] != $yzm) $this->error('驗證碼錯誤!'); if($captchaArr[1] < time() - 60*5) $this->error('驗證碼超時!'); //分辨帳號類型 $type = 0; //賬號類型:0空,1手機,-1郵箱 if(preg_match('/^1[3456789]\d{9}$/',$account)) $type = 1; if(preg_match('/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/',$account)) $type = -1; //賬號是否存在 $M = M('member'); if($type > 0){ //手機 //發送短信驗證 (sendCode($account,$yzm))?$this->success('手機驗證碼發送成功!'):$this->error('手機驗證碼發送失敗!'); }elseif($type < 0){ //郵箱 //發送郵箱驗證 $title = "找回密碼(系統郵件,請勿回復)"; $code = rand(100000,999999); $content = "<div id='qm_con_body'><div id='mailContentContainer' class='qmbox qm_con_body_content qqmail_webmail_only' style=''><table style='font-size:14px; font-family:Arial, Helvetica, sans-serif; line-height:170%;' width='100%' cellspacing='0' cellpadding='0' border='0'><tbody><tr><td><p align='left'>親愛的用戶<strong>".$this->userinfo[mname]."</strong>,您好: </p><p align='left'>&nbsp;&nbsp;&nbsp; 驗證碼</p><p align='left'>&nbsp;&nbsp;&nbsp; <u>".$code."</u></p><p align='left'>有效期為5分鐘。如非本人操作,請忽略本郵件。</p></td></tr></tbody></table><br><hr><br>這只是一封系統自動發出的郵件,請不要直接回復。<style type='text/css'>.qmbox style, .qmbox script, .qmbox head, .qmbox link, .qmbox meta {display: none !important;}</style></div></div>"; if(sendMail($account,$title,$content)){ $code = authcode($code.'#'.time().'#'.$account, 'ENCODE'); cookie('captcha',null); cookie('code',$code); $this->success('郵箱驗證碼發送成功!'); }else $this->error('郵箱驗證碼發送失敗!'); } } function sendCode($phone,$yzm){ $captcha = cookie('captcha'); if(!$phone) return '手機號碼不能為空'; if(!preg_match('/^1[3456789]\d{9}$/',$phone)) return '手機號碼格式不正確'; if(!$yzm) return '驗證碼不能為空'; $captcha = authcode(cookie('captcha'),'DECODE'); $captchaArr = explode('#',$captcha); if(count($captchaArr) != 2 || $captchaArr[0] != $yzm) return '驗證碼錯誤'; if($captchaArr[1] < time() - 60*5) return '驗證碼超時'; $code = rand(100000,999999); $con = file_get_contents('http://domain.com/api/GetCode.php?tel='.$phone.'&code='.$code); if($con == '100'){ $code = authcode($code.'#'.time().'#'.$phone, 'ENCODE'); cookie('captcha',null); cookie('code',$code); return true; }else return '發送失敗'; } function sendMail($to, $title, $content) { Vendor('PHPMailer.PHPMailerAutoload'); $mail = new PHPMailer(); //實例化 $mail->IsSMTP(); // 啟用SMTP $mail->Host=C('MAIL_HOST'); //smtp服務器的名稱 $mail->Port = C('SMTP_PORT'); //郵件發送端口 $mail->SMTPSecure = 'ssl'; $mail->SMTPAuth = C('MAIL_SMTPAUTH'); //啟用smtp認證 $mail->Username = C('MAIL_USERNAME'); //發件人郵箱名 $mail->Password = C('MAIL_PASSWORD') ; //郵箱密碼 $mail->From = C('MAIL_FROM'); //發件人地址 $mail->FromName = C('MAIL_FROMNAME'); //發件人姓名 $mail->AddAddress($to,"尊敬的客戶"); $mail->WordWrap = 50; //設置每行字符長度 $mail->IsHTML(C('MAIL_ISHTML')); // 是否HTML格式郵件 $mail->CharSet=C('MAIL_CHARSET'); //設置郵件編碼 $mail->Subject =$title; //郵件主題 $mail->Body = $content; //郵件內容 $mail->AltBody = "這是一個純文本的身體在非營利的HTML電子郵件客戶端"; //郵件正文不支持HTML的備用顯示 $mail->SMTPDebug = 0; // 關閉SMTP調試功能 // 1 = errors and messages // $mail->ErrorInfo; // 2 = messages only if ($mail->send()) { return true; } else { // return $mail->ErrorInfo; return false; } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看