1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I block IP from Romanian spammers in Wordpress???

Discussion in 'White Hat SEO' started by HElaa, Mar 8, 2011.

  1. HElaa

    HElaa Newbie

    Joined:
    Feb 28, 2011
    Messages:
    23
    Likes Received:
    14
    Hi,

    Every day I get a spam message (defaults to a series of question marks) from the same IP in Romania. It always goes to the same post, made months ago.

    I guess it's a bot of some kind.

    I can manually delete these, which I have been doing for two weeks now, but is there a way in Wordpress to block the IP so they can't leave the message at all?

    Thanks.
     
  2. pyronaut

    pyronaut Executive VIP

    Joined:
    Dec 9, 2008
    Messages:
    1,229
    Likes Received:
    1,422
    You can block it from cPanel using the deny IP manager, or if you have a VPS/Dedicated you can block them via the firewall you are using.
     
  3. SpiderWebMaster

    SpiderWebMaster Power Member

    Joined:
    Jan 24, 2009
    Messages:
    617
    Likes Received:
    519
    Occupation:
    I don't have a job...
    Location:
    /dev/null
    open your .htaccess file and add this line to the end

    Code:
    deny from SPAMMER_IP_HERE
    and you are done.

    If you don't have an .htaccess file you can create one and put that in

    You should check this page here http://codex.wordpress.org/Combating_Comment_Spam/Denying_Access

    In fact, if you are using WP, the codex is always the first place to look for info, also their forums, for these generic questions they have great resources there.
     
    Last edited: Mar 8, 2011
  4. chief99

    chief99 Junior Member

    Joined:
    Mar 5, 2011
    Messages:
    152
    Likes Received:
    26
    I put this in my .htaccess file

    order allow,deny
    deny from spammer ip address
    allow from all
     
  5. wkirk

    wkirk Junior Member

    Joined:
    Apr 3, 2011
    Messages:
    139
    Likes Received:
    67
    Here's a more generic solution that uses a different approach:

    You need the php5-geoip package installed, at least on debian/ubuntu/etc based distros.

    Here's an example php code:

    Code:
    <?php
    
    require_once("geoip.inc");
    $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
    $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
    geoip_close($gi);
    if($country_code == 'RO') 
    {
            header('Location: http redirect-romanian-addresses-here dot com');
    };
    
    ?>
    
    This will redirect all traffic from the specified country ( RO = romania here , CN is for china ) to the address provided.

    So this is to block/redirect whole countries, not just a single ip.

    I guess this is well known, but may be useful for ppl searching the forum on this subject.
     
  6. wkirk

    wkirk Junior Member

    Joined:
    Apr 3, 2011
    Messages:
    139
    Likes Received:
    67
    Here you can find the complete list of country codes:

    Code:
    www dot maxmind dot com/app/iso3166
    
     
  7. Bubba

    Bubba Newbie

    Joined:
    Jan 6, 2009
    Messages:
    31
    Likes Received:
    7
    There is a plugin called iQ Block Country that does a pretty good job of blocking specific countries from accessing your website. I installed it on my WP installation a few days ago because I got hacked from China. I used the plugin and haven't had any Chinese visitors.
     
  8. Migladon

    Migladon Regular Member

    Joined:
    May 16, 2009
    Messages:
    229
    Likes Received:
    135
    Just go in your ftp client open your .htaccess and deny it. You can also deny a whole country ip range by doing a search on google. I know there is a website which provides all ips for a country Gl
     
  9. Bubba

    Bubba Newbie

    Joined:
    Jan 6, 2009
    Messages:
    31
    Likes Received:
    7
    Here is the code to block the entire country of Romania. Just add this to your .htaccess file:

    Code:
    <Limit GET HEAD POST>
    order allow,deny
    # Country: ARMENIA
    # ISO Code: AM
    # Total Networks: 67
    # Total Subnets:  505,632
    deny from 31.7.160.0/21
    deny from 31.47.192.0/21
    deny from 46.19.96.0/21
    deny from 46.70.0.0/15
    deny from 46.130.0.0/16
    deny from 46.162.192.0/18
    deny from 46.182.168.0/21
    deny from 46.241.128.0/17
    deny from 62.89.0.0/19
    deny from 77.95.184.0/21
    deny from 78.109.64.0/20
    deny from 79.170.200.0/21
    deny from 80.86.224.0/20
    deny from 81.16.0.0/20
    deny from 81.89.208.0/20
    deny from 83.139.0.0/18
    deny from 87.241.128.0/18
    deny from 89.249.192.0/20
    deny from 91.103.24.0/21
    deny from 91.103.56.0/21
    deny from 91.199.38.0/24
    deny from 91.199.226.0/24
    deny from 91.205.132.0/21
    deny from 91.205.140.0/22
    deny from 91.208.76.0/24
    deny from 91.208.149.0/24
    deny from 91.209.38.0/24
    deny from 91.209.105.0/24
    deny from 91.210.40.0/22
    deny from 91.212.71.0/24
    deny from 91.217.157.0/24
    deny from 91.218.4.0/22
    deny from 91.220.124.0/24
    deny from 91.221.228.0/23
    deny from 92.43.136.0/21
    deny from 93.94.216.0/21
    deny from 93.185.32.0/20
    deny from 93.187.160.0/21
    deny from 94.228.16.0/20
    deny from 95.140.192.0/20
    deny from 109.68.120.0/21
    deny from 109.75.32.0/20
    deny from 176.32.192.0/21
    deny from 178.72.128.0/18
    deny from 178.78.128.0/18
    deny from 178.160.128.0/17
    deny from 178.219.48.0/20
    deny from 188.115.192.0/18
    deny from 193.200.130.0/24
    deny from 194.247.50.0/24
    deny from 195.8.50.0/23
    deny from 195.43.74.0/23
    deny from 195.60.80.128/27
    deny from 195.88.66.0/23
    deny from 195.88.254.0/23
    deny from 195.191.100.0/23
    deny from 195.191.154.0/23
    deny from 195.191.186.0/23
    deny from 195.250.64.0/19
    deny from 212.34.224.0/19
    deny from 212.42.192.0/19
    deny from 212.73.64.0/19
    deny from 217.26.128.0/20
    deny from 217.63.96.0/19
    deny from 217.76.0.0/20
    deny from 217.113.0.0/20
    deny from 217.113.16.0/20
    #
    allow from all
    </Limit>