i have a contact form on my website, and i'm trying to know what is the IP address of the users, i've tried this PHP code on my local testing XAMPP:
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
//check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
//to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$ipaddress= getRealIpAddr();
echo "my ip address is" . $ipaddress;
but the results is always like
"my ip address is::1",
I don't know what's wrong with the code.