PHPCMS V9添加手机号选项,无需验证码

PHPCMS V9添加手机号选项,无需验证码:

一:修改模板文件/phpcms/templates/1gear/member/register.html, 在68验证用户名后加入如下
$(“#mobile”).formValidator({onshow:”{请输入手机号}”,onfocus:”{手机号以1开头}”}).ajaxValidator({
type : “get”,
url : “”,
data :”m=member&c=index&a=public_checkmobile_ajax”,
datatype : “html”,
async:’false’,
success : function(data){
if( data == “1” ) {
return true;
} else {
return false;
}
},
buttons: $(“#dosubmit”),
onerror : “手机号不正确”,
onwait : “{L(‘connecting_please_wait’)}”
});

在用户名输入框344行后如下:
<p style=”padding:0;margin:0;”>
<span style=”float:left;font-size:16px;height:30px;line-height:35px;”>手机号:</span>
<input type=”text” id=”mobile” name=”mobile” style=”width:148px;height:35px” class=”input-text”>
</p>

二:修改用户模块文件,在/phpcms/modules/member/index.php里加入如下函数
/**
* 检查手机号
* @param string $mobile    手机号
*/
public function public_checkmobile_ajax() {
$mobile = trim($_GET[‘mobile’]);

if(!preg_match(‘/^1([0-9]{10})$/’,$mobile)) {
exit(‘0’);
} else {
exit(‘1’);
}
}

同时在register函数里加入如下:
$userinfo[‘mobile’] = isset($_POST[‘mobile’]) ? $_POST[‘mobile’] : exit(‘0’);

郑重声明:

1 本资源来源于互联网,资源的版权归资源原作者所持有,受《中华人民共和国著作权法》等相关法律保护。

2 由于无法和原作者取得联系,所以上传的部分资源无法先通过原作者的同意就分享给大家了,如本资源侵犯了您(原作者)的权益,请联系我们(微信号 xiaohaimei1989),我们会立马删除您的资源,并向您表达诚挚的歉意!

3 本站是一个公益型网站,分享资源的目的在于传播知识,分享知识,收取一点点打赏的辛苦费是用于网站的日常运营开支,并非用于商业用途。

4 本站资源只提供学习和参考研究使用,使用过后请在第一时间内删除。本站不承担资源被单位或个人商用带来的法律责任。

发表评论