It would be better do it this way:
// get hostname and IP address
if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != ""){ // The have been forwarded by a proxy server get their IP address
$IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; // IP Address of User
$proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"]; // IP Address of proxy server
}else{ // Else just get their IP Address
$IP = $HTTP_SERVER_VARS["REMOTE_ADDR"]; // IP Address of User
}
The reason being if the person is behind a proxy this will still get their ip address. If you don\'t do it this way you will get the IP address of the proxy server and not the user.
If thats what you want then never mind. Just wanted to make sure you were aware of that.