<?php
/*
// IP compartido
echo "IP Share: " . $_SERVER['HTTP_CLIENT_IP'] . "<br>";
// IP Proxy
echo "IP Proxy: " . $_SERVER['HTTP_X_FORWARDED_FOR'] . "<br>";
// IP Acceso
echo "IP Access: " . $_SERVER['REMOTE_ADDR'] . "<br>";
*/
?>

<?php
function getRealIP()
{
    if (isset($_SERVER["HTTP_CLIENT_IP"]))
    {
        return $_SERVER["HTTP_CLIENT_IP"];
    }
    elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
    {
        return $_SERVER["HTTP_X_FORWARDED_FOR"];
    }
    elseif (isset($_SERVER["HTTP_X_FORWARDED"]))
    {
        return $_SERVER["HTTP_X_FORWARDED"];
    }
    elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]))
    {
        return $_SERVER["HTTP_FORWARDED_FOR"];
    }
    elseif (isset($_SERVER["HTTP_FORWARDED"]))
    {
        return $_SERVER["HTTP_FORWARDED"];
    }
    else
    {
        return $_SERVER["REMOTE_ADDR"];
    }
}

echo "IP:".getRealIP();
  
?>
