Forum Moderators: coopster
$gi = geoip_open("data.dat",GEOIP_STANDARD);
echo geoip_country_name_by_addr($gi, "62.255.64.5") . "\n";
geoip_close($gi);
Can anyone tell me what the echo line is doing? and as you can see i have specified the IP address, how can i get the code to detect the users IP instead?
Any help would be appreciated.
Cheers
Linda
If you want to redirect according to the country, use a header() [php.net] for each case.
Break stops the evaluations when there is a match.
switch( geoip_country_name_by_addr($gi, "62.255.64.5") ) {
case "Canada":
header("path/");
break;
...and so on...
}
switch( geoip_country_name_by_addr($gi, "62.255.64.5") ) {
case "Canada":
header("http://mydomain.com/canada");
break;
case "UK":
header("http://mydomain.com/uk");
break;
}
if thats correct then how do i get users that dont meet those case to be redirected to someother folder?
Cheers
Linda