Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I have a PHp solution that uses a login page(authentication.php) to log a user in. If the login is successful, no problem, go to the index page.

If the login is unsuccessful, the page just refreshes. Is there a way to capture what FM returns from a login action?

if( FileMaker::isError( $login_result ) ) {

echo $login_result->getMessage();

}

To be fair though, probably better to just echo out "Username or Password does not match any accounts in our system"

  • Author

Thanks,

but where does $login_result get set? I assume I have to set it from an object that Filemaker returns, but what is that object?

"$login_result" gets set wherever you send the user's login data to Filmaker in authentication.php.

If you're using their credentials to login to create the Filemaker object it's here:


$fm = new FileMaker('myDB', "myServer","user", "pw");





On a successful login the constructor returns a Filemaker object, on an unsuccessful login the constructor returns a Filemaker_Error object.





If you are preforming a find in a users table it's here:





$found_set = $fm->newFindCommand('All');

$found_set->addFindCriterion("user", $_REQUEST['user']);

$found_set->addFindCriterion("pw", $_REQUEST['pw']);

$result = $found_set->execute();





On a successful login $result will contain a FileMaker_Result object.  If it doesn't find the user in the table $result will contain a Filemaker_Error object.





Genx is right you should write your own login error handling message because in the 2 cases above:







echo $fm->getMessage();/*outputs Error: Communication Error: (22) The requested URL returned error: 401*/



echo $result->getMessage(); /*outputs Error: No records match the request*/

  • Author

Thanks guys.

I had planned on writing my own thing. I just wanted to be able to display something, rather than just have the page refresh back to a blank login form - That seems a little vague and not good programming.

I wouldn't recommend that you actually output what FM returns - not useful to the user. Better bet would be output a generic message if the account login failed i.e. "username or password is incorrect" or another message if anything else happens "the database is currently unavailable, please try again later." Then, go ahead and write your error to somewhere useful.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.