【紧急】手机版注册时,如果有验证手机号的,请加上验证码,已有客户被短信轰炸
【紧急】手机版注册时,如果有验证手机号的,请加上验证码,已有客户被短信轰炸
注:短信轰炸并不是针对网站来的,而是针对所用服务商的短信服务来的,所以,所有使用短信服务的都有可能中枪,和网站安全无关。且手机版实际上是有时间间隔验证的,可是昨日有一客户足足被轰炸了一天,消耗掉了近千短信。
修改:
1.找到mobile/user.php
if($_POST['type']!='nocapt' && $_POST['nocapt']!=true){
替换为:
if(true){
根目录下user.php也最好重复这一动作。
2、找到mobile/templates/library/user_regist.lbi
找到:
<li class="sendMobileMsg"> <span class="txt">手机号:</span> <input type="text" value="" name="mobile" class="text mobile-text" style="width:30%"> <a href="javascript:;" id="sendMobileCode" class="send-valicode graybtn">发送验证码</a> </li> <li for="countDown" id="countDown_label" style="display:none;"> <span id="countDown" class="msg-text" style="padding-left:72px;display:block;"> 校验码已发出,请注意查收短信。如果在 <strong class="ftx-01 red">120</strong> 秒内没有收到验证码,请重新验证 </span> </li>
修改为:
<li class="sendMobileMsg"> <span class="txt">手机号:</span> <input type="text" value="" name="mobile" class="text mobile-text" style="width:30%"> <a href="javascript:;" id="sendMobileCode" class="send-valicode graybtn">获取验证码</a> </li> <li class="MobileMsg_captcha" style="display:none;height: 80px; padding: 15px 0px;"> <input type="text" name="mobile_captcha" id="mobile_captcha" maxlength="4" size="6" style="width:100px;" class="captcha text"/> <span><img style="vertical-align:middle" src="captcha.php?{$rand_mobile}" alt="{$lang.comment_captcha}" id="mobile_captcha_img" class="captcha tip" title="{$lang.captcha_tip}" onClick="this.src='captcha.php?'+Math.random()"></span><br/> <a class="r-send-valicode btn-css3" href="javascript:;" style="padding:5px 20px;margin:10px 0 0 0;line-height:1.5">确认发送</a>  <a class="close-send-valicode graybtn" href="javascript:;" style="padding:5px 15px;margin:10px 0 0 0;line-height:1.5">取消</a> </li> <li for="countDown" id="countDown_label" style="display:none;height:auto;padding:5px 0;"> <span id="countDown" class="msg-text" style="padding-left:72px;display:block;"> 校验码已发出,请注意查收短信。如果在 <strong class="ftx-01 red">120</strong> 秒内没有收到验证码,请重新验证 </span> </li>
如果是2016年5月份前的手机版,样式稍有不同,可以使用下面的代码,而不用上面的
3、找到mobile/templates/lyecs_style/js/user.lyecs.js
lyecs.send_mobile={
send_mobile_code: function (form,type) {
var send = form.find('a.send-valicode'),
mobile = form.find('input[name=mobile]');
//r_send = form.find('a.r-send-valicode');
send.on('click', function () {
var _mobile = $.trim(mobile.val()),
callback = null;
if (lyecs.check.isMobile(_mobile)) {
send_code(_mobile,type);
} else if (_mobile == '') {
Msg.warn('请输入手机号!');
} else {
Msg.warn('手机号码格式有误,再修改一下哦!');
}
});
$('.close-send-valicode').on('click', function () {
$('#mobile_captcha').val('');
$('.MobileMsg_captcha').hide();
});
function send_code(mobile,type){
if($("#sendMobileCode").hasClass('btn-disabled'))return false;
$("#sendMobileCode").addClass("btn-disabled").html('请稍等...');
$.post(
'user.php?act=send_mobile_code',
{mobile: mobile,type:type,nocapt:true},
function(response){
var res = $.evalJSON(response);
$("#sendMobileCode").removeClass("btn-disabled").html("发送验证码");
if (!res.error) {
$(".ftx-01").text(120);
$("#countDown_label").show();
setTimeout(countDown, 1000);
$("#sendMobileCode").addClass("btn-disabled");
} else {
new Msg.warn(res.content);
}
},
'text'
);
return;
}
function countDown() {
var time = parseInt($(".ftx-01").html());
$(".ftx-01").html(time - 1);
if (time <= 1) {
$("#countDown_label").hide();
$("#mobileCode_error").hide();
$("#sendMobileCode").removeClass("btn-disabled");
} else {
setTimeout(countDown, 1000);
}
}
}
};
替换为:
lyecs.send_mobile={
send_mobile_code: function (form,type) {
var send = form.find('a.send-valicode'),
mobile = form.find('input[name=mobile]'),
r_send = form.find('a.r-send-valicode');
send.on('click', function () {
var _mobile = $.trim(mobile.val()),
callback = null;
if (lyecs.check.isMobile(_mobile)) {
$('#mobile_captcha').val('');
$('#mobile_captcha_img').click();
$('.MobileMsg_captcha').show();
} else if (_mobile == '') {
Msg.warn('请输入手机号!');
} else {
Msg.warn('手机号码格式有误,再修改一下哦!');
}
});
$('.close-send-valicode').on('click', function () {
$('#mobile_captcha').val('');
$('.MobileMsg_captcha').hide();
});
r_send.on('click', function () {
var _mobile = $.trim(mobile.val()),
mobile_captcha = form.find('input[name=mobile_captcha]'),
callback = null;
var _captcha = mobile_captcha.val();
if (r_send.hasClass('btn-disabled')) {
return false;
}
if(_captcha==''){
alert('请输入验证码!');
return false;
}
if (lyecs.check.isMobile(_mobile)) {
send_code(_mobile,_captcha);
} else if (_mobile == '') {
Msg.warn('请输入手机号!');
} else {
Msg.warn('手机号码格式有误,再修改一下哦!');
}
});
function send_code(mobile,mobile_captcha){
$("#sendMobileCode").addClass("btn-disabled");
$('.r-send-valicode').addClass("btn-disabled").html('请稍等...');
$.post(
'user.php?act=send_mobile_code',
{mobile: mobile , mobile_captcha:mobile_captcha,type:type},
function(response){
var res = $.evalJSON(response);
$("#sendMobileCode").removeClass("btn-disabled");
$('.r-send-valicode').removeClass("btn-disabled").html('确认发送');
if (!res.error) {
$('.MobileMsg_captcha').hide();
$('#mobile_captcha').val('');
$('#mobile_captcha_img').click();
$(".ftx-01").html(120);
$("#countDown_label").show();
setTimeout(countDown, 1000);
$("#sendMobileCode").addClass("btn-disabled");
} else {
if(res.error!=3){
$('.MobileMsg_captcha').hide();
}
$('#mobile_captcha').val('');
$('#mobile_captcha_img').click();
new Msg.warn(res.content);
}
},
'text'
);
return;
}
function countDown() {
var time = parseInt($(".ftx-01").html());
$(".ftx-01").html(time - 1);
if (time <= 1) {
$("#countDown_label").hide();
$("#mobileCode_error").hide();
$("#sendMobileCode").removeClass("btn-disabled");
} else {
setTimeout(countDown, 1000);
}
}
}
};