Reply
IP Ban - Use this Java script to ban any ip address form accesing ur site
Old 02-13-2008, 04:41 AM IP Ban - Use this Java script to ban any ip address form accesing ur site
Novice Talker

Posts: 11
Name: Qasim dar
The code below is used to ban an ip address from accessing your website, its easy and free, Enjoy!




<!-- Paste this code into the HEAD of HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: kdcgrohl -->
<!-- Web Site: http://www.kdcgrohl.com -->
<!-- Dist: http://www.darfuns.com -->
<!-- Begin
// This JavaScript uses server side includes ("SSI") so this document's name must end in .shtml
function ban(){
var ip = '<!--#echo var="REMOTE_ADDR"-->';
//add as many ip's below as you wish.
if (ip == "x.x.x.x" || ip == "x.x.x.x") {
//if you wish to change the alert message, do so below.
alert("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Attentio n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nYour ip address \("+ip+"\) has been banned!");
history.go(-1);
window.location.replace("http://www.yahoo.com
}
}
ban();
// End -->
</script>
darfun is offline
Reply With Quote
View Public Profile Visit darfun's homepage!
 
When You Register, These Ads Go Away!
Old 02-13-2008, 10:45 AM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
willcode4beer's Avatar
Webmaster Talker

Posts: 695
Name: Paul Davis
Location: San Francisco
I just use IP chains for my own site (we do in on the router at work)
http://www.flounder.net/ipchains/ipchains-howto.html#3
banning by executing code on your app server isn't truly banning. Those visitors are still executing code on your app server and still have the potential to DOS.

Banning at the lowest level in the protocol stack limits their effect the most.
__________________
Paul Davis
willCode4Beer.com (coding for all the right reasons)
willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 02-13-2008, 01:51 PM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
Learning Newbie's Avatar
Moderator

Posts: 5,199
Name: John Alexander
Will Code is right. You can't count on a client to carry out their own ban.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-13-2008, 02:06 PM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
chrishirst's Avatar
Super Moderator

Posts: 13,644
Location: Blackpool. UK
@darfun

I'd suggest you turn off javascript in your browser and then see how effective your "banning" method is.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-13-2008, 02:10 PM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
Average Talker

Posts: 27
I.P. banning with JavaScript is hugely flawed, and anyone thinking it's a viable method of banning users seriously needs to rethink their security.
JavaScript is a client side technology, which basically means that if it's annoying the end user, they can turn it off, thus allowing them to access the site again.

If you're going to do application based security, then it's best to use something like PHP, which doesn't give the end user the chance of disabling it.
Nuvo is offline
Reply With Quote
View Public Profile
 
Old 02-15-2008, 02:09 AM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
kids's Avatar
Ultra Talker

Posts: 271
IP Ban by javascript is not a good way to do. I like to do it with PHP or from Cpanel. As Nuvo said, JavaScript is a client side technology, ball is not in your court
kids is offline
Reply With Quote
View Public Profile Visit kids's homepage!
 
Reply     « Reply to IP Ban - Use this Java script to ban any ip address form accesing ur site
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 5.36874 seconds with 12 queries