![]() |
|
|
|
|
|||||||
| Javascript / Java Applets Are you a JavaScript guy? Do you need help with JavaScript? This is the place to talk about anything related to Java. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm looking for a script to block a large group of IP addresses (half of the world). I try to use .htaccess file but it became 2 MB. Maybe using JavaScript I can also block IP addresses.
|
|
#2
|
|||
|
|||
|
I have a proposal:
Rather than block these IP addresses, better redirect them (For example to Google) HTML Code:
<script type="text/javascript"> var bannedips=["123.123.123.123, "234.234.234.234", "121.121.121.121"] var ip = '<!--#echo var="remote_addr"-->' var handleips=bannedips.join("|") handleips=new RegExp(handleips, "i") if (ip.search(handleips)!=-1){ alert("Your IP has been banned") window.location.replace("http://www.google.com") } </script> |
![]() |
| Tags |
| access, block, hosting, ips, javascript |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|