PHP Contact Form Capture source/Real IP of Visitor behind
Posted: Sat Mar 20, 2010 9:44 am
I have a working contact form in PHP with IP address also being sent along with the user filled data via email. I used the following code:
$userip = ($_SERVER['X_FORWARDED_FOR']) ? $_SERVER
['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$message .= "\n\nUser's IP: ". $userip;
This code is in my "form.php".The form.php calls "processor.php on form submit.The above code sends the IP address but not the real/source IP of the visitor who is surfing anonymously by a proxy server. I tested it myself by using a free proxy server (free4proxy dot com)and the contact form result shows only the Proxy IP. Since I don't know PHP etc... I am very much in need of help from this forum. I am receiving several mails that are suspicious. Please help me. Thank You.
$userip = ($_SERVER['X_FORWARDED_FOR']) ? $_SERVER
['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$message .= "\n\nUser's IP: ". $userip;
This code is in my "form.php".The form.php calls "processor.php on form submit.The above code sends the IP address but not the real/source IP of the visitor who is surfing anonymously by a proxy server. I tested it myself by using a free proxy server (free4proxy dot com)and the contact form result shows only the Proxy IP. Since I don't know PHP etc... I am very much in need of help from this forum. I am receiving several mails that are suspicious. Please help me. Thank You.