oo7ml — 2013-03-27T12:15:46-04:00 — #1
I need to block various countries from accessing my site (for reasons i won't go into right now... other than being compliant and meeting regulations with my payment provider... please don't make this the topic).
I am not sure if it is best / easiest to block all of the my site or just certain page from these countries... anyway, my question is... what is the best way to block specfic countries...
I have the GEO MaxMind database feeding into my site, however would querying each users IP address against my GEO database pull a lot of resources out of my site... can anyone suggest a better way to achieve this (if there is one...), thanks in advance...
drummin — 2013-03-27T12:32:53-04:00 — #2
Query GEO database ONCE and build an array of blocked IP's. Then compare visitors IP to this array using in_array() and act accordingly.
oo7ml — 2013-03-27T12:37:46-04:00 — #3
Good thinking and then just rebuild that array every month to keep the IP database in sync
drummin — 2013-03-27T12:44:40-04:00 — #4
There seems to be many sites talking about this issue. It might be easier to block a country if that's what your after. Web search for "Block IP from country" brings up lot of results. Never tried it personally but worth looking into.
oo7ml — 2013-03-27T12:46:06-04:00 — #5
Hi, sorry i may have not explained it correctly... yes i need to block countries and not individual users / IPs
oo7ml — 2013-03-29T12:05:01-04:00 — #6
Is there any site that will allow you to access a site from another country so that you can test your site against blocked countries?
kylewolfe — 2013-03-29T12:15:12-04:00 — #7
PHP PECL has a library for this: http://php.net/manual/en/book.geoip.php
Keep in mind, that people can still use proxies...