Filemaker Server och PHP

Tråden skapades och har fått 2 svar. Det senaste inlägget skrevs .
1

Jag har noterat detta:

The FileMaker API for PHP is an interface that allows FileMaker information to be accessed via the PHP programming language. The code has been through some pre-beta testing but there is no support from FileMaker.

As an alternative to using the Custom Web Publishing with XML or XSLT, FileMaker API for PHP makes it much easier to:

  • Publish information from a FileMaker database to web sites

  • Store information in FileMaker that is gathered from the Web

  • Create new FileMaker solutions combining a Web-based front-end with a rich, FileMaker back-end

For the PHP User: Comparing FileMaker and SQL Databases
FileMaker combines graphical layouts, scripting, and database functions into one seamless package. SQL databases have power when performing high volumes of transactions, but require separate graphical layout and programming tools. Both types of databases have their uses.

How Does the PHP API Help FileMaker Users?
The PHP programming language is one of the most popular languages for building data-driven web pages. It is popular due to its simple syntax, fast learning curve, open source codebase, and wide-ranging educational resources.

The FileMaker API for PHP makes it easy for FileMaker Server 8 Advanced users to extend their applications to the web. The PHP syntax is procedural and will feel comfortable to learn for those who can create FileMaker scripts.

The FileMaker API for PHP makes it easy to leverage existing FileMaker databases by exposing FileMaker layouts and portals through PHP. The PHP developer has access to the full FileMaker XML interface if needed but in many cases a few PHP API commands will be all that is required.

http://www.filemaker.com/developers/resources/php/index.html

Någon som har testat? Jag förutsätter att det går segt som om man körde på en blå/vit G3:a via seriekabel men det fungerar väl iallafall smärtfritt?

Jag har kikat på detta och kommit fram till att det är åratal efter tex Lasso och det är vansinnigt krångligt att få att fungera och om inte det vore nog är dokumentationen svår att hitta och skriven för tokigt nördiga människor som kan XML som ett rinnande vatten och som lök på laxen saknas kommandon man behöver.

Så för min egen del så håller jag mig borta från detta under en tid.

Ett kodexempel

<?php
// Check if we're already logged in..
if(@$_SESSION['isLoggedIn'] == true)
{
    // Yes! -- Redirect to Homepage.
    header("Location: ./");
    die();
}

require_once "./inc/pusdconfig.php";
require_once "./lib/fmphp/FileMaker.php";

/*
 * Check if user is trying to login..
 *
*/
if(isset($_POST['username']) && isset($_POST['password']))
{
    /*
     * User is trying to login, Verify credentials.
     *
     * Verification is done by trying to find the user record using the username/password submitted by user.
     * This allows FileMaker authentication and verifies that a user record exists (ie. so can't use admin account -- Unless a record exists!)
     * 
     * After Verification is done, the system account/password is used for further queries.
     *
     * 
    */
    $fm = new FileMaker(FMDB_WEB,FMWPE_HOST,$_POST['username'],$_POST['password']);
    
    $findReq =& $fm->newFindCommand("web_applicants");
    $findReq->addFindCriterion("_ka_username","==" . $_POST['username']);
    
    $result = $findReq->execute();
    
    if(FileMaker::isError($result))
    {
        // Login Failed -- Alert User.
        $LoginMessage = "Login Error -- Invalid Username and/or Password. Please try again.<br>FM Message:" . $result->getMessage();
    }
    else
    {
        // Login Success!
        // Setup the session variables and redirect to home page.
        session_start();
        $_SESSION['isLoggedIn'] = true;
        $_SESSION['login_username'] = $_POST['username'];
        
        // cache the record fields..
        $record = $result->getRecords();
        
        $row = $record[key($record)];
        foreach($row->getFields() as $fieldname)
        {
            $_SESSION[$fieldname] = $row->getField($fieldname);
        }
        
        // store the recid 
        $_SESSION['-recid'] = $row->getRecordId();
        
        // Send them back to the homepage "logged in".
        header("Location: ./");
        die();
    }

}
else
{
    /*
     * User has not submitted any credentials, Present a simple welcome message.
    */
    $LoginMessage = "Welcome to PUSD, Please login using your username and password.";
}

// Flag the global $skipCheckLogin so we dont get into another redirect..
$skipCheckLogin = true;
require_once "./inc/header_inc.php";

?>
<center>
<span class='bodyText'><?php echo $LoginMessage; ?></span>
<br><br>
<FORM action='./login.php' method='post'>
<table>
    <tr>
        <td class='messageText'>Username<td><input type='text' name='username' value='<?php echo @$_POST['username']; ?>'>
    <tr>
        <td class='messageText'>Password<td><input type='password' name='password' value=''>
    <tr>
        <td colspan=2 align='right'><input type='submit' value='Login &raquo'>
</table>
</FORM>
</center>
<?php require_once "./inc/footer_inc.php"; ?>

Jag har gjort några smågrejer med det. Funkar helt OK såvitt jag kan se. Jag har inte gjort några prestandatester men det känns som att det inte är en vidare snabb lösning. I det projekt jag jobbat med har det dock varit sekundärt och jag tror också att det i hög grad kan bero på min egen bristande kunskap vad gäller PHP.

1
Bevaka tråden