Designing and Development > Programming
Block IP Script - JavaScript
(1/1)
Tayab:
Hello folks. Since my past week I had been working on Block IP script and today I am done making and thought to share it with you guys, you can use it if you need it for sure. Although, it was a exercise question from the book I bought of JavaScript.
--- Code: ---var ip = '<!--#echo var="REMOTE_ADDR"-->'
var bannedip=["70.76.50.65", "192.168.1.2"]
var handleips=bannedip.join("|")
handleips=new RegExp(handleips, "i")
if (ip.search(handleips)!=1){
alert ("You are banned from this website. Wait...")
window.location.replace("http://ifandbut.com")
}
--- End code ---
Jaffery:
Good luck, I can see you are going right way..
So when user is from bad IP ,he is redirect to ifandbut.com :)
Tayab:
Haha, Yeah that is the basic way of popularity, most of the programmers are always curious about websites so they will surely visit it if I'll post this script somewhere else. :)
Navigation
[0] Message Index
Go to full version