8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png
分享一个商城代刷平台屏蔽地区访问的JS代码
adgjm531 2022-4-16

如果你不想某些地区访问你的沉梦/祥云/彩虹商城代刷平台,我们可以利用js代码屏蔽地区访问沉梦/祥云/彩虹商城代刷平台

只需要将这段js代码插入带index.php首行即可【这里示范屏蔽北京地区】

具体效果图如下:

7a9d1597538257_看图王.jpg

JS代码【调用网易126IP接口】

代码内容如下:

<!--IP-->    
<script src="http://ip.ws.126.net/ipquery"></script>    
<script>    
if(lc=='北京市' || lc=='东城区' || lc=='西城区' || lc=='朝阳区' || lc=='丰台区' || lc=='石景山区' || lc=='海淀区' || lc=='门头沟区' || lc=='房山区' || lc=='通州区' || lc=='顺义区' || lc=='昌平区' || lc=='大兴区' || lc=='怀柔区' || lc=='平谷区' || lc=='密云区' || lc=='延庆区')    
{    
window.location.href = "/error.html";    
}else    
{    
}    
</script>    
<!--IP-->

跳转页面代码【然后再到根目录创建一个error.html】

<!doctype html>    
<html>    
<head>    
<meta charset="utf-8">    
<title>抱歉,站点已暂停</title>    
<style>    
html,body,div,h1,*{margin:0;padding:0;}    
body{    
	background-color:#fefefe;    
	color:#333    
}    
.box{    
	width:580px;    
	margin:0 auto;    
}    
h1{    
	font-size:20px;    
	text-align:center;    
	background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAQAAABpN6lAAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAH+UlEQVR42uyde3AV1RnAfyFpTCBpFIVoaxUpSQSEAezwMDUJRK11DOTDAjJTtPRBBx1bK/VRO7T1VdFCRx6j6DgjltaamcIJWBpICRg0MFjGio6BRGKp4iOUMtBEkiBJ+ocxzQ17957de3bv3WY//mDYc75zzve73549z4+Ubga2DCIEEAIIAYQAQgAhgBBACCAEEAIIAYQAQgAhg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rzyYohMIZvqvWx19M3EFUZCYVCThD0sY8958+owBAithou0hhXpIpigyoXUxgt4/m72aiKfMNhdRURyhmhU8d33KK1RFzBZqMJXYdT3ocS6yJxaZjiRkMqqqquYKHPTtM0cFDXGHafC/iCRawjFnG4wlWcp/y5JSCNxElx/MLZhuC0M0GHgxQRMleCGO5g5vJiauQk7wYyJiivRAyERYyw1VU2RrWsTHAUWX7YDif6ZQyQ/MiSyM17GCn+rc/g4oU/2YzciFjKOiNLJ1FNpm00UIrLXxMIw00UO/mNElAACSnhNHlQwAhgBBACCAEEAIIAYQAQgAhgBDAgJT/DgDyxCJjaj0UmAAAAABJRU5ErkJggg==) no-repeat top center;    
	padding-top:160px;    
	margin-top:30%;    
	font-weight:normal;    
}    
</style>    
</head>    
<body>    
<div class="box">    
<h1>抱歉!该站点已经被管理员停止运行,请联系管理员了解详情!</h1>    
</div>    
</body>    
</html>

屏蔽效果如下图;

5b781597538595.png

这样在代码中的地区打开我们的网站就会显示这个界面,但是如果没什么特殊需求的话,我们是建议不弄的。

最新回复 (0)
返回