如何禁止某IP访问页面

来源:百度知道 编辑:UC知道 时间:2024/05/10 07:08:13
某个IP专门到我留言板里发广告消息,十分讨厌,想让这个ip禁止访问某个页面,该如何设置呢?请教高手~~~~~~~

谢谢.

网上找个限制浏览的软件就可以了

试试以下代码:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
netscape = (navigator.appName.indexOf("Netscape") != -1);
version4 = (navigator.appVersion.indexOf("4.") != -1);
if (netscape && version4) {
ip = "" + java.net.InetAddress.getLocalHost().getHostAddress();
if (ip.indexOf("60.55") ==0)
// 这是想要禁止访问的IP例如: 60.55.xxx.xxx
{
alert("You are not permitted to access this site.");
history.go(-1);
}
}
// End -->
</script>