I'm using XAMPP platform( php, apache, mysql ). I connecting to apache via localhost. I want to know user ip using this php code:
echo $_SERVER['REMOTE_ADDR'];
And I get on my page in my browser.
::1
I'm using XAMPP platform( php, apache, mysql ). I connecting to apache via localhost. I want to know user ip using this php code:
echo $_SERVER['REMOTE_ADDR'];
And I get on my page in my browser.
::1
As i commented it seems ipv6 , actually showing loopback addr ,
any way if you want ipv4 change it in server configuration , i think surplus tuts where available
test yourself with this singler
echo "Server Configured to use ". (strstr($_SERVER("REMOTE_ADDR"), ".")) ? "IPv4" : "IPv6" ;
or if just want to test its ipv(4/6)
if (((strstr($_SERVER("REMOTE_ADDR"), ".")) ? 4 : 6 )==4)
{
//ipv4
}
else
{
//ipv6
}