Forum Moderators: coopster

Message Too Old, No Replies

Proxy Server question

         

doodlebee

7:09 pm on Dec 13, 2009 (gmt 0)

10+ Year Member



I just had a quick question. I have a nice form script I've written - I love using it whenever I can. However, I wanted to add something to it I never have had before: I want to have the end user's IP address sent to me when they submit the form. (It's a simple contact form - I want the IP address just so I can ban trolls/spammers, basically.)

I've gotten that part to work out just fine, but I know it doesn't work if the end user is behind proxy server. So basically I just want a simple test to see if the end user is behind a proxy. (I don't want to blacklist IPs if I just end up blacklisting pointless IP addresses) All I want it to do is 1) test of the end user is behind a proxy, and if so, 2) return a value of "yes" in the end email I receive.

Anyone know of a quick little PHP code snippet I can use to just return a value of "yes" or "no" to show if the end user is behind a proxy?

caribguy

8:03 pm on Dec 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're looking for HTTP_X_FORWARDED_FOR

To get its value: either insert it in a hidden field in your form, or grab it when the form is processed.

$ipString=@getenv("HTTP_X_FORWARDED_FOR")

doodlebee

11:35 pm on Dec 13, 2009 (gmt 0)

10+ Year Member



Thanks so much! :)