Announcement

Collapse
No announcement yet.

How does a script determine the store's own IP address?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How does a script determine the store's own IP address?

    I know about s.remote_addr; today I need a way for a script to read its own IP address, the one for the server it's running on. Is there a system variable for that?

    Thanks --
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    #2
    s.server_addr
    Appears to be only other "addr" available. I think that is what IP is returned, along with the absolute path if you needed the origin of the script that is running. (A *nix thing).
    What help do you need today!
    Interactive Design Solutions http://www.southbound.com
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    My T-shirt Collection is mostly MivaCon T-shirts!!
    Competitive Rates, Popular Modules, and Integrations:
    Product Copy | AutoBaskets | Waitlist Integration| Wholesale Integration

    Comment


      #3
      s.server_addr would have the site IP. Depending on what you are planning to use it for, you should not operate on the assumption that the value does not change from one request to the next. IF the site in question is dual stacked, meaning IPv4 and IPv6-enabled, the value will change based on the visiting traffic and whether or not it is IPv4 or IPv6. If the site is running on multiple servers with either a CDN or load balancer in front, the value will change based on the web server that handles the request as they'd all have their own independent addressing not seen by the public, but seen by Empresa.
      David Hubbard
      CIO
      Miva
      [email protected]
      http://www.miva.com

      Comment


        #4
        The store in question is one of yours: What server setup are they running? Actually, it won't hurt my module if the address changes from one request to the next; I'm using it for authentication, not session tracking. I do need to know all the possible addresses in advance, so I can enter them into the whitelist setting.

        Thanks for your help --
        Last edited by ILoveHostasaurus; 01-11-18, 02:48 PM.
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment


          #5
          I cut the store out; best to not post dev site addresses in case it ends up crawled (but it is hopefully password protected too per normal setup policy on our side).

          We're slowly rolling IPv6 out to all sites (new sites have been able to use it the past few years), so it will eventually be activated on any given site. If the customer requests it be added, we can add it immediately so you can have the data now rather than worry about it possibly showing up later. Just keep in mind code written against those addr variables should never make the assumption that the value will conform to <number>.<number>.<number>.<number> since an IPv6 address differs, and either one could populate that field. We've run into issues with certain payment modules that try to do IP-based decision making when the value is IPv6.
          David Hubbard
          CIO
          Miva
          [email protected]
          http://www.miva.com

          Comment


            #6
            Yes, the dev store is protected. Thanks for the advice!
            Kent Multer
            Magic Metal Productions
            http://TheMagicM.com
            * Web developer/designer
            * E-commerce and Miva
            * Author, The Official Miva Web Scripting Book -- available on-line:
            http://www.amazon.com/exec/obidos/IS...icmetalproducA

            Comment

            Working...
            X