// Debug switch (1/0) define (DEBUG,0); /** * debug: Simple debug output */ function debug($sender,$message) { if (DEBUG == 1) print "
$sender : $message\n";
}
/**
* Error output
*/
function error($msg) {
print "
Error
An error occured
".$msg. "
";
exit -1;
}
// Check if an IP is member of a network/subnet
// *******************************************************************************************
function isIpInRange($ip,$lowIp,$highIp) {
if (!(ip2long($ip) >= ip2long($lowIp) && ip2long($ip) <= ip2long($highIp)))
return false;
else
return true;
}
// Return the remote IP adress by analysing the content of REMOTE_ADDR and $HTTP_X_FORWARDED_FOR)
function getNetworkID() {
global $REMOTE_ADDR,$HTTP_X_FORWARDED_FOR;
$ip=$REMOTE_ADDR;
if ($HTTP_X_FORWARDED_FOR) {
$proxiesIp = preg_split("/,/",$HTTP_X_FORWARDED_FOR);
if ($proxiesIp[0])
$ip=$proxiesIp[0];
}
// BLAN via GW proxy
if ($ip == "156.106.192.3")
$ip="156.106.128.0";
// BLAN via SQUID proxy
if ($ip == "156.106.192.159")
if (preg_match ("/156.106.192.3/", $HTTP_X_FORWARDED_FOR))
$ip="156.106.128.0";
if (isIpInRange($ip,"156.106.249.68","156.106.249.70")) $network="B"; // BLUE LAN
elseif (isIpInRange($ip,"156.106.32.0","156.106.37.255")) $network="M"; // PURPLE LAN
elseif (isIpInRange($ip,"81.192.226.0","81.192.227.255")) $network="M"; // ORGANGE LAN (DELEGUATE)
else $network="Y";
return $network;
}
// Network detection
$network = getNetworkID();
// Process page
// error("network: $network");
if ($network=="B")
{
header("Location:http://web.itu.int/ibs/council/2005/index.html");
}
else
{
header("Location:http://www.itu.int/ibs/council/2005/index.html");
}
?>