6 Replies Latest reply on Nov 25, 2016 5:26 PM by CarlSchwarz

    Local or remote network

    Jean-Francois

      Hi,

       

      I have a situation that I can't find a solution, I need to find out if user are connected locally on the network or they are connect remotely.

       

      I used a similar calculation is the custom function

      FileMaker Custom Function:UserOnSameNetworkAsServer ( )

       

      As I wronte in the comments, it's not working when the other user's network he's connected to use the same IP range, and 192.168.1 is the most commun of all.

       

      I created a scipt that open scanned JPG/PDF on the network and it open them using openURL, so the user will see the JPG or PDF with is defined apps.

      When I use the FMGo I can easely use device detection and IP range is way different.

       

      So localy I have file://...networkpath/xyz.jpg

      with FMGo I have a Webviewer that connect to our fixed IP address and on the server I have installed a software called HFS that open to the net some folders

      URL in the webviewer user:psw@domain.com:port/folder/xyz.jpg

       

      So that's working fine, unless employee connect to the database with is PC or Laptop at home and have the same IP range as we have at the office.

      the script will think it's local and openurl with file:// command is not working as the network drive is not there.

       

      Setup a VPN for the user to connect as it was local... not in my plans right now.

       

      Any other solution to find if user is local or remote.

       

      Thank you

        • 1. Re: Local or remote network
          Jean-Francois

          Also I noted that FMGo is not working with URL with credential

          http://user:psw@domainurl...

           

          when enter the URL in Safari I have a security warning page (phishing) that I have to accept before and in Chrome it go the the site.

           

          Every day I keep bumping into other details that make it pain in the as... to do something simple and turn it into something complicated.

          • 2. Re: Local or remote network
            CarlSchwarz

            Jean-Francois wrote:

             

            So that's working fine, unless employee connect to the database with is PC or Laptop at home and have the same IP range as we have at the office.

            the script will think it's local and openurl with file:// command is not working as the network drive is not there.

             

            Any other solution to find if user is local or remote.

             

            Thank you

            You just need to get the right IP address.  Run the "Insert from URL" script step on the client to a website like ipchicken.com and grab the IP address from there.  Then you will have the correct external facing IP address, which in your office would be fixed.  If it is not the same IP address as your office then you are remote.

            • 3. Re: Local or remote network
              CarlSchwarz

              Hi just adding don't use IPChicken, use https://api.ipify.org/?format=text  in the insert from url script step.  That returns the data in a simple fixed format.

              1 of 1 people found this helpful
              • 4. Re: Local or remote network
                Jean-Francois

                A BIG thank you, this is perfect, we use a fixed IP in the office that will solve my problem.

                • 5. Re: Local or remote network
                  Jean-Francois

                  I went and try to add this into my solution... once again FM can't have it easy!

                  Insert from URL need to have a field on the layout to insert to, then use it.

                  I can't use it in a "IF" calculation in a script

                  Maybe on the open script set a $$Variable once and use it later on calculation...

                   

                  Since I'm already using ScriptMaster Plugin, there's also a function call GetURLasText

                  I registered the function and I can now use it in a calculation, but I can't run the plugin with FMGo... but since on mobile I always have a mobile IP, that's work fine for me.

                   

                  So this is another alternative, but thank you for pointing in the right direction.

                  • 6. Re: Local or remote network
                    CarlSchwarz

                    Hi, you can create a 'global' field that will hold the IP address.  Your script can go to another layout, fill that field with the result from 'insert from url' and then go back to the layout you were on.  From there you can use the global field in all your calculations.  The user will not see the layout change if you put the 'Freeze Window' script step at the top of the script.