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 ?
You need to tell us what script are you using for the Classified Site, so that DP'ians can get a solution for you!!
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?
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.
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
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.
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.
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.
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..
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.
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.
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.
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.
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.