當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ncReplaceText函數代碼示例

本文整理匯總了PHP中ncReplaceText函數的典型用法代碼示例。如果您正苦於以下問題:PHP ncReplaceText函數的具體用法?PHP ncReplaceText怎麽用?PHP ncReplaceText使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ncReplaceText函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: send

 public function send($param = array())
 {
     $msg_tpl = rkcache('store_msg_tpl', true);
     if (!isset($msg_tpl[$this->code]) || $this->store_id <= 0) {
         return false;
     }
     $tpl_info = $msg_tpl[$this->code];
     $setting_info = Model('store_msg_setting')->getStoreMsgSettingInfo(array('smt_code' => $this->code, 'store_id' => $this->store_id));
     // 發送站內信
     if ($tpl_info['smt_message_switch'] && ($tpl_info['smt_message_forced'] || $setting_info['sms_message_switch'])) {
         $message = ncReplaceText($tpl_info['smt_message_content'], $param);
         $this->sendMessage($message);
     }
     // 發送短消息
     if ($tpl_info['smt_short_switch'] && $setting_info['sms_short_number'] != '' && ($tpl_info['smt_short_forced'] || $setting_info['sms_short_switch'])) {
         $param['site_name'] = C('site_name');
         $message = ncReplaceText($tpl_info['smt_short_content'], $param);
         $this->sendShort($setting_info['sms_short_number'], $message);
     }
     // 發送郵件
     if ($tpl_info['smt_mail_switch'] && $setting_info['sms_mail_number'] != '' && ($tpl_info['smt_mail_forced'] || $setting_info['sms_mail_switch'])) {
         $param['site_name'] = C('site_name');
         $param['mail_send_time'] = date('Y-m-d H:i:s');
         $subject = ncReplaceText($tpl_info['smt_mail_subject'], $param);
         $message = ncReplaceText($tpl_info['smt_mail_content'], $param);
         $this->sendMail($setting_info['sms_mail_number'], $subject, $message);
     }
 }
開發者ID:1290800466,項目名稱:mac_win,代碼行數:28,代碼來源:sendstoremsg.php

示例2: send_notice

 /**
  * 係統通知發送函數
  *
  * @param int $receiver_id 接受人編號
  * @param string $tpl_code 模板標識碼
  * @param array $param 內容數組
  * @param bool $flag 是否遵從係統設置
  * @return boolean
  */
 protected function send_notice($receiver_id, $tpl_code, $param, $flag = true)
 {
     $mail_tpl_model = Model('mail_templates');
     $mail_tpl = $mail_tpl_model->getOneTemplates($tpl_code);
     if (empty($mail_tpl) || $mail_tpl['mail_switch'] == 0) {
         return false;
     }
     $member_model = Model('member');
     $receiver = $member_model->infoMember(array('member_id' => $receiver_id));
     if (empty($receiver)) {
         return false;
     }
     $subject = ncReplaceText($mail_tpl['title'], $param);
     $message = ncReplaceText($mail_tpl['content'], $param);
     //根據模板裏麵確定的通知類型采用對應模式發送通知
     $result = false;
     switch ($mail_tpl['type']) {
         case '0':
             $email = new Email();
             $result = true;
             if ($flag and $GLOBALS['setting_config']['email_enabled'] == '1' or $flag == false) {
                 $result = $email->send_sys_email($receiver['member_email'], $subject, $message);
             }
             break;
         case '1':
             $model_message = Model('message');
             $param = array('member_id' => $receiver_id, 'to_member_name' => $receiver['member_name'], 'msg_content' => $message, 'message_type' => 1);
             $result = $model_message->saveMessage($param);
             break;
     }
     return $result;
 }
開發者ID:Maplecms,項目名稱:shopnc-yhmall,代碼行數:41,代碼來源:control.php

示例3: send

 public function send($param = array())
 {
     $msg_tpl = rkcache('member_msg_tpl', true);
     //        if (!isset($msg_tpl[$this->code]) || $this->member_id <= 0) {
     //            return false;
     //        }
     $this->pushAndroidAll($param);
     $tpl_info = $msg_tpl[$this->code];
     $setting_info = Model('member_msg_setting')->getMemberMsgSettingInfo(array('mmt_code' => $this->code, 'member_id' => $this->member_id), 'is_receive');
     if (empty($setting_info) || $setting_info['is_receive']) {
         // 發送站內信
         if ($tpl_info['mmt_message_switch']) {
             $message = ncReplaceText($tpl_info['mmt_message_content'], $param);
             $this->sendMessage($message);
         }
         // 發送短消息
         if ($tpl_info['mmt_short_switch']) {
             $this->getMemberInfo();
             if (!empty($this->mobile)) {
                 $this->member_info['member_mobile'] = $this->mobile;
             }
             if ($this->member_info['member_mobile_bind'] && !empty($this->member_info['member_mobile'])) {
                 $param['site_name'] = C('site_name');
                 $message = ncReplaceText($tpl_info['mmt_short_content'], $param);
                 $this->sendShort($this->member_info['member_mobile'], $message);
             }
         }
         // 發送郵件
         if ($tpl_info['mmt_mail_switch']) {
             $this->getMemberInfo();
             if (!empty($this->email)) {
                 $this->member_info['member_email'] = $this->email;
             }
             if ($this->member_info['member_email_bind'] && !empty($this->member_info['member_email'])) {
                 $param['site_name'] = C('site_name');
                 $param['mail_send_time'] = date('Y-m-d H:i:s');
                 $subject = ncReplaceText($tpl_info['mmt_mail_subject'], $param);
                 $message = ncReplaceText($tpl_info['mmt_mail_content'], $param);
                 $this->sendMail($this->member_info['member_email'], $subject, $message);
             }
         }
     }
 }
開發者ID:lehman3087,項目名稱:wanhaoshop,代碼行數:43,代碼來源:sendmembermsg.php

示例4: send_auth_codeOp

 /**
  * 統一發送身份驗證碼
  */
 public function send_auth_codeOp()
 {
     if (!in_array($_GET['type'], array('email', 'mobile'))) {
         exit;
     }
     $model_member = Model('member');
     $member_info = $model_member->getMemberInfoByID($_SESSION['member_id'], 'member_email,member_mobile');
     $verify_code = rand(100, 999) . rand(100, 999);
     $data = array();
     $data['auth_code'] = $verify_code;
     $data['send_acode_time'] = TIMESTAMP;
     $update = $model_member->editMemberCommon($data, array('member_id' => $_SESSION['member_id']));
     if (!$update) {
         exit(json_encode(array('state' => 'false', 'msg' => '係統發生錯誤,如有疑問請與管理員聯係')));
     }
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'authenticate'));
     $param = array();
     $param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
     $param['verify_code'] = $verify_code;
     $param['site_name'] = C('site_name');
     $subject = ncReplaceText($tpl_info['title'], $param);
     $message = ncReplaceText($tpl_info['content'], $param);
     if ($_GET['type'] == 'email') {
         $email = new Email();
         $result = $email->send_sys_email($member_info["member_email"], $subject, $message);
     } elseif ($_GET['type'] == 'mobile') {
         $sms = new Sms();
         $result = $sms->send($member_info["member_mobile"], $message);
     }
     if ($result) {
         exit(json_encode(array('state' => 'true', 'msg' => '驗證碼已發出,請注意查收')));
     } else {
         exit(json_encode(array('state' => 'false', 'msg' => '驗證碼發送失敗')));
     }
 }
開發者ID:Maplecms,項目名稱:shopnc-api,代碼行數:39,代碼來源:security.php

示例5: send_modify_mobileOp

 /**
  * 修改手機號 - 發送驗證碼
  */
 public function send_modify_mobileOp()
 {
     $obj_validate = new Validate();
     $obj_validate->validateparam = array(array("input" => $_GET["mobile"], "require" => "true", 'validator' => 'mobile', "message" => '請正確填寫手機號碼'));
     $error = $obj_validate->validate();
     if ($error != '') {
         output_error($error);
     }
     $model_member = Model('member');
     //發送頻率驗證
     $member_common_info = $model_member->getMemberCommonInfo(array('member_id' => $this->member_info['member_id']));
     if (!empty($member_common_info['send_mb_time'])) {
         if (date('Ymd', $member_common_info['send_mb_time']) != date('Ymd', TIMESTAMP)) {
             $data = array();
             $data['send_mb_times'] = 0;
             $update = $model_member->editMemberCommon($data, array('member_id' => $this->member_info['member_id']));
         } else {
             if (TIMESTAMP - $member_common_info['send_mb_time'] < 58) {
                 output_error('請60秒以後再次發送短信');
             } else {
                 if ($member_common_info['send_mb_times'] >= 15) {
                     output_error('您今天發送短信已超過15條,今天將無法再次發送');
                 }
             }
         }
     }
     $condition = array();
     $condition['member_mobile'] = $_GET['mobile'];
     $condition['member_id'] = array('neq', $this->member_info['member_id']);
     $member_info = $model_member->getMemberInfo($condition);
     if ($member_info) {
         print_r($member_info);
         output_error('該手機號已被使用,請更換其它手機號');
     }
     if ($this->member_info['member_mobile_bind'] == 1) {
         if ($this->member_info['member_mobile'] != $_GET['oldmobile']) {
             output_error("原手機號碼不正確");
         }
     }
     $data = array();
     $data['member_mobile'] = $_GET['mobile'];
     $data['member_mobile_bind'] = 0;
     $update = $model_member->editMember(array('member_id' => $this->member_info['member_id']), $data);
     if (!$update) {
         output_error('係統發生錯誤,如有疑問請與管理員聯係');
     }
     $verify_code = rand(100, 999) . rand(100, 999);
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'modify_mobile'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
     $param['verify_code'] = $verify_code;
     $message = ncReplaceText($tpl_info['content'], $param);
     $sms = new Sms();
     $result = $sms->send($_GET["mobile"], $message);
     if ($result) {
         $data = array();
         $data['auth_code'] = $verify_code;
         $data['send_acode_time'] = TIMESTAMP;
         $data['send_mb_time'] = TIMESTAMP;
         $data['send_mb_times'] = array('exp', 'send_mb_times+1');
         $update = $model_member->editMemberCommon($data, array('member_id' => $this->member_info['member_id']));
         if (!$update) {
             output_error('係統發生錯誤,如有疑問請與管理員聯係');
         }
         output_data("發送成功");
     } else {
         output_error('發送失敗');
     }
 }
開發者ID:noikiy,項目名稱:meizhan,代碼行數:74,代碼來源:mz_member_verified.php

示例6: send_modify_mobileOp

 /**
  * 修改手機號 - 發送驗證碼
  */
 public function send_modify_mobileOp()
 {
     $obj_validate = new Validate();
     $obj_validate->validateparam = array(array("input" => $_GET["mobile"], "require" => "true", 'validator' => 'mobile', "message" => '請正確填寫手機號碼'));
     $error = $obj_validate->validate();
     if ($error != '') {
         exit(json_encode(array('state' => 'false', 'msg' => $error)));
     }
     $model_member = Model('member');
     $condition = array();
     $condition['member_mobile'] = $_GET['mobile'];
     $condition['member_id'] = array('neq', $_SESSION['member_id']);
     $member_info = $model_member->getMemberInfo($condition, 'member_id');
     if ($member_info) {
         exit(json_encode(array('state' => 'false', 'msg' => '該手機號已被使用,請更換其它手機號')));
     }
     $update = $model_member->editMember(array('member_id' => $_SESSION['member_id']), array('member_mobile' => $_GET['mobile']));
     if (!$update) {
         exit(json_encode(array('state' => 'false', 'msg' => '係統發生錯誤,如有疑問請與管理員聯係')));
     }
     $verify_code = rand(100, 999) . rand(100, 999);
     $data = array();
     $data['auth_code'] = $verify_code;
     $data['send_acode_time'] = TIMESTAMP;
     $update = $model_member->editMemberCommon($data, array('member_id' => $_SESSION['member_id']));
     if (!$update) {
         exit(json_encode(array('state' => 'false', 'msg' => '係統發生錯誤,如有疑問請與管理員聯係')));
     }
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'modify_mobile'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
     $param['verify_code'] = $verify_code;
     $message = ncReplaceText($tpl_info['content'], $param);
     $sms = new Sms();
     $result = $sms->send($_GET["mobile"], $message);
     if ($result) {
         exit(json_encode(array('state' => 'true', 'msg' => '發送成功')));
     } else {
         exit(json_encode(array('state' => 'false', 'msg' => '發送失敗')));
     }
 }
開發者ID:ff00x0,項目名稱:shopnc,代碼行數:46,代碼來源:member_security.php

示例7: sendPickupcode

 /**
  * 發送提貨碼短信消息
  */
 public function sendPickupcode($param)
 {
     $dorder_info = Model('delivery_order')->getDeliveryOrderInfo(array('order_id' => $param['order_id']), 'reciver_mobphone');
     $tpl_info = Model('mail_templates')->getTplInfo(array('code' => 'send_pickup_code'));
     $data = array();
     $data['site_name'] = C('site_name');
     $data['pickup_code'] = $param['pickup_code'];
     $message = ncReplaceText($tpl_info['content'], $data);
     $sms = new Sms();
     $result = $sms->send($dorder_info['reciver_mobphone'], $message);
     if (!$result) {
         return callback(false, '發送提貨碼短信消息失敗order_id:' . $param['order_id']);
     } else {
         return callback(true);
     }
 }
開發者ID:mengtaolin,項目名稱:shopping,代碼行數:19,代碼來源:queue.logic.php

示例8: send_modify_mobileOp

 /**
  * 手機號發送驗證碼
  */
 public function send_modify_mobileOp()
 {
     if ($_POST['mobile'] == '') {
         output_data(array('state' => 'false', 'msg' => '手機號錯誤'));
     }
     $model_member = Model('member');
     $condition = array();
     $condition['member_mobile'] = $_POST['mobile'];
     $condition['member_mobile_bind'] = 1;
     $condition['member_id'] = array('neq', $this->member_info['member_id']);
     $member_info = $model_member->getMemberInfo($condition, 'member_id');
     if ($member_info) {
         output_data(array('state' => 'false', 'msg' => '該手機號已被使用,請更換其它手機號'));
     }
     $verify_code = rand(100, 999) . rand(100, 999);
     $data = array();
     $data['auth_code'] = $verify_code;
     $data['send_acode_time'] = TIMESTAMP;
     $update = $model_member->editMemberCommon($data, array('member_id' => $this->member_info['member_id']));
     if (!$update) {
         output_data(array('state' => 'false', 'msg' => '係統發生錯誤,如有疑問請與管理員聯係'));
     }
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'modify_mobile'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
     $param['verify_code'] = $verify_code;
     $message = ncReplaceText($tpl_info['content'], $param);
     $sms = new Sms();
     $result = $sms->send($_POST["mobile"], $message);
     if ($result) {
         output_data(array('state' => 'true', 'msg' => '發送成功'));
     } else {
         output_data(array('state' => 'false', 'msg' => '發送失敗'));
     }
 }
開發者ID:noikiy,項目名稱:meizhan,代碼行數:40,代碼來源:member_idstatus.php

示例9: send_notice

 /**
  * 係統通知發送函數
  *
  * @param int $receiver_id 接受人編號
  * @param string $tpl_code 模板標識碼
  * @param array $param 內容數組
  * @return bool
  */
 public function send_notice($receiver_id, $tpl_code, $param)
 {
     /**
      * 獲取通知內容模板
      */
     $mail_tpl_model = Model('mail_templates');
     $mail_tpl = $mail_tpl_model->getOneTemplates($tpl_code);
     if (empty($mail_tpl) || $mail_tpl['mail_switch'] == 0) {
         return false;
     }
     /**
      * 獲取接收人信息
      */
     $member_model = Model('member');
     $receiver = $member_model->infoMember(array('member_id' => $receiver_id));
     if (empty($receiver)) {
         return false;
     }
     /**
      * 為通知模板的主題與內容中變量賦值
      */
     $subject = ncReplaceText($mail_tpl['title'], $param);
     $message = ncReplaceText($mail_tpl['content'], $param);
     /**
      * 根據模板裏麵確定的通知類型采用對應模式發送通知
      */
     $result = false;
     switch ($mail_tpl['type']) {
         case '0':
             $email = new Email();
             $result = $email->send_sys_email($receiver['member_email'], $subject, $message);
             break;
         case '1':
             $model_message = Model('message');
             $param = array('member_id' => $receiver_id, 'to_member_name' => $receiver['member_name'], 'msg_content' => $message, 'message_type' => 1);
             $result = $model_message->saveMessage($param);
             break;
     }
     return $result;
 }
開發者ID:dw250100785,項目名稱:shopnc,代碼行數:48,代碼來源:control.php

示例10: modify_emailOp

 /**
  * 綁定郵箱
  * @return [type] [description]
  */
 public function modify_emailOp()
 {
     $model_member = Model('member');
     $obj_validate = new Validate();
     $obj_validate->validateparam = array(array("input" => $_POST["email"], "require" => "true", 'validator' => 'email', "message" => '請正確填寫郵箱地址'));
     $error = $obj_validate->validate();
     if ($error != '') {
         output_error($error);
     }
     if ($this->member_info['member_email_bind'] == 1) {
         if (empty($_POST['captcha'])) {
             output_error("請正確填寫手機驗證碼");
         }
         $result_checkcode = self::checkCode(intval($_POST['captcha']));
         if ($result_checkcode['result'] != 'succ') {
             output_error($result_checkcode['message']);
         }
     }
     //發送頻率驗證
     $member_common_info = $model_member->getMemberCommonInfo(array('member_id' => $this->member_info['member_id']));
     if (!empty($member_common_info['send_email_time']) && TIMESTAMP - $member_common_info['send_email_time'] < 58) {
         output_error('請60秒以後再次發送郵件');
     }
     $condition = array();
     $condition['member_email'] = $_POST['email'];
     $condition['member_id'] = array('neq', $this->member_info['member_id']);
     $member_info = $model_member->getMemberInfo($condition, 'member_id');
     if ($member_info) {
         output_error('該郵箱已被使用');
     }
     $data = array();
     $data['member_email'] = $_POST['email'];
     $data['member_email_bind'] = 0;
     $update = $model_member->editMember(array('member_id' => $this->member_info['member_id']), $data);
     if (!$update) {
         output_error('係統發生錯誤,如有疑問請與管理員聯係');
     }
     $seed = random(6);
     $data = array();
     $data['auth_code'] = $seed;
     $data['send_acode_time'] = TIMESTAMP;
     $data['send_email_time'] = TIMESTAMP;
     $data['send_acode_times'] = array('exp', 'send_acode_times+1');
     $update = $model_member->editMemberCommon($data, array('member_id' => $this->member_info['member_id']));
     if (!$update) {
         output_error('係統發生錯誤,如有疑問請與管理員聯係');
     }
     $uid = base64_encode(encrypt($this->member_info['member_id'] . ' ' . $_POST["email"]));
     $verify_url = SHOP_SITE_URL . '/index.php?act=login&op=bind_email&uid=' . $uid . '&hash=' . md5($seed);
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'bind_email'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['user_name'] = $this->member_info['member_name'];
     $param['verify_url'] = $verify_url;
     $subject = ncReplaceText($tpl_info['title'], $param);
     $message = ncReplaceText($tpl_info['content'], $param);
     \Shopnc\Lib::messager()->send($_POST["email"], $subject, $message);
     output_data("驗證郵件已經發送至您的郵箱,請於24小時內登錄郵箱並完成驗證!如果您始終未收到郵件,請於60秒後重新發送" . $verify_url);
 }
開發者ID:sdjncjc,項目名稱:meizhan,代碼行數:64,代碼來源:mz_auth_modify.php

示例11: find_passwordOp

 /**
  * 找回密碼的發郵件處理
  */
 public function find_passwordOp()
 {
     Language::read('home_login_register');
     $lang = Language::getLangContent();
     $result = chksubmit(true, true, 'num');
     if ($result !== false) {
         if ($result === -11) {
             showDialog('非法提交');
         } elseif ($result === -12) {
             showDialog('驗證碼錯誤');
         }
     }
     if (empty($_POST['username'])) {
         showDialog($lang['login_password_input_username']);
     }
     if (process::islock('forget')) {
         showDialog($lang['nc_common_op_repeat'], 'reload');
     }
     $member_model = Model('member');
     $member = $member_model->getMemberInfo(array('member_name' => $_POST['username']));
     if (empty($member) or !is_array($member)) {
         process::addprocess('forget');
         showDialog($lang['login_password_username_not_exists'], 'reload');
     }
     if (empty($_POST['email'])) {
         showDialog($lang['login_password_input_email'], 'reload');
     }
     if (strtoupper($_POST['email']) != strtoupper($member['member_email'])) {
         process::addprocess('forget');
         showDialog($lang['login_password_email_not_exists'], 'reload');
     }
     process::clear('forget');
     //產生密碼
     $new_password = random(15);
     if (!$member_model->editMember(array('member_id' => $member['member_id']), array('member_passwd' => md5($new_password)))) {
         showDialog($lang['login_password_email_fail'], 'reload');
     }
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'reset_pwd'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['user_name'] = $_POST['username'];
     $param['new_password'] = $new_password;
     $param['site_url'] = SHOP_SITE_URL;
     $subject = ncReplaceText($tpl_info['title'], $param);
     $message = ncReplaceText($tpl_info['content'], $param);
     $email = new Email();
     $result = $email->send_sys_email($_POST["email"], $subject, $message);
     showDialog('新密碼已經發送至您的郵箱,請盡快登錄並更改密碼!', '', 'succ', '', 5);
 }
開發者ID:lehman3087,項目名稱:wanhaoshop,代碼行數:53,代碼來源:login.php

示例12: sendmbcodeOp

 public function sendmbcodeOp()
 {
     if (empty($_GET['mobile'])) {
         exit(json_encode(array('state' => 'false', 'msg' => '請輸入手機號碼')));
     }
     $member_mobile = trim($_GET['mobile']);
     $member_model = Model('member');
     $member = $member_model->getMemberInfo(array('member_mobile' => $member_mobile));
     if (!empty($member) && $member["member_id"] > 0) {
         exit(json_encode(array('state' => 'false', 'msg' => '該手機號已被使用,請更換其它手機號')));
     }
     $verify_code = rand(1, 9) . rand(100, 999);
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'authenticate'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
     $param['verify_code'] = $verify_code;
     $message = ncReplaceText($tpl_info['content'], $param);
     $sms = new Sms();
     $result = $sms->send($_GET["mobile"], $message);
     if ($result) {
         $_SESSION['mobile_auth_code'] = $verify_code;
         $_SESSION['reg_mobile_code'] = $member_mobile;
         echo 1;
         //            exit(json_encode(array('state'=>'true','msg'=>'發送成功')));
     } else {
         $_SESSION['mobile_auth_code'] = '';
         $_SESSION['reg_mobile_code'] = '';
         echo 0;
         //            exit(json_encode(array('state'=>'false','msg'=>'發送失敗')));
     }
 }
開發者ID:Maplecms,項目名稱:shopnc-api,代碼行數:33,代碼來源:login.php

示例13: send_emailOp

 /**
  * 找回密碼的發郵件處理
  */
 public function send_emailOp()
 {
     $email = $_POST['email'];
     if (empty($email)) {
         output_error('郵箱不能為空');
     }
     $model_member = Model('member');
     $member = $model_member->getMemberInfo(array('member_email' => $email));
     if (empty($member) or !is_array($member)) {
         output_error('該郵箱未被注冊');
     }
     //發送頻率驗證
     $member_common_info = $model_member->getMemberCommonInfo(array('member_id' => $member['member_id']));
     if (!empty($member_common_info['send_email_time']) && TIMESTAMP - $member_common_info['send_email_time'] < 58) {
         output_error('請60秒以後再次發送郵件');
     }
     $seed = random(6);
     $data = array();
     $data['auth_code'] = $seed;
     $data['send_acode_time'] = TIMESTAMP;
     $data['send_email_time'] = TIMESTAMP;
     $data['send_acode_times'] = array('exp', 'send_acode_times+1');
     $update = $model_member->editMemberCommon($data, array('member_id' => $member['member_id']));
     if (!$update) {
         output_error('係統發生錯誤,如有疑問請與管理員聯係');
     }
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'reset_pwd'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['user_name'] = $member['member_name'];
     $param['site_url'] = $_POST['site_url'];
     $param['verify_url'] = $param['site_url'] . '/login/find_password_email.html?uid=' . base64_encode(encrypt($member['member_id'] . ' ' . $email)) . '&hash=' . md5($seed);
     $subject = ncReplaceText($tpl_info['title'], $param);
     $message = ncReplaceText($tpl_info['content'], $param);
     \Shopnc\Lib::messager()->send($email, $subject, $message);
     output_data('成功發送找回密碼郵件,請登錄郵箱及時查收', true);
 }
開發者ID:noikiy,項目名稱:meizhan,代碼行數:41,代碼來源:mz_login.php


注:本文中的ncReplaceText函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。