Hi,
I'm replying because I haven't seen a correct answer to this posted yet (or maybe I just haven't looked hard enough):
$HTTP_SERVER_VARS['HTTP_CLIENT_IP'] will correctly return the client IP address, i.e. the IP address of your user's PC with which they are currently on the Internet.
$GLOBALS['REMOTE_ADDR'] or $REMOTE_ADDR or $HTTP_SERVER_VARS['REMOTE_ADDR'] may return the client IP address on an Intranet or test server in someone's house. Most likely, however in the big wide world this will return the IP address of the proxy (transparent) that your user's ISP will be causing their request to go through.
Hope that helps, although you may have already had this answered successfully by now.
Or expressed as slightly better code:
Determine the client IP address
$ip = $HTTP_SERVER_VARS['HTTP_CLIENT_IP'];
If IP address is not yet set, try other proxy value
if ( $ip == "" || $ip == "unknown" ) $ip = $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'];
If IP address is still not set, try Remote Address
if ( $ip == "" || $ip == "unknown" ) $ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
Display the IP address
echo $ip;