Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 20
Name: Qasim dar
Trades: 0
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!
 
 
Register now for full access!
Old 02-13-2008, 11:45 AM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
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.
__________________

Please login or register to view this content. Registration is FREE

willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 02-13-2008, 02:51 PM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Will Code is right. You can't count on a client to carry out their own ban.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-13-2008, 03:06 PM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
@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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-13-2008, 03:10 PM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
Average Talker

Posts: 27
Trades: 0
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, 03:09 AM Re: IP Ban - Use this Java script to ban any ip address form accesing ur site
kids's Avatar
Ultra Talker

Posts: 301
Trades: 0
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
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
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 Search this Thread
Search this Thread:

Advanced Search

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 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 0.27666 seconds with 12 queries