Hi,
This code will help you to find IP number of the user who visits your site.
$IPaddress = $SERVER['REMOTE_ADDR'];
$browser = $SERVER['HTTP_USER_AGENT'];
echo " IP address:\n";
echo "$IPaddress<br /><br />\n";
echo " Browser info: \n";
echo "$browser<br /><br />\n";
/ Converting IP address to IP Number /
$ips = explode('.', $IPaddress);
$IPNumber =($ips[3] + $ips[2] 256 + $ips[1] 65536 + $ips[0] * 16777216);
echo $IPNumber;
With these IPNumber we can find the country(Every Country has been allocated a range of IP number).
we need to map this IPNumber with IP range for that particular country(IPnumber_country ranges are available across many sites).
Thanks.