Getting and storing user IP address
| From: | michael bredthauer | Date: | Mon, 23 Mar 2015 16:18:35 +0000 |
| Subject: | Getting and storing user IP address | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324699@lists.php.net to get a copy of this message | ||
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?