Scot L. Harris wrote:
I'm running a PHP system that relies on knowing the location of the terminal to handle a lot of '911' (999) type things. I know that REMOTE_ADDR can not be relied on, but with fixed IP addresses on a local network it works fine. However I now have a customer who has a Terminal Server thin client network, and REMOTE_ADDR only reports the server address. In order to restore the facilities I need to gain access to the CLIENTNAME environmental variable from the browser and return it to PHP.
This won't work?
function get_ip() { if (isSet($_SERVER)) { if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) { $realip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) { $realip = $_SERVER["HTTP_CLIENT_IP"]; } else { $realip = $_SERVER["REMOTE_ADDR"]; } } else { if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) { $realip = getenv( 'HTTP_X_FORWARDED_FOR' ); } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) { $realip = getenv( 'HTTP_CLIENT_IP' ); } else { $realip = getenv( 'REMOTE_ADDR' ); } } return $realip; }
No - neither HTTP_X_FORWARDED_FOR or HTTP_CLIENT_IP are returned for any browser running on Terminal Server. Just REMOTE_ADDR which is the address of the server not the client. Would be nice if HTTP_CLIENT_IP COULD be returned, and it would make sense.
-- Lester Caine ----------------------------- L.S.Caine Electronic Services
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php