| | I was wondering how to add a (hidden) field to my submit form that will collect the IP address that someone is submitting from? (I'd like to see if my spams are from the same source.) |
|
|
Well, you could add it to your form, but I would recommend just putting it on the page that processes the forms, as that would stop bots from altering the hidden fields.
CODE $ip=@$REMOTE_ADDR; To add in form: CODE <input type=hidden name=ip value="<?php echo @$REMOTE_ADDR; ?>"> Like I said before, programs (and even users with a bit of work) can alter hidden fields. So instead of using CODE $ip = $_POST['ip']; or whatever, a better solution might be CODE $ip=@$REMOTE_ADDR; without bothering with the field. Well, you could add it to your form, but I would recommend just putting it on the page that processes the forms, as that would stop bots from altering the hidden fields. CODE $ip=@$REMOTE_ADDR; To add in form: CODE <input type=hidden name=ip value="<?php echo @$REMOTE_ADDR; ?>"> Like I said before, programs (and even users with a bit of work) can alter hidden fields. So instead of using CODE $ip = $_POST['ip']; or whatever, a better solution might be CODE $ip=@$REMOTE_ADDR; without bothering with the field. If you can't get the correct value or no value use the $_SERVER variable instead, so, if its your case simply change it to: CODE $ip=@$_SERVER['REMOTE_ADDR']; Best regards,
For extra sneakiness you could also capture the IP with Javascript, have it sent vie the form and then check also the address from the HTTP request (i.e. the one you get from PHP. That way you could filter out machines using fake IPs.
Similar Topics
Keywords : Capturing Ip Address Submit
Hey , this tutorial will tell you a very simple way to check if email addresses entered are with the Looking for capturing, ip, address
|
|
![]() Capturing The IP Address During A Form Submit |