How To Block visitors from China and Iran ?

Discussion in 'Site & Server Administration' started by mantodeus, Mar 29, 2008.

  1. #1
    Hello
    I want to block all visitors from China and Iran.
    My site is using automates system on sign up and their country is automatically recorded on sign up but I want to stop these users ?
    How to do this,do you have any ideas ?
     
    mantodeus, Mar 29, 2008 IP
  2. maverick0

    maverick0 Active Member

    Messages:
    359
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #2
    You can use .htaaccess or the "Deny IP" option that some service providers give. I've used the latter to block off some countires successfully.
     
    maverick0, Mar 29, 2008 IP
  3. mantodeus

    mantodeus Active Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    I know for .htaccess way but I want to use some database which is updated at least once a month.My site use some database on this principle for location country on sign up but I don't know how to deny sign up if member come from China or Iran ....
     
    mantodeus, Mar 29, 2008 IP
  4. ilxeon

    ilxeon Peon

    Messages:
    336
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ilxeon, Mar 31, 2008 IP
  5. IwhiC

    IwhiC Peon

    Messages:
    2,594
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    0
    #5
    IwhiC, Apr 1, 2008 IP
  6. mantodeus

    mantodeus Active Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #6
    htaccess don't solve my problem...
     
    mantodeus, Apr 2, 2008 IP
  7. D'Godown

    D'Godown Well-Known Member

    Messages:
    1,093
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    140
    #7
    sounds weird, if you confirm you are using apache as web daemon.
     
    D'Godown, Apr 3, 2008 IP
  8. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #8
    iptables if you have your own server and add the IP ranges
    I use so for china
     
    hans, Apr 3, 2008 IP
  9. maestria

    maestria Well-Known Member

    Messages:
    705
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #9
    you can add some code, in php/asp or whatever the form is created in and then check for the environment variable to check the ip address of the visitor and carry out the actions accordingly.
     
    maestria, Apr 5, 2008 IP
  10. Farhan5

    Farhan5 Peon

    Messages:
    189
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    is there any script to do this...?
     
    Farhan5, Apr 6, 2008 IP
  11. eido

    eido Guest

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    If you have an Apache server, you can do this without scripting. Scripting will still allow them to poke around your site. Additionally you'd have to do it on all files, and change it every time a new one comes up.

    This is a little complex, things can go wrong, so fully research before you drop in an .htaccess file with deny directives. Once you are familiar it, it as simple as creating a plain text file containing something like this, and naming it ".htaccess." "#" are comments and will not affect the functioning of the directives.

    order allow,deny
    <Limit GET POST>
    allow from all

    # specific ip address
    deny from 123.123.123.123
    # deny a range: 123.123.0.0 - 123.123.255.255
    deny from 123.123.0.0/16
    # the whole class: 123.0.0.0 - 123.255.255.255
    deny from 123.0.0.0/8
    # shorthand for previous
    deny from 123
    </Limit>
     
    eido, Apr 6, 2008 IP
  12. Chuman

    Chuman Well-Known Member

    Messages:
    977
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #12
    order allow,deny
    <Limit GET POST>
    allow from all

    # specific ip address
    deny from 123.123.123.123
    # deny a range: 123.123.0.0 - 123.123.255.255
    deny from 123.123.0.0/16
    # the whole class: 123.0.0.0 - 123.255.255.255
    deny from 123.0.0.0/8
    # shorthand for previous
    deny from 123
    </Limit>
    order allow,deny
    <Limit GET POST>
    allow from all

    # specific ip address
    deny from 123.123.123.123
    # deny a range: 123.123.0.0 - 123.123.255.255
    deny from 123.123.0.0/16
    # the whole class: 123.0.0.0 - 123.255.255.255
    deny from 123.0.0.0/8
    # shorthand for previous
    deny from 123
    </Limit>

    Can I do in the following format If I have to block more than 1 country's list.
     
    Chuman, Apr 6, 2008 IP