您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop用户中心修改用户信息增加会员密码问题验证
沛珊2024-01-16 22:07:03ecshop商城教程已有人查阅
导读ECSHOP用户中心修改"用户信息"增加会员密码问题验证目的增加会员安全 ,修改会员密码需要,问题验证
ECSHOP用户中心修改"用户信息"增加会员密码问题验证目的增加会员安全 ,修改会员密码需要,问题验证
教程开始
1、themes\default\user_transaction.dwt 将
<select name='sel_question'> <option value='0'>{$lang.sel_question}</option> {html_options options=$passwd_questions selected=$profile.passwd_question} </select>
修改为
<select name='sel_question' onblur="checkSelQuestion(this.value);" id="sel_question"> <option value='0'>{$lang.sel_question}</option> {html_options options=$passwd_questions selected=$profile.passwd_question} </select> <span id="sel_question_notice" style="color:#FF0000"> *</span>
将
<input name="passwd_answer" type="text" size="25" class="inputBg" maxlengt='20' value="{$profile.passwd_answer}"/><!-- {if $field.is_need} --><span style="color:#FF0000"> *</span><!-- {/if} -->
修改为
<input name="passwd_answer" type="text" size="25" class="inputBg" maxlengt='20' value="" id="passwd_answer" onblur="checkSelAnswer(this.value);"/><!-- {if $field.is_need} --><span id="passwd_answer_notice" style="color:#FF0000"> *</span><!-- {/if} -->
2.js\user.js 找到function userEdit()中的
if (passwd_answer.length > 0 && sel_question == 0 || document.getElementById('passwd_quesetion') && passwd_answer.length == 0) { msg += no_select_question + '\n'; }
替换成
if(!checkAnswer(passwd_answer)){ msg += '- ' + '密码问题答案不正确' + '\n';}
在function userEdit()后添加
function checkAnswer(passwd_answer){ result = Ajax.call( 'user.php?act=check_passwd_answer', 'passwd_answer=' + passwd_answer, null , 'GET', 'TEXT', false ); result = result.replace(/^\s+|\s+$/g,""); if ( result != "ok" ){ return false; }else{ return true; }} /* ** 修改用户信息时验证密码问题*/function checkSelQuestion(sel_question){ if (sel_question == 0){ document.getElementById('sel_question_notice').innerHTML = '必须选择您的密码问题'; } else{ result = Ajax.call( 'user.php?act=check_sel_question', 'sel_question=' + sel_question, null , 'GET', 'TEXT', false ); result = result.replace(/^\s+|\s+$/g,""); if ( result == 'ok' ){ document.getElementById('sel_question_notice').innerHTML = '密码问题正确'; } else{ document.getElementById('sel_question_notice').innerHTML = '请选择正确的密码问题'; } }} /* ** 修改用户信息时验证密码问题答案*/function checkSelAnswer(passwd_answer){ if (passwd_answer == 0){ document.getElementById('passwd_answer_notice').innerHTML = '必须填写您的密码问题答案'; } else{ result = Ajax.call( 'user.php?act=check_passwd_answer', 'passwd_answer=' + passwd_answer, null , 'GET', 'TEXT', false ); result = result.replace(/^\s+|\s+$/g,""); if ( result == 'ok' ){ document.getElementById('passwd_answer_notice').innerHTML = '密码问题答案正确'; } else{ document.getElementById('passwd_answer_notice').innerHTML = '答案不正确请重新输入'; } }}
3.user.php中在
/* 用户登录界面 */elseif ($action == 'login')
/* 用户登录界面 */
elseif ($action == 'login')
/*验证密码问题是否正确*/elseif($action == 'check_sel_question'){ $sel_question = trim($_GET['sel_question']); $question = $user->check_sel_question($user_id); if (strcmp($sel_question, $question)!= 0){ echo 'false'; } else{ echo 'ok'; }}/*验证密码问题答案是否正确*/elseif($action == 'check_passwd_answer'){ $question = $user->check_sel_question($user_id); $answer = $user->check_passwd_answer($user_id,$question); $passwd_answer = trim($_GET['passwd_answer']); if (strcmp($answer, $passwd_answer)!= 0){ echo 'false'; } else{ echo 'ok'; }}
4.includes\modules\integrates\integrate.php,在
/* 会员手机的字段名 */ var $field_phone = '';
之后,添加
/* 会员问题的字段名 */ var $field_question = ''; /* 会员问题的回答字段名 */ var $field_answer = '';
在
/** * 检查cookie是正确,返回用户名 * * @access public * @param * * @return void */ function check_cookie()
之上,添加
/** * 检查指定密码问题是否为注册时设置的那个 * * @access public * @param string $user_id 用户id * * @return boolean */ function check_sel_question($user_id){ if (!empty($user_id)){ $sql = "SELECT passwd_question" . $this->field_question . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_id . "='" . $user_id . "'"; return $this->db->getOne($sql); } } /** * 检查指定密码问题答案是否正确 * * @access public * @param string $user_id 用户id * @param string $question 密码问题 * * @return boolean */ function check_passwd_answer($user_id,$question){ if (!empty($user_id)){ $sql = "SELECT passwd_answer" . $this->field_answer . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_id . "='" . $user_id . "' AND passwd_question" . " = '" .$question. "'"; return $this->db->getOne($sql); } }
完成。
教程开始
1、themes\default\user_transaction.dwt 将
<select name='sel_question'> <option value='0'>{$lang.sel_question}</option> {html_options options=$passwd_questions selected=$profile.passwd_question} </select>
修改为
<select name='sel_question' onblur="checkSelQuestion(this.value);" id="sel_question"> <option value='0'>{$lang.sel_question}</option> {html_options options=$passwd_questions selected=$profile.passwd_question} </select> <span id="sel_question_notice" style="color:#FF0000"> *</span>
将
<input name="passwd_answer" type="text" size="25" class="inputBg" maxlengt='20' value="{$profile.passwd_answer}"/><!-- {if $field.is_need} --><span style="color:#FF0000"> *</span><!-- {/if} -->
修改为
<input name="passwd_answer" type="text" size="25" class="inputBg" maxlengt='20' value="" id="passwd_answer" onblur="checkSelAnswer(this.value);"/><!-- {if $field.is_need} --><span id="passwd_answer_notice" style="color:#FF0000"> *</span><!-- {/if} -->
2.js\user.js 找到function userEdit()中的
if (passwd_answer.length > 0 && sel_question == 0 || document.getElementById('passwd_quesetion') && passwd_answer.length == 0) { msg += no_select_question + '\n'; }
替换成
if(!checkAnswer(passwd_answer)){ msg += '- ' + '密码问题答案不正确' + '\n';}
在function userEdit()后添加
function checkAnswer(passwd_answer){ result = Ajax.call( 'user.php?act=check_passwd_answer', 'passwd_answer=' + passwd_answer, null , 'GET', 'TEXT', false ); result = result.replace(/^\s+|\s+$/g,""); if ( result != "ok" ){ return false; }else{ return true; }} /* ** 修改用户信息时验证密码问题*/function checkSelQuestion(sel_question){ if (sel_question == 0){ document.getElementById('sel_question_notice').innerHTML = '必须选择您的密码问题'; } else{ result = Ajax.call( 'user.php?act=check_sel_question', 'sel_question=' + sel_question, null , 'GET', 'TEXT', false ); result = result.replace(/^\s+|\s+$/g,""); if ( result == 'ok' ){ document.getElementById('sel_question_notice').innerHTML = '密码问题正确'; } else{ document.getElementById('sel_question_notice').innerHTML = '请选择正确的密码问题'; } }} /* ** 修改用户信息时验证密码问题答案*/function checkSelAnswer(passwd_answer){ if (passwd_answer == 0){ document.getElementById('passwd_answer_notice').innerHTML = '必须填写您的密码问题答案'; } else{ result = Ajax.call( 'user.php?act=check_passwd_answer', 'passwd_answer=' + passwd_answer, null , 'GET', 'TEXT', false ); result = result.replace(/^\s+|\s+$/g,""); if ( result == 'ok' ){ document.getElementById('passwd_answer_notice').innerHTML = '密码问题答案正确'; } else{ document.getElementById('passwd_answer_notice').innerHTML = '答案不正确请重新输入'; } }}
3.user.php中在
/* 用户登录界面 */elseif ($action == 'login')
/* 用户登录界面 */
elseif ($action == 'login')
/*验证密码问题是否正确*/elseif($action == 'check_sel_question'){ $sel_question = trim($_GET['sel_question']); $question = $user->check_sel_question($user_id); if (strcmp($sel_question, $question)!= 0){ echo 'false'; } else{ echo 'ok'; }}/*验证密码问题答案是否正确*/elseif($action == 'check_passwd_answer'){ $question = $user->check_sel_question($user_id); $answer = $user->check_passwd_answer($user_id,$question); $passwd_answer = trim($_GET['passwd_answer']); if (strcmp($answer, $passwd_answer)!= 0){ echo 'false'; } else{ echo 'ok'; }}
4.includes\modules\integrates\integrate.php,在
/* 会员手机的字段名 */ var $field_phone = '';
之后,添加
/* 会员问题的字段名 */ var $field_question = ''; /* 会员问题的回答字段名 */ var $field_answer = '';
在
/** * 检查cookie是正确,返回用户名 * * @access public * @param * * @return void */ function check_cookie()
之上,添加
/** * 检查指定密码问题是否为注册时设置的那个 * * @access public * @param string $user_id 用户id * * @return boolean */ function check_sel_question($user_id){ if (!empty($user_id)){ $sql = "SELECT passwd_question" . $this->field_question . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_id . "='" . $user_id . "'"; return $this->db->getOne($sql); } } /** * 检查指定密码问题答案是否正确 * * @access public * @param string $user_id 用户id * @param string $question 密码问题 * * @return boolean */ function check_passwd_answer($user_id,$question){ if (!empty($user_id)){ $sql = "SELECT passwd_answer" . $this->field_answer . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_id . "='" . $user_id . "' AND passwd_question" . " = '" .$question. "'"; return $this->db->getOne($sql); } }
完成。
本文标签:
很赞哦! ()
相关文章
随机图文
-
ecshop商品页发表评论时怎么取消E-MAIL邮箱必填项
ECSHOP的商品详情页,在用户提交评论的时候,那个“E-MAIL”输入框默认是“必填”的。如果我想改成“E-MAIL非必填”或者干脆“删除这个E-MAIL输入框” -
ecshop商品批发批量购买插件开发步骤教程
1、打开goods.dwt加入;2、打开goods.php 加入;3、打开flow.php加入 -
ecshop购物车商品根据cookie长久保存商品插件
默认的ecshop购物车存在一个很大的弊端:1、当我们不登录将商品加入购物车后,等登录后再看,发现购买车没有了先前加入的商品。 -
ecshop首页文章搜索框功能增加方法
ecshop首页增加文章搜索框功能方法:怎么样让ECSHOP商城首页有商品搜索框,同时又可以搜索文章?
留言与评论 (共有 条评论) |