Your HostICan Community  


Go Back   Your HostICan Community > Programming & Design > Javascript / Java Applets

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-02-2009, 01:07 PM
ILikeT ILikeT is offline
Junior Member
 
Join Date: Jul 2009
Posts: 3
Default block IPs access to hosting with JavaScript

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.
Reply With Quote
  #2  
Old 07-02-2009, 01:25 PM
OuTpOsT OuTpOsT is offline
Junior Member
 
Join Date: Jan 2009
Location: Neverland
Posts: 7
Default Re: block IPs access to hosting with JavaScript

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>
To operate this script, hosting server must have SSI (HostICan support SSI)
Reply With Quote
Reply

Tags
access, block, hosting, ips, javascript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 06:18 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Copyright © 2003 - 2008 HostICan. All Rights Reserved.