get country code and say hi.. help
Posted: Sun Sep 26, 2004 8:16 pm
hey, I'm looking to code a script for mulit national members, and what I would like to do is when they come to my page, they would trigger the script, and it would search the headers for the IP and translate it to the host and search the string for predifined country codes.. something like this:
well hopefully you will get the picture with my example.. any help? thanks 
Code: Select all
<?php
$cc0 = ".mt";
$cc1 = ".nl";
//etc..
$ip = gethostbyaddress('$REMOTE_ADDR');
//code that snakes the country code from the $ip variable <-- help here
if($ip == $cc0) {
echo "Your logging in from Malta";
} else if($ip == $cc1) {
echo "Your logging in from the Netherlands";
}//etc..
?>