Forum Moderators: open
<SCRIPT LANGUAGE="JavaScript">
netscape = (navigator.appName.indexOf("Netscape") != -1);
version4 = (navigator.appVersion.indexOf("4.") != -1);
if (netscape && version4) {
ip = "" + java.net.InetAddress.getLocalHost().getHostAddress();
if (ip.indexOf("XXX.XX.XXX.XXX") >= -1)
// This would block anyone from XXX.XX.XXX.XXX
{
alert("YOU are NOT permitted to access this site.");
history.go(-1);
}
}
// End -->
</script>
That said, here are the reasons why it's pretty much useless:
-All someone that your site isn't allowing has to do is turn off javascript and try again.
-If you run a similar script using a server side script to avoid this problem then they can get around it by using any of the free anonymizers out there.
-Blocking an IP doesn't really work for dial up users because most are assigned a different IP each time they log in. This means that they're going to be able to access your site the next time they log in and somone else is going to get assigned the IP address you banned.
-You can get around this problem by blocking the IP at a higher level (i.e. xxx.xxx.xxx) but that, of course, doesn't solve the anonymizer/proxy problem. Also if your problem user is using, say, Earthlink, blocking at a higher level is going to ban a pretty large chunk of the internet.
Just so ya know. ;-)