Quote:
Originally Posted by Basher52
I've seen on certain websites that they won't let me view it cos I'm not in the "correct" country, how do they do this? Is there away to add this into my iptables script somehow? or maybe an addon of some sort?
I've been googling a lot for this but never found a real solution for it, just some that MIGHT be working correctly.
|
It's called GeoIP:
http://en.wikipedia.org/wiki/Geolocation_software
There are several services and API's you can use to do this. I've used this before:
http://www.geoplugin.com/
http://www.geoplugin.com/examples
...with good results. There may be others, though...I've only had need to do this twice, and using this free solution was all I needed. If I had to write code to do it, I'd build a blacklist of countries I didn't want to be able to access the site, do the geoip lookup, and compare the country to the blacklist. If found, display the "not allowed" page.
Be aware, though, that such things as TOR will spoof an address, and you'll appear to be from a different location...and this is easily done. If you want REAL security, you'll have to go a different route.