[insert_php]
function get_client_ip() {
$ipaddress = ”;
if (getenv(‘HTTP_CLIENT_IP’))
$ipaddress = getenv(‘HTTP_CLIENT_IP’);
else if(getenv(‘HTTP_X_FORWARDED_FOR’))
$ipaddress = getenv(‘HTTP_X_FORWARDED_FOR’);
else if(getenv(‘HTTP_X_FORWARDED’))
$ipaddress = getenv(‘HTTP_X_FORWARDED’);
else if(getenv(‘HTTP_FORWARDED_FOR’))
$ipaddress = getenv(‘HTTP_FORWARDED_FOR’);
else if(getenv(‘HTTP_FORWARDED’))
$ipaddress = getenv(‘HTTP_FORWARDED’);
else if(getenv(‘REMOTE_ADDR’))
$ipaddress = getenv(‘REMOTE_ADDR’);
else
$ipaddress = ‘UNKNOWN’;
return $ipaddress;
}
$visitor = $_SERVER[‘REMOTE_HOST’];
if (preg_match(“/192.168.4.1/”,$visitor)) {
header(‘Location: https://172.16.4.51/prea/formulario.aspx’);
} else {
header(‘Location: https://ac.gobierno.pr/prea/formulario.aspx’);
};
echo $visitor
if (!empty($_SERVER[“HTTP_CLIENT_IP”]))
{
//check for ip from share internet
$ip = $_SERVER[“HTTP_CLIENT_IP”];
}
elseif (!empty($_SERVER[“HTTP_X_FORWARDED_FOR”]))
{
// Check for the Proxy User
$ip = $_SERVER[“HTTP_X_FORWARDED_FOR”];
}
else
{
$ip = $_SERVER[“REMOTE_ADDR”];
}
// This will print user’s real IP Address
// does’t matter if user using proxy or not.
echo $ip;
[/insert_php]