How to block a user or ip from a country

Discussion in 'Site & Server Administration' started by swapshop, Sep 24, 2006.

Thread Status:
Not open for further replies.
  1. #1
    Has anyone had issues with these idiots spammers your site?

    All they are doing is attempting to prompt their stupid site. They are filling our form to see if we or our users will visit.

    Site is www.mambasearch.com

    Simply Crap site

    Logs show China net.gwbn.cq.cn

    How to we block them?

    I really dont wont to block all of china just these guys.
     
    swapshop, Sep 24, 2006 IP
  2. mehbooba

    mehbooba Peon

    Messages:
    260
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    here's what i do in .htaccess :


    <Files ~ "\.(cgi|pl)$">
    ErrorDocument 403 /redirect-spam.php
    order allow,deny
    allow from all
    deny from xxx.xxx.x.xxx
    </Files>


    the first line tells the server that if anyone with IP address 'xxx.xxx.x.xxx' tries to access files that have extension .pl or .cgi then execute a file called 'redirect-spam.php'.. which is located in root.

    redirect-spam.php is the following code :

    <?
    header("Location: http://www.somewebsite.com/");
    ?>


    so the offending user will be taken to some other website.

    ps if you have multiple ips you want to ban, then list the ips one after the other as in :


    <Files ~ "\.(cgi|pl)$">
    ErrorDocument 403 /redirect-spam.php
    order allow,deny
    allow from all
    deny from xxx.xxx.x.xxx
    deny from xxx.xxx.x.xxx
    deny from xxx.xxx.x.xxx
    deny from xxx.xxx.x.xxx
    </Files>
     
    mehbooba, Sep 24, 2006 IP
  3. swapshop

    swapshop Peon

    Messages:
    656
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes looks a good option

    Put a ip sniffer script on the form page to monitor

    Seems more than one ip range?
     
    swapshop, Sep 24, 2006 IP
  4. Abhik

    Abhik ..:: The ONE ::..

    Messages:
    11,337
    Likes Received:
    606
    Best Answers:
    0
    Trophy Points:
    410
    Digital Goods:
    2
    #4
    wht u run? a forum? if so there is a option of banning IP in ACP
     
    Abhik, Sep 24, 2006 IP
  5. swapshop

    swapshop Peon

    Messages:
    656
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Scripted a login form to stop any guest from posting. This seems to have worked.
     
    swapshop, Sep 25, 2006 IP
  6. Jocelyn

    Jocelyn Guest

    Messages:
    140
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you are hosted on a unix server you can block IP's from your Cpanel.
    It's in the Site Management under IP deny manager
     
    Jocelyn, Sep 25, 2006 IP
  7. Xitanto

    Xitanto Peon

    Messages:
    434
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Xitanto, Sep 25, 2006 IP
  8. wildcard

    wildcard Active Member

    Messages:
    58
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    98
    #8
    Hi,

    A fast and simple solution is to block your spam visitors. First try to find out from which country they come. Depending on this you can use an .htaccess file to block traffic from this ipaddress, or if you want you can block a whole country. The site located at blockacountry.com can help you with this last procedure. Simply select which countries you want to block, press the okay button and the website creates an .htaccess document for you. Upload this file to your server and your annoying spam visitors should be history.

    Wildcard
     
    wildcard, Jul 7, 2007 IP
Thread Status:
Not open for further replies.