Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Is echo $ SERVER['REMOTE ADDR']; safe?


Achernar - 3:02 pm on Mar 13, 2008 (gmt 0)


$_SERVER['REMOTE_ADDR'] will always be an IP address. This is one of several $_SERVER[] variables that are not fed directly by the user. The value comes from apache. The address might be faked, but it will always be in the form 127.234.56.78 .
$_SERVER['REMOTE_HOST'], to the contrary, is a value that apache gets by reverse DNSing 'REMOTE_ADDR'. I don't know if it does some sanity checks on it. 'REMOTE_HOST' is only available if "HostnameLookups" is set to "on" in apache's configuration.


Thread source:: http://www.webmasterworld.com/php/3598882.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com