11 Replies Latest reply on Aug 8, 2016 10:54 PM by paolobkk

    Check if LAN or Internet before running script

    paolobkk

      Hi everyone,

       

      We are using FMPA11 on multiple platforms and the files are on FMS11 on a MacMini Server (OSX Server Snow Leopard).

      I want to allow users to run certain scripts ONLY if they are sitting on a local computer (same IP range as the FM server) and only if connected by a cable - NOT WIFI.

       

      These scripts are complex and they run for a long period of time (around 10-15 minutes, copying inventory data from one table to another).

       

      The FM database is available remotely by our fix IP address.

      By experience I saw that if they run from remote location (Internet) or even local WIFI there is a chance that the client disconnect from the server during the script and screw things up.

       

      I already informed the users to sit on a local cable connected computer to make these processes but I'd like to add extra security and don't give them the chance to "try" wrong things.

       

      Any suggestion is highly appreciated.

       

      All the best!

        • 2. Re: Check if LAN or Internet before running script
          David Moyer

          if your LAN users have static IP addresses*, you can create a User table, by IP, containing a flag indicating whether or not they are wired connections.  Then use the aforementioned Get(SystemIPAddress) to access that table.

           

          * - My experience is that dynamic IP addresses persist for months at a time (so does it really matter?).

          • 3. Re: Check if LAN or Internet before running script
            taylorsharpe

            You might think of a bigger picture.  First, FM 11 isn't supported anymore.  But if you upgrade to the current FMS, you can use Perform Script on Server and not worry which machine it is on because the script will be run on the server with optimal speed.  Just something to think about. 

            1 of 1 people found this helpful
            • 4. Re: Check if LAN or Internet before running script
              paolobkk

              Thank you for all the suggestions.

              taylorsharpe upgrading is not an option for the company. Beside the cost of all the licenses to buy, we already are in the process to move to OpenBravo system in 1 year.

               

              johanhedman Get(SystemIPAddress) seems a good idea if it can be used in the proper way.

               

              I may be able to assign an IP range to the WIFI access points and prepare some script steps to run the process only if the IP of the machine matches the given local IP range (the range assigned to be on cable).

               

              But I may also need to get another reference to make sure that the machine is physically present in the same location of the server.

              Perhaps Get(HostIPAddress) can be a second reference. Any thoughts?

              • 5. Re: Check if LAN or Internet before running script
                Johan Hedman

                Get(HostIPAddress) will only give you your FileMaker Server IP-adress, not the computer that access it.

                • 6. Re: Check if LAN or Internet before running script
                  paolobkk

                  johanhedman yes. I'm thinking to use Get(HostIPAddress) together with Get(SystemIPAddress).

                   

                  For example, if I can define the cable connected computers to have a local IP range between 192.168.1.5 and 192.168.1.100, and the FM Server is on local IP 192.168.1.2, I'm thinking at something like this:

                   

                  IF

                  ((Get(SystemIPAddress) > 192.168.1.4) and (Get(SystemIPAddress) < 192.168.1.101))

                  AND

                  ((Get(HostIPAddress) = 192.168.1.2)

                  RUN SCRIPT

                  END IF

                   

                  In this way the first line (Get(SystemIPAddress) will check that the IP of the computer accessing FM server is in the range of LAN cable connected computers (no WIFI). The second line (Get(HostIPAddress) will assure that the host IP is the local one and not the public fixed IP (remote).

                   

                  I'm a bit puzzled about using the operators with IP addresses (<,>,=), not sure if my example has the right syntax.

                  • 7. Re: Check if LAN or Internet before running script
                    taylorsharpe

                    Note that the Get ( SystemIPAddress ) can often return a value list with multiple entries.  This can be due to multiple ethernet cards or the WiFi having a different IP, or just different IPs for LAN and WAN connections.  So you may have to loop through and test multiple IP's with this function. 

                    • 8. Re: Check if LAN or Internet before running script
                      Johan Hedman

                      IP number is not a number. You got to check that the first three instances are the same and then take out the last part and check for higher and lower

                       

                       

                       

                       

                      Johan Hedman

                      Atatiki AB

                       

                      3 aug. 2016 kl. 04:43 skrev paolobkk <paolobkk@gmail.com>:

                       

                      Du har blivit omnämnd

                      av paolobkk i Re: Check if LAN or Internet before running script i FileMaker Community - Visa paolobkks referens till dig

                       

                      johanhedman yes. I'm thinking to use Get(HostIPAddress) together with Get(SystemIPAddress).

                       

                       

                       

                      For example, if I can define the cable connected computers to have in an IP range between 192.168.1.5 and 192.168.1.100, and the FM Server is on local IP 192.168.1.2, I'm thinking at something like this:

                       

                       

                       

                      IF

                       

                      ((Get(SystemIPAddress) > 192.168.1.4) and (Get(SystemIPAddress) < 192.168.1.101))

                       

                      AND

                       

                      ((Get(HostIPAddress) = 192.168.1.2)

                       

                      RUN SCRIPT

                       

                      END IF

                       

                       

                       

                      In this way the first line (Get(SystemIPAddress) will check that the IP of the computer accessing FM server is in the range of LAN cable connected computers (no WIFI). The second line (Get(HostIPAddress) will assure that the host IP is the local one and not the public fixed IP (remote).

                       

                       

                       

                      I'm a bit puzzled about using the operators with IP addresses (<,>,=), not sure if my example has the right syntax.

                       

                       

                       

                      Delta i konversationen genom att svara på detta e-post

                       

                      Manage your email preferences

                       

                      FileMaker Developer Conference 2016 • Las Vegas, Nevada • July 18-21 • www.filemaker.com/devcon

                       

                      • 9. Re: Check if LAN or Internet before running script
                        Markus Schneider

                        upgrade from 11 to 15 could be a bit risky - if a company has a specific ci with a specific font, there is the risk that this font won't print (pdf..) anymore under FM15, causing to change the ci, if that font isn't available in an other format. Those costs will beat the costs of licencies by far... happened here 2 weeks ago (beside of the fact that chances are good that a customer has to buy new hardware as well when currently running Snow)

                         

                        That said, running Snow could become problematic when websites refuse to load because of too old browsers... (at least when running safari)

                        • 10. Re: Check if LAN or Internet before running script
                          CICT

                          We created a Windows XP tablet (fold back Dell laptops) based questionnaire system for a UK based hospital years ago and used Get (SystemIPAddress) to identify whether the tablet was linked to the network (and therefore FileMaker Server), where the database performed one way, or not connected and in a consult room, where it behaved another.

                           

                          Providing you can make the wireless IP range identifiable or use another IP range, then this method will work fine. Our system is only now being replaced by an NHS internal system after 12 years use.

                           

                          I believe Johan has answered your question regarding the operators, but to clarify:

                          Let ( [

                            ip = Get ( SystemIPAddress) ;

                            pos = Position ( ip ; "." ; 1 ; 3 )

                          ] ;

                            Right ( ip ; Length ( ip ) - pos )

                          )

                           

                          to identify the actual address with the class c address. If you're going to use another range, you could use PatternCount.

                           

                           

                          Regards

                          Andy

                          • 11. Re: Check if LAN or Internet before running script
                            paolobkk

                            Thank you all for the great support.

                             

                            I'm managing to create a different IP range for the wireless access point and try out this system.

                             

                            Cheers!