ginginca 0 Report post Posted January 4, 2007 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.) Share this post Link to post Share on other sites
bluefish1405241537 0 Report post Posted January 4, 2007 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. $ip=@$REMOTE_ADDR; To add in form:<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$ip = $_POST['ip'];or whatever, a better solution might be$ip=@$REMOTE_ADDR;without bothering with the field. Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted January 7, 2007 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. $ip=@$REMOTE_ADDR; To add in form:<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$ip = $_POST['ip'];or whatever, a better solution might be$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: $ip=@$_SERVER['REMOTE_ADDR'];Best regards, Share this post Link to post Share on other sites
Hercco 0 Report post Posted January 9, 2007 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. Share this post Link to post Share on other sites
iGuest 3 Report post Posted August 16, 2011 Replying to bluefishOk I did alot of looking around and what I found to capture the ip address in a form as to create the html form into a php like it is mentioned above.But I added this to the form and made into a php----------->--in the form.Php then I mde the capture page in php like formsent.Php---------------------------------->$msg .="IP Address: $ip=@[$REMOTE_ADDR]and";I found nothing else on the internet that explaines it this much detail... Enjoy ;-)-reply by Tony Share this post Link to post Share on other sites