PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Pb ip merge Tag

  1. Hi,
    I have been using gravity forms on my site for more than an year and always worked fine. I have linked my salesforce with gravity forms so that gravity can populate my leads in salesforce automatically.
    Yesterday I wanted to get more info, I wanted to get the user ip by using a hidden field and using a merge type {ip}. But i never get the good Ip and what is even stranger is that when I look the message I see that I haven't got the good ip and when I look on the right column on the info I see that he has got the right IP.
    Do you know why I have this problem ?
    Regards.

    Posted 12 years ago on Tuesday October 16, 2012 | Permalink
  2. I did just what you said, added a hidden field with the merge tag {ip}. Screenshot: http://minus.com/lGI5hukkTeVBQ

    That was not my experience at all. The notification comes with the correct IP address, the entry lists the correct IP and the entry view in the admin shows the same address on the right and in the entry.

    Can you provide any additional information about the IP addresses you are seeing? Any sort of proxies involved or anything unique about the submissions?

    Can you post a link to the form so we can test it and check the IP address which is recorded in the entry and displayed on the right side?

    Posted 12 years ago on Tuesday October 16, 2012 | Permalink
  3. Hi, thanks for your quick answer
    I have setup a test page :
    And when I fill in the page this is what I get this : http://i.minus.com/iXGM2fa9UcUBA.png
    As you can see I always get the same ip on my hidden field : 10.10.1.185
    Nothing of very unique I use also the gravity plugin for salesforce and I'm testing the info geniuz plugin but get the same results without this plugin.

    This is the link to the test page : http://www.so-xperts.com/test-gravity-forms/

    Thanks for your help.

    Regards.

    Posted 12 years ago on Wednesday October 17, 2012 | Permalink
  4. 10.10.1.85 is in a private/non-routable IP block. This is something specific to your host, like requests to your Gravity Form are always coming through that machine, as a proxy would, which makes it appear that all requests are from that address. The fact that you get the correct IP address in the right sidebar is interesting. So, they must be coming from different places.

    Here is the code from two different files:

    [php]
    // entry_detail.php
    <?php _e("User IP", "gravityforms"); ?>: <?php echo $lead["ip"] ?>
    
    // forms_model.php
    public static function get_ip(){
    	$ip = rgget("HTTP_X_FORWARDED_FOR", $_SERVER);
    	if (!$ip)
    		$ip = rgget("REMOTE_ADDR", $_SERVER);
    
    	$ip_array = explode(",", $ip); //HTTP_X_FORWARDED_FOR can return a comma separated list of IPs. Using the first one.
    	return $ip_array[0];
    }

    Based on that, I think we need to see a dump of the $_SERVER variables to know why a different IP address is being stored in each location. If we can figure out which SERVER variable holds the correct IP address, maybe we can store the correct one in your hidden field.

    Posted 12 years ago on Wednesday October 17, 2012 | Permalink
  5. It was a problem with the ngnix server parameters at the host level it is now working fine. it was sending the local ip of the server.

    Posted 12 years ago on Friday November 9, 2012 | Permalink
  6. David Peralty

    Glad you were able to figure it out.

    Posted 12 years ago on Friday November 9, 2012 | Permalink

This topic has been resolved and has been closed to new replies.