December 11, 200916 yr Hi all, I have been creating a php script that would get a username and password, then authenticate against filemaker by running a command and check to see if an error is return. My code is below: $errorcode =""; $errorcheck =""; require_once('Filemaker.php'); require_once('FileMaker/server_data.php'); $lcc = new FileMaker('lcc_applications_.fp7', $serverIP, $_POST['name'], $_POST['pwd']); $record = $lcc->listLayouts(); if(FileMaker::isError($record)) { $errormsg = " Incorrect username or password"; $errorcheck = $errorcheck."1"; } else { $errorcheck = $errorcheck."0"; } if($errorcheck=="0" && empty($errorcode)) { echo " "; echo "you are log in successfully"; die(); } The code seem to be pretty simple but the "FileMaker::isError($record)" always return true for some reason with correct or incrorrect username and password. Does anybody know why this code does not work? Any help would be appreciated. Thanks, Kevin Dang.
January 4, 201016 yr I've not tried authentication in this manor, I've just kept a set of records in the database for username/passwords (with the password encrypted by the sha1 function)... I'd try declaring the username/passwords as a variable prior to the $lcc statement: $username = $_POST['username']; $password = $_POST['pwd']; $lcc = new FileMaker('lcc_applications_.fp7', $serverIP, $username, $password); It may also be worth putting in a echo FileMaker::isError($record); statement in prior to the if statement to see what is coming out?
January 14, 201016 yr You should probably take a look at the error being returned... $errorcode =""; $errorcheck =""; require_once('Filemaker.php'); require_once('FileMaker/server_data.php'); $lcc = new FileMaker('lcc_applications_.fp7', $serverIP, $_POST['name'], $_POST['pwd']); $record = $lcc->listLayouts(); if(FileMaker::isError($record)) { echo $record->getCode()." ".$record->getMessage()." "; $errormsg = ""; $errorcheck = $errorcheck."1"; } else { $errorcheck = $errorcheck."0"; } if($errorcheck=="0" && empty($errorcode)) { echo " "; echo "you are log in successfully"; die();
Create an account or sign in to comment