Quote:
Originally Posted by fluffygrrl
Now now, settle down.
If what you want to use php to get a variable with the country code, you will end up having to use php to get a variable loaded with the country code. There'd obviously be better ways to solve this problem, but this is what was originally requested, a simple way to solve it, that can be dropped into various projects w/o hassle.
Incidentally, if you want to filter or redirect hits you're better off putting ip lists in your hosts or htaccess than using php to begin with.
Why are you so aggro anyway ?
|
Your system does more harm than good. That's why I called you out on it; sometimes it's better not to have something than to have something detrimental. Much like a homebrew blog that does a 'SELECT * FROM `table`', this system is beyond suboptimal - it shows you have put no thought into the actual design, even if it's an amazingly trivial thing - if it's called once per page hit, that's outright dangerous.
Even when it FINDS one, it doesn't break; it keeps on going straight through, so, hey, yeah, I see you, but I'm still calling the next 1,000 to see if maybe you fit those, too.
So, you don't know the easiest way to compute the ip, you're using a text lookup table, and you're gonna be killing that CPU for a few moments as well as the unnecessary overhead.
You've made a functional, but not viable solution. Don't do that.