How can I stop users of one country post ad in other country?

Discussion in 'PHP' started by archc, Aug 31, 2012.

  1. #1
    Hi people,

    I have a free classified site in PHP. Is there any way I can stop people of one country post ads in other country? For example I want people from India are not able to post ads in the US and vice versa. I still want people from India view ads in the US but don't want to allow them post ads in the US.

    Any suggestions ?
     
    archc, Aug 31, 2012 IP
  2. initiotech

    initiotech Well-Known Member

    Messages:
    187
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #2
    You need to tell us what script are you using for the Classified Site, so that DP'ians can get a solution for you!!
     
    initiotech, Aug 31, 2012 IP
  3. archc

    archc Banned

    Messages:
    367
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #3
    Thanks for the reply but I don't think telling what script I'm using gonna help ya figure out what could be the solution of my problem. I'm technical as well but unable to think how it can be done. Let it be any script, it will probably be a separate feature which prevents people from one country to post ads in other countries.

    anyone else?

     
    archc, Aug 31, 2012 IP
  4. initiotech

    initiotech Well-Known Member

    Messages:
    187
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #4
    One Method which can restrict pages from getting viewed is putting the Ip Restrictions in the .HTACCESS file . but then you will have to figure it out which page does your Post Ad Page goes too , it most commonly goes to a Common Page For all , unless you have a querry string in the URL identifying the Country.
     
    initiotech, Aug 31, 2012 IP
  5. elitestar47

    elitestar47 Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Telling the script matters, We will tell you in which file you have to make changes to get it done, Please consider it and let us know which script are you using, We can help you sort that out.

    Thanks,
    Best Regards,
    Elite Star - Going 24 / 7
     
    elitestar47, Sep 1, 2012 IP
  6. ironmankho

    ironmankho Active Member

    Messages:
    393
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #6
    That is very simple if you use wordpress
     
    ironmankho, Sep 1, 2012 IP
  7. archc

    archc Banned

    Messages:
    367
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #7
    if I do that, I'll ban my site in that country which I don't want. I want people from one country can view, search ads posted in any country but don't want them to post ads out of their true country.

     
    archc, Sep 1, 2012 IP
  8. initiotech

    initiotech Well-Known Member

    Messages:
    187
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #8
    Write a IF condition in the Post Ad's PHP Page to filter the IP Addresses.
    Thats the least I can suggest now..if you dont want to share which script you are using..thats the MAX i can help here.
     
    initiotech, Sep 1, 2012 IP
  9. archc

    archc Banned

    Messages:
    367
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #9
    Hi Mate,

    Thanks mate.
    So you mean only in "post ads" page, if I write "IF" statement, any particular country people won't be able to post ads in other country but can view/search it. I got that.

    But how will you ban one country people to post ads (only post ad) in other country you can't insert so many IP's? Sorry if this is a lame ques, I'm little confused.

     
    archc, Sep 2, 2012 IP
  10. initiotech

    initiotech Well-Known Member

    Messages:
    187
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #10
    To make it work more perfectly , There are Two Ways

    1) Simple Way :

    Make multiple Arrays of country IP address and then In the IF Condition run a Loop to check each ip in the array which you want to ban. Then Access , for this case it would be more simple if all your Post Ad's Pages are different for each country.

    2) A Complex Way :

    Make Table's for Each County which you want to ban in MySQL or any other DB you are using and maintain the IP Addresses in that Table.
    And run a query example "select * from <<County_IP>> where ipaddress=<<The Current IP>> if there are no rows returned that means the user should be allowed if there is a row returned that means he is banned. If he is banned save a flag in the User Table and next time the same user tries to access through a Proxy u can ban him by posting ads because of the Flag you have saved.

    I hope this will help you figure out how it could be done..
     
    initiotech, Sep 3, 2012 IP
  11. archc

    archc Banned

    Messages:
    367
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #11
    Thanks Buddy,

    For option-1,

    I don't think, it is possible to have separate "post ad" page for each country. There are many countries.

    Option-2,

    If I go by this method, it will ban the user when feeded IP address is encountered and then he/she won't be able to access the site even (view/search) cuz IP is banned ! he won't be able to post ads even in his true country.

    I think there is no other way than manual monitoring.


     
    archc, Sep 3, 2012 IP
  12. initiotech

    initiotech Well-Known Member

    Messages:
    187
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #12
    The Second Method Will Work if you just put the Check in The Post Add Pages..
     
    initiotech, Sep 3, 2012 IP
  13. archc

    archc Banned

    Messages:
    367
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #13
    I may be wrong but I'm thinking the other way. The user will get banned as soon as he/she visits and try to post ad in different country. He/she may try posting ads in other country for fun/testing/marketing purpose but the moment he tries to post ads, he will be banned and wont able to even search/view ads once banned.


     
    archc, Sep 3, 2012 IP
  14. initiotech

    initiotech Well-Known Member

    Messages:
    187
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #14
    You got it Wrong , Ban does not mean Ban Him from using the Forum I meant show Him an Error Page when he tries to Post an Ad.
     
    initiotech, Sep 3, 2012 IP
  15. Gemba

    Gemba Member

    Messages:
    36
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    25
    #15
    Use something like geoip_country_name_by_name($ip) to check what country they're accessing from, then redirect them to an error page if they're trying to post in a different country.
     
    Gemba, Sep 3, 2012 IP
  16. archc

    archc Banned

    Messages:
    367
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #16
    Ok, I'll apply this trick and see if this works for me.

    Thanks Mate !

     
    archc, Sep 4, 2012 IP
  17. freeadstime

    freeadstime Well-Known Member

    Messages:
    243
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    123
    #17
    We run classifieds too and we are using our unique code. We know what type of headaches you have. You simply want to stop spammers. We added a black list and number of spams have been lowered drastically since then. We didn't take the second measure (what you wanted to do) yet, simply because some of these ads might be legit.
     
    freeadstime, Sep 15, 2012 IP