Why this code return "" :
$ip = "";
if(getenv("HTTP_CLIENT_IP"))
{
$ip = getenv("HTTP_CLIENT_IP");
} elseif(getenv("HTTP_X_FORWARDED_FOR")) {
$ip = getenv("HTTP_X_FORWARDED_FOR");
} else {
$ip = getenv("REMOTE_ADDR");
}
Environment: W2003EE, IIS 6.0, PHP 5.2.9 (ISAPI)
$_SERVER is a built-in PHP variable. getenv() looks at the current environment.
In my case i need to use $_SERVER. Thank all!