Hello,
I am wanting to collect the IP address of anyone that visits my site and submits a form (Saving it to my DB).
I have been researching this and have found the following:
`
<?php
if (getenv('HTTP_X_FORWARDED_FOR')) {
$pipaddress = getenv('HTTP_X_FORWARDED_FOR');
$ipaddress = getenv('REMOTE_ADDR');
echo "Your Proxy IP address is : ".$pipaddress. "(via $ipaddress)" ;
} else {
$ipaddress = getenv('REMOTE_ADDR');
echo "Your IP address is : $ipaddress";
}
?>
`
Of couse, I would modify this code to allow it to post to my DB, not echo it for the User.
Is this a sound method or are there other methods?
Is there anything else in particular that I should be aware of?
Thank you,
Matthew