On 23/03/2015 16:18, michael bredthauer wrote: > 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? > > Hi, Take a look at this function by Corey Ballou: http://blackbe.lt/advanced-method-to-obtain-the-client-ip-in-php/ It checks all the following headers and looks for multiple values from chained proxies. HTTP_CLIENT_IP HTTP_X_FORWARDED_FOR HTTP_X_FORWARDED HTTP_X_CLUSTER_CLIENT_IP HTTP_FORWARDED_FOR HTTP_FORWARDED REMOTE_ADDR Regards Ian -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php