Put PHP code in your HTML pages by adding a directive in your .htaccess file. This example uses PHP to present custom content based on the country of the visitor using IP address to country database. No MySQL needed for this code.
Bug: the array values from explode function must be converted to int. PHP is comparing them as strings which means 234 is greater than 1234. Add (int) before the variable.
Ok so i dont use this anymore. There is a complete solution from maxmind using geoip.inc but his was a fun little project to try out for my first (maybe last) php programming adventure. Anyway here is the php code ...
http://fibzilla.com/example.txt
Link to this comment:
All Comments (0)