4 Replies Latest reply on Feb 14, 2013 3:15 PM by jesperfj

    1) FMSA connection question and 2) can FM accounts be read via PHP

    jesperfj

      FM newbie here just getting my feet wet in the API.

       

      1) With CWP and the API - will I be able to connect a FM server advanced from a .php page running on a different webserver? This webserver is hosted with another company, different from my FMSA host.

       

      2) Can I read the FM user account credentials via PHP? perhaps via the API?

       

      Thanks.

       

      / Jesper

        • 1. Re: 1) FMSA connection question and 2) can FM accounts be read via PHP
          databuzz

          Hi Jesper,

           

          1 - Yes - you can have the PHP pages on a webserver that communicates with FileMaker Server located elsewhere. In your PHP pages you typically have a connection file that you include with all your pages that includes the name of the file and the IP address of the machine running the Web Publishing Engine.

           

          2 - you can use the PHP API to login to a database using FileMaker  Accounts and Password. Not sure what you mean by "read" but you cannot retrieve details about FileMaker Accounts via the API (e.g. get a list of Accounts for file Contacts.fmp12).

           

          HTH,

          Andrew

           

          FileMaker 12/11/10/9/8 Certified Developer

          Databuzz

          - - - - - - - - - - - - - - - - -

          Phone: +61 2 9484 6565

          Mobile: +61 418 468 103

          Email: andrew@databuzz.com.au

          http://www.databuzz.com.au

          • 2. Re: 1) FMSA connection question and 2) can FM accounts be read via PHP
            jesperfj

            Thankyou. Happy to know no. 1 is doable.

             

            My plan was to create a loginpage (in php) as a starting point before letting visitors in to see a number af layouts published using Instant Web Publishing. So was hoping I could make php read the accounts to check whether an entered username/password was among the accounts in the database.

             

            Is the only option instead to maintain a table of webusernames and webpassword separate from the built-in accounts?

            And then validate the entered username/password up against this table instead?

            Is there some online material available that describes how something like this can be done?

             

            Thanks again.

            • 3. Re: 1) FMSA connection question and 2) can FM accounts be read via PHP
              databuzz

              You can have a login form and test to see if it was successful when authenticating with a FileMaker Account Name/Password. Here's some psuedo code that should help:

               

              $fm = new FileMaker($database, $hostname, $username, $password);

               

               

              $layouts = $fm->listLayouts();

                        if(FileMaker::isError($layouts))

                        {

                        // Login Failed -- Alert User.

                        $loginError = '<p class="text-error">Database Login Error: '. $layouts->getMessage(). ' (' . $layouts->code . ')</p>';

               

               

                        } else {

                        // Login Success!

                        // Proceed with login process

                $loginError = '';

               

                        }

              }

               

               

              Have a look at the FileMaker® Server 12 Custom Web Publishing with PHP to start with. There's also a number of books on the PHP API that are useful if you're getting started.

               

              cheers,

              Andrew

               

              FileMaker 12/11/10/9/8 Certified Developer

              Databuzz

              - - - - - - - - - - - - - - - - -

              Phone: +61 2 9484 6565

              Mobile: +61 418 468 103

              Email: andrew@databuzz.com.au

              http://www.databuzz.com.au

              • 4. Re: 1) FMSA connection question and 2) can FM accounts be read via PHP
                jesperfj

                Andrew that looks wonderful. That's a huge help, I'll get to work with that.

                First time here, I'm catapulted forward already. Thanks again! Cheers.

                 

                / Jesper