I have been having some trouble with creating a way to store an IP address of a site visitor for tracking users site visits. So far I have heard using: $ip = $_SERVER['REMOTE_ADDR']?:($_SERVER['HTTP_X_FORWARDED_FOR']?:$_SERVER['HTTP_CLIENT_IP']); Would you consider this the best way?