Quote:
Originally Posted by GigoloShawn
You're fucking kidding, right?
Loading a text file for each hit, not using SHM or some other caching, and an entire lack of knowledge of ip2long()?
Please tell me you're not doing this professionally. This dumb thing is... just stupid. Hell, if this is all of the functionality you require, have someone install mod_geoip and use the built-in functions for Apache; it will load into SHM and not do an incredibly dumb foreach() match for everything. This is worse than a bubblesort.
P.S. When you find a match, break from the loop.
|
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 ?