Click to See Complete Forum and Search --> : Blocking Static IP's from Website Entrance


cmoss
02-03-2004, 06:08 PM
Javascript gurus you help is needed urgently. To make a very long story short there is a web site that helps consumer victims of a major fraud.
The company that is doing the fraud is trying to attack the help site in a number of avenues.

There are over 60 static IP addresses they use. We need a script that can be added to all the HTML pages of the website that can check all IP's coming to the site and will redirect all IP addresses of these criminals to the FBI.

We found one Javascript on the web, but if it works it is only for one IP address. We need to have one that will work for 60 IP addresses and don;t know how to structure the script in that case.

Please help. The script we found on the web is pasted below.

1) Can we just paste that script in the source code of every HTML page and it will work?

2) What needs to be modified so it will check and redirect any one of the 60 IP addresses they have??

Thank you in advance.
We are not experts at all in programming beyond the basics so please keep that in mind.


<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
if (ip == '206.186.23.178') {
alert("STOP! You are viewing this page from an IP address that is not allowed!");
alert("Why can't you guys just leave me alone?");
if (confirm("Do you want to leave peacefully? Or will I have to help you?"))
{location.href="http://www.yahoo.com" } else { ("OK you choose I don't care! Bye bye! Don't come back!"); {location.href="http://www.yahoo.com" }} }
</script>

fredmv
02-03-2004, 06:11 PM
Welcome to the forums.

There is a huge problem with using SSI and then parsing the IP address using JavaScript: users can simply disable JavaScript and bypass it entirely. Moreover, some users are still using browsers in which do not suport JavaScript, rendering the script completely useless to some, and easy to bypass for others. Thus, I would recommend you do this completely server-side. For further help, I would suggest asking this question in one of the server-side sections here (e.g., PHP, Perl, etc.).

cmoss
02-03-2004, 06:22 PM
Thank you for your help on this.
Will go check with the server forums.

TheBearMay
02-04-2004, 07:18 AM
If you are using Apache you may also want to look at whether the use of an .htaccess file can help.