Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
Share
LinkBack Thread Tools
Old 09-26-2013, 09:24 AM   #1
Warrior Member
 
Join Date: Sep 2013
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Lightbulb How to block someones IP address?

HI,

I have been getting junk emails from automated bots on my website's form. I have installed a captcha and that worked for a while but a few days ago I started getting those annoying emails again.

I have the senders IP address. Is there a way to block the spammers IP address? My host is Yahoo and Yahoo does not support .htaccess.
(Trying to change hosting soon)

Is there a way to block the IP without using .htaccess?
Ani86 is offline   Reply With Quote
Old 09-26-2013, 10:31 AM   #2
Web Designer
 
Join Date: Sep 2013
Posts: 42
Thanks: 0
Thanked 9 Times in 9 Posts
Default Re: How to block someones IP address?

Add this line on top of your header file, and enter the ipaddress.

<?php
$deny = array("000.000.000","000.000.001");
if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
header("location: http://www.google.com/");
exit();
}
?>
Nathan K is offline   Reply With Quote
Old 09-26-2013, 10:51 AM   #3
VeeroTech | Web Hosting
War Room Member
 
Join Date: Dec 2011
Location: Raleigh, NC
Posts: 2,565
Thanks: 406
Thanked 445 Times in 383 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Default Re: How to block someones IP address?

Quote:
Originally Posted by Ani86 View Post
HI,

I have been getting junk emails from automated bots on my website's form. I have installed a captcha and that worked for a while but a few days ago I started getting those annoying emails again.

I have the senders IP address. Is there a way to block the spammers IP address? My host is Yahoo and Yahoo does not support .htaccess.
(Trying to change hosting soon)

Is there a way to block the IP without using .htaccess?
1. The IP's will most likely always be different.

2. Yahoo doesn't support htaccess......yea, it's time to find a "real" web host.
Kingfish85 is offline   Reply With Quote
Old 09-26-2013, 11:09 AM   #4
Warrior Member
 
Join Date: Sep 2013
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: How to block someones IP address?

They say that they support htaccess.txt not .htaccess

you think this will work if i use htaccess.txt ?
Ani86 is offline   Reply With Quote
Old 09-27-2013, 12:27 AM   #5
Adroit SEO
 
Join Date: Oct 2012
Location: India
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Default Re: How to block someones IP address?

if your host is not supporting .htaccess then use Nathan K PHP script otherwise changing the host will be always an advantage ....

Sanjay
The Adroit SEO
http://www.openplus.in/seo/
sonzoy is offline   Reply With Quote
Old 09-27-2013, 01:52 AM   #6
Active Warrior
 
Join Date: Jul 2012
Posts: 67
Thanks: 0
Thanked 4 Times in 4 Posts
Default Re: How to block someones IP address?

Personally, I'm not recommend the blocking at page level. Therefore, if possible change the hosting will be an option to consider, for long term solution.

chrislim2888 is offline   Reply With Quote
Old 09-27-2013, 08:19 AM   #7
Warrior Member
 
Join Date: Sep 2013
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: How to block someones IP address?

I called yahoo again they said .htaccess is same as their htacess.txt they dont put the (.) in the beginning but instead they use .txt the tech guy said its the same thing.

Now how can I block the IP address in the htaccess file. does anyone know how to write the code for that?

and I'd like to learn more about Nathan K's code. anyone got a link that explains the code?

I wrote this code but not sure if its correct or not

<Limit GET>
order allow,deny
deny from 10.20.30
deny from 192.168.207.154
allow from all
</Limit>
Ani86 is offline   Reply With Quote
Old 09-27-2013, 08:33 AM   #8
Active Warrior
War Room Member
 
Join Date: Sep 2013
Posts: 32
Thanks: 12
Thanked 5 Times in 5 Posts
Default Re: How to block someones IP address?

Quote:
Originally Posted by Ani86 View Post
and I'd like to learn more about Nathan K's code. anyone got a link that explains the code?
Nathan's Code will only work on a PHP page, not a static HTML page.

It Basically runs through a list of ip addresses (In the $deny variable) and if the browsing IP matches one of them, it redirects them somewhere else by writing a location header.

Your apache code should work, but I always place the deny after the allows, because I'm not sure if it gets applied in order.

<Limit GET>
order allow,deny
allow from all
deny from 10.20.30
deny from 192.168.207.154
</Limit>

[/QUOTE]
kyoo is offline   Reply With Quote
Old 09-27-2013, 08:55 AM   #9
Warrior Member
 
Join Date: Sep 2013
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: How to block someones IP address?

So if I use this code

<?php
$deny = array("000.000.000","000.000.001");
if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
header("location: http://www.google.com/");
exit();
}
?>

All I have to do is put the IP address in place of 000.000.000s and put the code in the beginning of the contact.php file? Is that all?
Ani86 is offline   Reply With Quote
Old 09-27-2013, 09:01 AM   #10
Active Warrior
War Room Member
 
Join Date: Sep 2013
Posts: 32
Thanks: 12
Thanked 5 Times in 5 Posts
Default Re: How to block someones IP address?

That should do it, although I haven't tested this snippet of code, there may be typos etc. Nathan K probably pulled it from someplace where it was working.
kyoo is offline   Reply With Quote
Old 09-30-2013, 10:51 PM   #11
Active Warrior
 
Join Date: Jul 2013
Posts: 55
Thanks: 0
Thanked 6 Times in 6 Posts
Default Re: How to block someones IP address?

Blocking him from your website would be hard, because all he needs to do is use a proxy to disguise his IP.. But you can block it from control panel of your hosting
webzie is offline   Reply With Quote
Old 10-01-2013, 03:49 PM   #12
Warrior Member
 
Join Date: Jul 2013
Posts: 13
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: How to block someones IP address?

Code:
<?php
if($_SERVER['REMOTE_ADDR'] == 'xx.xx.xx.xxx'){
        die("Go to hell.");
}
?>

Last edited by CrazyStyle; 10-01-2013 at 03:50 PM. Reason: I don't have a reason.
CrazyStyle is offline   Reply With Quote
Old 10-01-2013, 09:14 PM   #13
Warrior Member
 
Join Date: Oct 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: How to block someones IP address?

You can write rewrite rules or you can write php or any serverside script to block ip address or country
webisland is offline   Reply With Quote
Old 10-25-2013, 12:24 PM   #14
Warrior Member
 
Join Date: Sep 2013
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: How to block someones IP address?

Quote:
Originally Posted by webzie View Post
Blocking him from your website would be hard, because all he needs to do is use a proxy to disguise his IP.. But you can block it from control panel of your hosting
How do i block from hosting? my hosting is 1and1
Ani86 is offline   Reply With Quote
Old 11-02-2013, 09:05 AM   #15
WriteArm
War Room Member
 
Join Date: Mar 2011
Location: Omaha
Posts: 2
Blog Entries: 1
Thanks: 0
Thanked 1 Time in 1 Post
Social Networking View Member's Myspace Profile  View Member's FaceBook Profile  View Member's Twitter Profile 
Default Re: How to block someones IP address?

Ani 86 : Have you tried just using IP deny in the cpanel?
WriteArm is offline   Reply With Quote
Old 11-03-2013, 01:25 AM   #16
Warrior Member
 
Join Date: Nov 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: How to block someones IP address?

Here you can find all information about your IP
DAVE49 is offline   Reply With Quote
Old 11-03-2013, 12:07 PM   #17
Web Developer
 
project1010's Avatar
 
Join Date: Mar 2012
Posts: 111
Thanks: 1
Thanked 15 Times in 14 Posts
Default Re: How to block someones IP address?

If you have programmatic control over your website, then you can block an IP address. For example, in VBScript for ASP,
<%
if ( request.servervariables ("remote_host") = "XXX.XXX.XXX.XXX") then response.redirect "http://www.google.com"
%>

where XXX.XXX.XXX.XXX is his IP address.
project1010 is offline   Reply With Quote
Old 11-03-2013, 12:16 PM   #18
VeeroTech | Web Hosting
War Room Member
 
Join Date: Dec 2011
Location: Raleigh, NC
Posts: 2,565
Thanks: 406
Thanked 445 Times in 383 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Default Re: How to block someones IP address?

junk emails from automated bots

This means the IP addressed CHANGE....they CHANGE = not the same.

Adding code to the htaccess is NOT going to do anything here....do you people even read the thread before commenting with useless rpelies?!

You need to use something like CloudFlare or a host that has a better firewall or WAF.

Kingfish85 is offline   Reply With Quote
Old 11-16-2013, 03:55 AM   #19
Active Warrior
 
buysellbrowse's Avatar
 
Join Date: Oct 2013
Posts: 64
Thanks: 0
Thanked 4 Times in 4 Posts
Default Re: How to block someones IP address?

Since you have a website form visible from anywhere in the world, blocking a few IPs will not help much. You need a better captcha system that hasn't been broken yet, preferably something that requires the user to understand instructions, then move an object with the mouse to complete a task. Eye-hand coordination is something a computer cannot do (yet).

buysell-browse.com * Free Classifieds Advertising & Promotion *
buysellbrowse is offline   Reply With Quote
Old 12-13-2013, 11:12 PM   #20
Active Warrior
 
Join Date: Dec 2013
Location: Toronto, Canada
Posts: 64
Thanks: 0
Thanked 2 Times in 2 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile  View Member's YouTube Profile
Default Re: How to block someones IP address?

You can block an IP Address using IPSec

STEP 1:
Click on Start menu, then click on Run

STEP 2:
Type " secpol.msc" and Click OK

STEP 3:
When the Local Security Settings console opens, Click on "IP security policies on Local computer"
Roy Jones is online now   Reply With Quote
Old 12-14-2013, 06:22 AM   #21
IM Rocks!
War Room Member
 
shahriyar's Avatar
 
Join Date: Oct 2010
Posts: 482
Thanks: 50
Thanked 65 Times in 60 Posts
Social Networking View Member's FaceBook Profile  View Member's YouTube Profile
Contact Info
Send a message via Yahoo to shahriyar
Arrow Re: How to block someones IP address?

I receive a lot of spam every day on my sites, blocking IPs is a solution but not a good one. Because spam will come all kinds of different IPs, they never stay the same.

You should focus on improving security on your forms. Have you tried using reCaptcha? http://www.google.com/recaptcha

shahriyar is online now   Reply With Quote
Old 12-14-2013, 11:36 AM   #22
Senior Warrior Member
War Room Member
 
Join Date: Jul 2008
Posts: 1,597
Thanks: 2,888
Thanked 838 Times in 575 Posts
Default Re: How to block someones IP address?

rather than blocking ip address for bots it is far more efficient to block the user-agent or referer in your .htaccess file or in the OP's case httaccess.txt -
here is a pretty good one :

Code:
RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Bot mailto:craftbot@yahoo.com [OR] 
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR] 
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Download Demon [OR] 
RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR] 
RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR] 
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR] 
RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Express WebPictures [OR] 
RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] 
RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR] 
RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR] 
RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR] 
RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR] 
RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR] 
RewriteCond %{HTTP_USER_AGENT} ^HMView [OR] 
RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR] 
RewriteCond %{HTTP_USER_AGENT} ^Image Stripper [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Image Sucker [OR] 
RewriteCond %{HTTP_USER_AGENT} Indy Library [NC,OR] 
RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Internet Ninja [OR] 
RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR] 
RewriteCond %{HTTP_USER_AGENT} ^JOC Web Spider [OR] 
RewriteCond %{HTTP_USER_AGENT} ^larbin [OR] 
RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Mass Downloader [OR] 
RewriteCond %{HTTP_USER_AGENT} ^MIDown tool [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Mister PiX [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR] 
RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR] 
RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR] 
RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Net Vampire [OR] 
RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Offline Explorer [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Offline Navigator [OR] 
RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Papa Foto [OR] 
RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR] 
RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR] 
RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR] 
RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR] 
RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR] 
RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR] 
RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR] 
RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR] 
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Teleport Pro [OR] 
RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Web Image Collector [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Web Sucker [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebGo IS [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Website eXtractor [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Website Quester [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Wget [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Widow [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Xaldon WebSpider [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Zeus [OR]
RewriteCond %{HTTP_USER_AGENT} ^Java [OR]
RewriteCond %{HTTP_USER_AGENT} ^Sogou web spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Sosospider+ 
RewriteRule ^.* - [F,L]
You can find the referrers hitting your site by downloading your visitor logs and you can also look at your "latest visitors" in the cPanel -

This is what you looking for - this is a good referer:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:26.0) Gecko/20100101 Firefox/26.0

This is one of the bad ones because they ignore your robots .txt
Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)

Good referers obey your robots.txt file
Bad ones don't

I love life!
Karen Blundell is offline   Reply With Quote
Old 12-14-2013, 05:48 PM   #23
Advanced Warrior
War Room Member
 
kpmedia's Avatar
 
Join Date: Apr 2010
Location: USA, Europe
Posts: 870
Thanks: 54
Thanked 195 Times in 157 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Default Re: How to block someones IP address?

Quote:
Originally Posted by Karen Blundell View Post
This is one of the bad ones because they ignore your robots .txt
Mozilla/5.0 (compatible; Baiduspider/2.0; +百度搜索帮助*心—关于Baiduspider)
Baidu sucks. It's an aggressive Chinese search engine, and I long ago banned it.
I have 0.001% legit users/traffic from China (i.e., maybe 1 per 1,000).

FAQ: Need a HostGator alternative? And who is EIG?
--------------------------------------------------------------------------------
Need a good VPS, dedicated server, or non-unlimited host?
Note: This list of high-quality hosts is community maintained, and NOT a fake "top 10" list.
kpmedia is offline   Reply With Quote
Old 12-14-2013, 10:56 PM   #24
Monkey
War Room Member
 
Join Date: Dec 2013
Location: Vantaa, Finland
Posts: 927
Thanks: 106
Thanked 129 Times in 124 Posts
Social Networking View Member's Twitter Profile 
Default Re: How to block someones IP address?

As others have suggested, blocking IPs to combat spam is futile. If someone is in that kind of business, they wont hesitate to proxy around your blocks.

The IP addresses in the htaccess code weren't the ones you're trying to block, right? They're not public IP addresses.
nettiapina is online now   Reply With Quote
Old 12-15-2013, 07:42 AM   #25
ɹoıɹɹɐʍ ǝʌıʇɔɐɹǝdʎɥ
War Room Member
 
RobinInTexas's Avatar
 
Join Date: Dec 2008
Location: Texas
Posts: 1,758
Blog Entries: 3
Thanks: 164
Thanked 346 Times in 305 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Contact Info
Default Re: How to block someones IP address?

It's going to take a while, but I am using Wordfence plugin on WordPress sites and blocking any and all bots I see with the exception of Google, Bing and Yahoo.
Also blocking ip ranges for any web hosts I find.

Starting to look into using CloudFlare to fence them out far away from my hosting accounts.

Robin


...Even if you're on the right track, you'll get run over if you just set there.
RobinInTexas is offline   Reply With Quote
Old 12-15-2013, 07:50 AM   #26
VeeroTech | Web Hosting
War Room Member
 
Join Date: Dec 2011
Location: Raleigh, NC
Posts: 2,565
Thanks: 406
Thanked 445 Times in 383 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Default Re: How to block someones IP address?

Quote:
Originally Posted by Karen Blundell View Post
rather than blocking ip address for bots it is far more efficient to block the user-agent or referer in your .htaccess file or in the OP's case httaccess.txt -
here is a pretty good one :

Code:
RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Bot mailto:craftbot@yahoo.com [OR] 
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR] 
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Download Demon [OR] 
RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR] 
RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR] 
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR] 
RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Express WebPictures [OR] 
RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] 
RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR] 
RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR] 
RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR] 
RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR] 
RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR] 
RewriteCond %{HTTP_USER_AGENT} ^HMView [OR] 
RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR] 
RewriteCond %{HTTP_USER_AGENT} ^Image Stripper [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Image Sucker [OR] 
RewriteCond %{HTTP_USER_AGENT} Indy Library [NC,OR] 
RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Internet Ninja [OR] 
RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR] 
RewriteCond %{HTTP_USER_AGENT} ^JOC Web Spider [OR] 
RewriteCond %{HTTP_USER_AGENT} ^larbin [OR] 
RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Mass Downloader [OR] 
RewriteCond %{HTTP_USER_AGENT} ^MIDown tool [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Mister PiX [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR] 
RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR] 
RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR] 
RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Net Vampire [OR] 
RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Offline Explorer [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Offline Navigator [OR] 
RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Papa Foto [OR] 
RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR] 
RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR] 
RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR] 
RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR] 
RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR] 
RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR] 
RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR] 
RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR] 
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Teleport Pro [OR] 
RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Web Image Collector [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Web Sucker [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebGo IS [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Website eXtractor [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Website Quester [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Wget [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Widow [OR] 
RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Xaldon WebSpider [OR] 
RewriteCond %{HTTP_USER_AGENT} ^Zeus [OR]
RewriteCond %{HTTP_USER_AGENT} ^Java [OR]
RewriteCond %{HTTP_USER_AGENT} ^Sogou web spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Sosospider+ 
RewriteRule ^.* - [F,L]
You can find the referrers hitting your site by downloading your visitor logs and you can also look at your "latest visitors" in the cPanel -

This is what you looking for - this is a good referer:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:26.0) Gecko/20100101 Firefox/26.0

This is one of the bad ones because they ignore your robots .txt
Mozilla/5.0 (compatible; Baiduspider/2.0; +百度搜索帮助*心—关于Baiduspider)

Good referers obey your robots.txt file
Bad ones don't


Just remember, every line that's added to the htaccess file, has to be processed. This will certainly slow down a site.

Kingfish85 is offline   Reply With Quote
Old 12-15-2013, 07:53 AM   #27
ɹoıɹɹɐʍ ǝʌıʇɔɐɹǝdʎɥ
War Room Member
 
RobinInTexas's Avatar
 
Join Date: Dec 2008
Location: Texas
Posts: 1,758
Blog Entries: 3
Thanks: 164
Thanked 346 Times in 305 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Contact Info
Default Re: How to block someones IP address?

Quote:
Originally Posted by Karen Blundell View Post
rather than blocking ip address for bots it is far more efficient to block the user-agent or referer in your .htaccess file or in the OP's case httaccess.txt -
here is a pretty good one :

Code:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^Sogou web spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Sosospider+ 
RewriteRule ^.* - [F,L]
You can find the referrers hitting your site by downloading your visitor logs and you can also look at your "latest visitors" in the cPanel -

This is what you looking for - this is a good referer:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:26.0) Gecko/20100101 Firefox/26.0

This is one of the bad ones because they ignore your robots .txt
Mozilla/5.0 (compatible; Baiduspider/2.0; +百度搜索帮助*心—关于Baiduspider)

Good referers obey your robots.txt file
Bad ones don't
Rather than
Code:
RewriteRule ^.* - [F,L]
Which generates an error in your Apache log file.
I prefer to use
Code:
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
Which simply sends them on their way. Or if they are slow on the uptake.

Robin


...Even if you're on the right track, you'll get run over if you just set there.
RobinInTexas is offline   Reply With Quote
Old 12-15-2013, 06:08 PM   #28
Advanced Warrior
War Room Member
 
kpmedia's Avatar
 
Join Date: Apr 2010
Location: USA, Europe
Posts: 870
Thanks: 54
Thanked 195 Times in 157 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Default Re: How to block someones IP address?

I send mine to a honeypot.

FAQ: Need a HostGator alternative? And who is EIG?
--------------------------------------------------------------------------------
Need a good VPS, dedicated server, or non-unlimited host?
Note: This list of high-quality hosts is community maintained, and NOT a fake "top 10" list.
kpmedia is offline   Reply With Quote
Old 12-16-2013, 12:33 PM   #29
Warrior Member
 
Join Date: Dec 2013
Posts: 12
Thanks: 0
Thanked 2 Times in 2 Posts
Default Re: How to block someones IP address?

Let me riddle you this: if normal users are allowed to submit the form, how are you going to stop spammers from doing the same?

You can't filter them out at the web level completely. Spammers can always just fill out the CAPTCHA themselves. What you need to do is install a reliable spam filter on your email server.
wondy is offline   Reply With Quote
Old 01-31-2014, 02:06 AM   #30
Warrior Member
 
Join Date: Jan 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: How to block someones IP address?

You can use this service to prevent any country or ip's from accessing your websites.

MyIPBlocker - IP BLOCKER | COUNTRY BLOCKER

Configure it properly and add a line to your page/s. It will do the rest for you. You can redirect the blocked traffic wherever you want as well and no need for .htcacess
jkujami is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Bookmarks

Tags
address, block, email, ipaddress, someones, spam

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

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



All times are GMT -6. The time now is 12:55 AM.