Only Allow Access From Specific Geographic Area

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
braveryonions
Forum Newbie
Posts: 14
Joined: Wed Feb 11, 2009 3:31 pm

Only Allow Access From Specific Geographic Area

Post by braveryonions »

How can I allow access to a site only from a specific area? I want to allow only people in my county to view my site.
semlar
Forum Commoner
Posts: 61
Joined: Fri Feb 20, 2009 10:45 pm

Re: Only Allow Access From Specific Geographic Area

Post by semlar »

You can sort of, sometimes, get a moderate estimate of the geographical location of a visitor's ISP based on their IP address.

I wouldn't suggest restricting access using this method (personally, I wouldn't block anyone from viewing my site without a good reason).

There's probably a better solution for what you're trying to accomplish.
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: Only Allow Access From Specific Geographic Area

Post by php_east »

braveryonions wrote:I want to allow only people in my county to view my site.
some people from your country may not be in your country. they may be travelling or may be working offshore.
Last edited by php_east on Mon Mar 23, 2009 6:07 am, edited 1 time in total.
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Only Allow Access From Specific Geographic Area

Post by jayshields »

I think websites like Pandora accomplish this with IP addresses. Although they can be spoofed and sometimes aren't accurate it's the only feasible means of doing it.
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: Only Allow Access From Specific Geographic Area

Post by php_east »

here is a counrty-ip database i used for user tracking purposes on one module i made sometime ago, the database is free is relatively good, with users updating it and the site maitaining an updated version. it should be suffcient for your purpose.

this database at http://ip-to-country.webhosting.info
More informaton on this Database is at http://ip-to-country.webhosting.info/node/view/12.

you can then easily make a php or perhaps even .htaccess to manage your visitors.

enjoy.
Post Reply