Reputation: 397
I want to develop a site which blocks users from accessing certain areas of the site if they are within a 50 mile radius of my clients office buildings.
Is it possible to tell reliably with php where someone is by looking at their IP address? I've a funny feeling I've seen somewhere that it's not possible to know for sure exactly where someone is via their IP.
Upvotes: 1
Views: 383
Reputation: 324620
No. It is not possible to reliably anything with someone's IP address unless you're their ISP. Even then... My own IP tracks to a location 60 miles north of where I actually live, so if your office were right next door I could still access your site. And that's without taking proxies into account.
If you want to protect parts of a site, use a password. That's the only real option.
Upvotes: 0
Reputation:
50 miles exactly, no. You could use a geolocation database to restrict access to certain IPs within a certain set of zip codes however. Your accuracy will widely vary and if someone uses a proxy they will be able to access your site even with these restrictions in place.
Upvotes: 3
Reputation: 943207
Is it possible to tell reliably with php where someone is by looking at their IP address?
No.
GeoIP databases have variable levels of precision (depending on address) and people can use proxies.
Upvotes: 1