1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to block all ips from a specifc country?

Discussion in 'Site & Server Administration' started by rlynch, Feb 25, 2006.

  1. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #21
    forget all the most valuable benefits using www to go publisc and reach out to the world, then shut down your server and start advertising in daily newspapers again.
    seriously the easiest way to make sure only a tiny readership gets your site!
    another way to make things complicated would be to require all memberships and have their passport sent first for verification.

    but

    why would anyone ever wold do such ...
     
    hans, Aug 13, 2007 IP
  2. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #22
    Nothing as expensive as that needs to happen I'm afraid.

    The problems a simple one, ALL of the clients ONLY come from the UK, Spain or Ireland, NONE of the clients EVER come from anywhere else, so no point paying for the extra bandwidth (very considerable bandwidth).

    So, any constructive ideas from anyone ?

    Kezi
     
    Kezi, Aug 13, 2007 IP
  3. dpvince

    dpvince Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Did you try the htaccess method described here?
    Instead of adding ALL those to ban, reverse the critria to ONLY allow certain IP's.

    In other words, use 'allow' instead of 'deny'.

    Lastly, here is another free script you can use.

    SimpleBan v1.0 by Jordan Boesch
    www.boedesign.com

    /-------- HOW TO USE -----------/
    Simply add the tag
    <? include("checkban.php"); ?>
    to all your pages.
    checkban.php checks if the person is banned (duh) - also
    if they're not banned they will be inserted into your IP log (usefull feature?).

    Good luck,

    - Vince
     
    dpvince, Sep 6, 2007 IP
  4. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #24
    Many thanks for that link, it's appreciated.

    Using that link and doing it in reverse, just wondering if the code below would be ok ?

    <Limit GET HEAD POST>
    order allow,deny
    deny from all
    allow from uk
    allow from ie
    allow from es
    </LIMIT>

    Kezi.
     
    Kezi, Sep 6, 2007 IP
  5. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #25
    Many thanks Vince - it looks as though that could be the answer ;-)

    One thing, I've d/loaded your d/load, but do I need to setup a database somewhere please ?

    The helps appreciated.

    Kezi.
     
    Kezi, Sep 6, 2007 IP
  6. wildcard

    wildcard Peon

    Messages:
    58
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #26
    Thanks for the tips, I will be updating blockacountry.com shortly to include more features. If you have any ideas, feel free to let me know.
     
    wildcard, Sep 11, 2007 IP
  7. grandy

    grandy Banned

    Messages:
    239
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #27
    There is a module called mod_geoip for apache. If you try to use it, it would really give you release from inserting each ip range of a country :) You can use mod_geoip module along with rewrite to ban a coutries whole ip range. But certainly it would need you to install mod_geoip which only can be done by the server admin of your host :)

    Good Luck.
     
    grandy, Sep 11, 2007 IP
  8. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #28
    I'm on shared servers, and don't want a 'heavy' .htaccess file with 1,000's of ip address's, what's the easiest way for a novice to do this please ? I did pm Maurice, but maybe he didn't receive it.

    Any help very much appreciated.

    Kez.
     
    Kezi, Sep 13, 2007 IP
  9. neil patrick harris

    neil patrick harris Peon

    Messages:
    288
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #29
    Download a proxy software program and check it out (Steganos Internet Anonym 2006). Its going to be next to impossible to block them. Why not let it work for you, spammers wil give you lots of page impressions if you use google adsense. ;)
     
    neil patrick harris, Sep 13, 2007 IP
  10. Scripto

    Scripto Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #30
    You should check power redirector, here is a demo
    http://www.12scripts.com/demo/redirector/admin/login.php
     
    Scripto, May 19, 2008 IP
  11. lkj

    lkj Peon

    Messages:
    729
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #31
    use iptables and country IP blocks (Cidr format) from IPdeny
     
    lkj, May 30, 2008 IP
  12. deny

    deny Active Member

    Messages:
    365
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #32
    deny, Jun 4, 2008 IP
  13. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #33
    But if you wanted a way to block visitors from certain countries, say for example, Japan, China, Russia and Korea, how exactly would that be done please ?

    Any help appreciated.

    Kezi.
     
    Kezi, Jun 4, 2008 IP
  14. deny

    deny Active Member

    Messages:
    365
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #34
    I think that you have not visited link above because there is everything explained.
     
    deny, Jun 4, 2008 IP
  15. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #35
    Yep, definitely looked there, in fact I looked there as soon as you mentioned it, but no sign of how to do what I mentioned earlier ? ? I found this page : http://www.find-ip-address.org/ip-blacklist-lookup.php is that what you mean ? ? If not, which page do you refer to please ?
     
    Kezi, Jun 4, 2008 IP
  16. deny

    deny Active Member

    Messages:
    365
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
  17. Dollar

    Dollar Active Member

    Messages:
    2,598
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    90
    #37
    Dollar, Jun 4, 2008 IP
  18. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #38
    That looks very good Dollar, will check through it more thoroughly this weekend. Couple of things, how would you change that script to ban certain countries, rather than code for the ones you allow please ? Also, where are the banned ones redirected to ?
     
    Kezi, Jun 5, 2008 IP
  19. Dollar

    Dollar Active Member

    Messages:
    2,598
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    90
    #39
    Doing blacklist you would need only to reverse the last function. Probaly from
    !in_array to a in_array. Also you may consider changing $okcountry to $badcountry in the script. So as to be not confused if your going to make it a blacklist rather then a whitelist.

     if(in_array($country, $badcountry)) //for blacklist rather then whitelist
    header('Location: /exit/')
    
    PHP:
    *untested

    To redirect them somewhere else edit the last function of the script using the PHP: Header
    The syntax is like

    header ("Location: http://anothersite.com/");
    header ("Location: /or-another-page.html");
    PHP:
     
    Dollar, Jun 5, 2008 IP
  20. Kezi

    Kezi Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #40
    Many thanks Dollar, you're a star. Just wondering if it's worth going for the paid vers of max mind - all of my clients come from the UK and nowhere else, but can't risk any of them in the UK not being able to view the website.
     
    Kezi, Jun 5, 2008 IP