首先后台的全局—注册管理里面有白名单设置,指定邮箱注册就不谈了,下面说说JQuery+ng伪静态的方法
JQuery应该知道在哪个位置加载了吧,不知道的伙伴看我之前帖子。
摸索了一下注册页面输入框的ID会变化,所以用后代来判定。
找到member.php文件,
在倒数第二行插入以下代码:
echo '<script>
if (!!window.ActiveXObject || "ActiveXObject" in window){
alert("抱歉,*不支持IE浏览器,请更换浏览器内核访问。");
location.replace("//baike.baidu.com/item/%E6%B5%8F%E8%A7%88%E5%99%A8%E5%86%85%E6%A0%B8/10602413?fr=aladdin");
}
jQuery(document).ready(function($){
$("button#registerformsubmit").on("click",function(){
var email = $("div#reginfo_a").find("input").val();
var emailcheck = email.split("@");
var a = email.match(/^[\w\u4e00-\u9fa5]+@[\w-]+(\.[\w-]+)+$/g);
var shuzu = ["qq.com","vip.qq.com","foxmail.com","163.com","vip.163.com","126.com","vip.126.com","188.com","yeah.net","139.com","189.cn","21cn.com","gmail.com","sina.com","vip.sina.com","sohu.com","vip.sohu.com","hotmail.com","outlook.com","yahoo.com","tom.com","vip.tom.com","163.net","163vip.com","aliyun.com"];
var b = $.inArray(emailcheck[1],shuzu);
if(a == null){
if(emailcheck[1] == "gmail.com"){
alert("论坛不支持谷歌别名邮箱注册,请使用正常谷歌邮箱。");
}else{
alert("请确认是否输入了正确的邮箱,可以包含中文,但是不能包含特殊符号。正确格式:一二三
[email protected]");
}
}else{
if(b == -1){
alert("你输入了论坛不支持的邮箱。论坛仅支持:网易、QQ、fox、188、189、139、21cn、tom、谷歌、新浪、搜狐、微软、雅虎、阿里云邮箱。");
}
}
});
});
</script>'
更新记录:
或者在footer.htm最后
插入:
<script>
if (!!window.ActiveXObject || "ActiveXObject" in window){
alert("抱歉,*不支持IE浏览器,请更换浏览器内核访问。");
location.replace("//baike.baidu.com/item/%E6%B5%8F%E8%A7%88%E5%99%A8%E5%86%85%E6%A0%B8/10602413?fr=aladdin");
}
</script>
<script>
jQuery(document).ready(function($){
function a(){
var yqm = $("div#reginfo_a").find("label:eq(0)").text();//获取第一个输入框label标签的值
if(yqm == "Email:"){var amail = $("div#reginfo_a").find("input:eq(0)").val();}//发送邮箱页面
if(yqm == "用户名:"){var amail = $("div#reginfo_a").find("input:eq(3)").val();}//注册页面(开启普通注册)
if(yqm == "邀请码:"){var amail = $("div#reginfo_a").find("input:eq(4)").val();}//注册页面(关闭普通注册)
var bmail = $("input#email").val();
var zmail = amail + bmail;
var email = zmail.replace(/undefined/g,"");//去除jquery获取不到val值显示的undefined
var emailcheck = email.split("@");
var a = email.match(/^[\w\u4e00-\u9fa5]+@[\w-]+(\.[\w-]+)+$/g);
var shuzu = ["qq.com","vip.qq.com","foxmail.com","163.com","vip.163.com","126.com","vip.126.com","188.com","yeah.net","139.com","189.cn","21cn.com","gmail.com","sina.com","vip.sina.com","sohu.com","vip.sohu.com","hotmail.com","outlook.com","yahoo.com","tom.com","vip.tom.com","163.net","163vip.com","aliyun.com"];
var b = $.inArray(emailcheck[1],shuzu);
if(a == null){
if(emailcheck[1] == "gmail.com"){
alert("论坛不支持谷歌别名邮箱注册,请使用正常谷歌邮箱。");
location.reload(true);
}else{
if(email == ""){
alert("你还没有填写邮箱,不能提交,请先填好邮箱。");
location.reload(true);
}else{
alert("请确认是否输入了正确的邮箱,可以包含中文,但是不能包含特殊符号。正确格式:一二三
[email protected]");
location.reload(true);
}
}
}else{
if(b == -1){
alert("你输入了论坛不支持的邮箱。论坛仅支持:网易、QQ、fox、188、189、139、21cn、tom、谷歌、新浪、搜狐、微软、雅虎、阿里邮箱。");
location.reload(true);
}
}
}
$("button#registerformsubmit, input#applysubmit").mouseover(function(){a();});
});
</script>
因为谷歌没有实际限制系统邮箱发送,而是弹窗提醒,所以还要在ng伪静态上加个正则表达式筛选来拦截注册地址。
## 设置禁止谷歌别名临时邮箱注册
if ($request_uri ~* "^.*email.*?\..*@gmail\.com.*$") {
rewrite ^/(.*)$
https://pic.rmb.bdstatic.com/bjh ... 11443e7fd32393a.png redirect;
}
至此终于完成,你再也不用面对烦人的*临时邮箱。