PHP provides programming language functionality for constructing virtually .....
printable ASCII characters; for example, a-z, A-Z, and 0-9. ... The FileMaker API
for PHP tutorial includes an example showing how to use the setProperty()
method ...
FileMaker Server 11 ®
Custom Web Publishing with PHP
© 2007–2010 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and Bento are trademarks of FileMaker, Inc. registered in the U.S. and other countries. The file folder logo and the Bento logo are trademarks of FileMaker, Inc. FileMaker documentation is copyrighted. You are not authorized to make additional copies or distribute this documentation without written permission from FileMaker. You may use this documentation solely with a valid licensed copy of FileMaker software. All persons, companies, email addresses, and URLs listed in the examples are purely fictitious and any resemblance to existing persons, companies, email addresses, or URLs is purely coincidental. Credits are listed in the Acknowledgements documents provided with this software. Mention of third-party products and URLs is for informational purposes only and constitutes neither an endorsement nor a recommendation. FileMaker, Inc. assumes no responsibility with regard to the performance of these products. For more information, visit our website at www.filemaker.com. Edition: 01
Contents About this guide
7
Chapter 1 Introducing Custom Web Publishing About the Web Publishing Engine How a Web Publishing Engine request is processed Custom Web Publishing with PHP Custom Web Publishing with XML and XSLT Comparing PHP to XML and XSLT Reasons to choose PHP Reasons to choose XML and XSLT
10 10 11 11 12 12 12
Chapter 2 About Custom Web Publishing with PHP Key Features in Custom Web Publishing with PHP Web Publishing Requirements What is required to publish a database using Custom Web Publishing What web users need to access a Custom Web Publishing solution Connecting to the Internet or an intranet Manually installing the FileMaker API for PHP Where to go from here
13 13 13 14 14 15 15
Chapter 3 Preparing databases for Custom Web Publishing Enabling Custom Web Publishing with PHP for databases Creating layouts for Custom Web Publishing with PHP Protecting your published databases Accessing a protected database Publishing the contents of container fields on the web How web users view container field data FileMaker scripts and Custom Web Publishing Script tips and considerations Script behavior in Custom Web Publishing solutions Script triggers and Custom Web Publishing solutions
17 17 18 18 19 20 20 21 22 22
4
FileMaker Server Custom Web Publishing with PHP
Chapter 4 Overview of Custom Web Publishing with PHP How the Web Publishing Engine works with PHP solutions General steps for Custom Web Publishing with PHP Using FileMaker PHP Site Assistant to generate PHP websites Before using PHP Site Assistant Starting PHP Site Assistant Using PHP Site Assistant generated sites
23 23 24 25 25 26
Chapter 5 Using the FileMaker API for PHP Where to get additional information FileMaker API for PHP Reference FileMaker API for PHP Tutorial FileMaker API for PHP Examples Using the FileMaker class FileMaker class objects FileMaker command objects Connecting to a FileMaker database Working with records Creating a record Duplicating a record Editing a record Deleting a record Running FileMaker scripts Obtaining the list of available scripts Running a FileMaker script Running a script before executing a command Running a script before sorting a result set Running a script after the result set is generated Script execution order Working with FileMaker layouts Using portals Listing the portals defined on a specific layout Obtaining portal names for a specific result object Obtaining information about portals for a specific layout Obtaining information for a specific portal Obtaining the table name for a portal Obtaining the portal records for a specific record Creating a new record in a portal Deleting a record from a portal Using value lists Obtaining the names of all value lists for a specific layout Obtaining an array of all value lists for a specific layout
27 27 27 28 28 28 28 29 29 30 30 30 31 31 31 31 31 32 32 32 33 33 33 33 34 34 34 34 34 35 35 35 35
| Obtaining the values for a named value list Performing find requests Using the Find All command Using the Find Any command Using the Find command Using a Compound Find command Processing the records in a result set Filtering portal rows returned by find requests Pre-validating commands, records, and fields Pre-validating records in a command Pre-validating records Pre-validating fields Processing the validation errors Handling errors
Contents
5
35 36 37 37 37 38 40 40 41 42 42 42 43 44
Chapter 6 Staging, testing, and monitoring a site Staging a Custom Web Publishing site Testing a Custom Web Publishing site Monitoring your site Using the web server access and error logs Using the Web Publishing Engine application log Using the Web Server Module error log Using the Web Publishing Core internal access log Troubleshooting your site
45 45 46 46 46 47 47 48
Appendix A Error codes for Custom Web Publishing with PHP Error code numbers for FileMaker databases Error code numbers for PHP components
Index
49 55
6
FileMaker Server Custom Web Publishing with PHP
Preface About this guide This guide assumes you are experienced with PHP, developing websites, and using FileMaker® Pro to create databases. You should understand the basics of FileMaker Pro database design, and should understand the concepts of fields, relationships, layouts, portals, and containers. For information about FileMaker Pro, see FileMaker Pro Help. This guide provides the following information about Custom Web Publishing with PHP on FileMaker Server:
1 what is required to develop a Custom Web Publishing solution using PHP 1 how to publish your databases using PHP 1 what web users need in order to access a Custom Web Publishing solution 1 how to use the FileMaker API for PHP to obtain data from databases hosted by FileMaker Server Important You can download PDFs of FileMaker documentation from www.filemaker.com/documentation. Any updates to this document are also available from the website. The documentation for FileMaker Server includes the following information: For information about
See
Installing and configuring FileMaker Server
FileMaker Server Getting Started Guide FileMaker Server Help
Instant Web Publishing
FileMaker Instant Web Publishing Guide
Custom Web Publishing with PHP
FileMaker Server Custom Web Publishing with PHP (this book)
Using PHP Site Assistant
PHP Site Assistant Help
Custom Web Publishing with XML and XSLT
FileMaker Server Custom Web Publishing with XML and XSLT
Using XSLT Site Assistant
XSLT Site Assistant Help
Installing and configuring ODBC and JDBC drivers, and using ODBJ and JDBC
FileMaker ODBC and JDBC Guide
How FileMaker Server Auto Update can download the FileMaker Guide to Updating Plug-ins most current plug-in to FileMaker Pro database client computers
8
FileMaker Server Custom Web Publishing with PHP
Chapter 1 Introducing Custom Web Publishing With FileMaker Server, you can publish your FileMaker database on the Internet or an intranet in these ways. Instant Web Publishing: With Instant Web Publishing, you can quickly and easily publish your database on the web. You don’t need to modify your database files or install additional software—with compatible web browser software and access to the internet or an intranet, web users can connect to your database to view, edit, sort, or search records, if you give them access privileges. With Instant Web Publishing, the host computer must be running FileMaker Pro or FileMaker Server. The user interface resembles the desktop FileMaker Pro application. The web pages and forms that the web user interacts with are dependent on the layouts and views defined in the FileMaker Pro database. For more information, see FileMaker Instant Web Publishing Guide. Static publishing: If your data rarely changes, or if you don’t want users to have a live connection to your database, you can use static publishing. With static publishing, you export data from a FileMaker Pro database to create a web page that you can further customize with HTML. The web page doesn’t change when information in your database changes, and users don’t connect to your database. (With Instant Web Publishing, data is updated in a web browser window each time the browser sends a request to FileMaker Server.) For more information, see FileMaker Instant Web Publishing Guide. Custom Web Publishing: For more control over the appearance and functionality of your published database, use the Custom Web Publishing technologies available with FileMaker Server. FileMaker Server, which hosts the published databases, does not require FileMaker Pro to be installed or running for Custom Web Publishing to be available. With Custom Web Publishing, you can:
1 Integrate your database with another website 1 Determine how users interact with data 1 Control how data displays in web browsers FileMaker Server provides two Custom Web Publishing technologies:
1 Custom Web Publishing with PHP: Use the FileMaker API for PHP, which provides an object-oriented PHP interface to FileMaker Pro databases, to integrate your FileMaker data into a PHP web application. You can use PHP Site Assistant to generate a complete PHP website, or code PHP web pages yourself.
1 Custom Web Publishing with XML and XSLT: 1 Use XML data publishing to exchange FileMaker data with other websites and applications. 1 Use server-processed XSLT stylesheets to integrate any subset of FileMaker data into other websites, with other middleware, and with custom applications. You can use XSLT Site Assistant to generate XSLT stylesheets, or code the stylesheets yourself.
10
FileMaker Server Custom Web Publishing with PHP
About the Web Publishing Engine To support Instant Web Publishing and Custom Web Publishing, FileMaker Server uses a set of software components called the FileMaker Server Web Publishing Engine. The Web Publishing Engine handles interactions between a web user’s browser, your web server, and FileMaker Server. Custom Web Publishing with XML and XSLT: The Web Publishing Engine functions as an XSLT processor, provides output as HTML, XML, or text (such as vCards) to the web server, which provides the output to the web browser. Web users access your Custom Web Publishing solution by clicking an HREF link or by entering a Uniform Resource Locator (URL) that specifies the web server address and a FileMaker query string request. The URL can access XML data or reference an XSLT stylesheet. The Web Publishing Engine returns the XML data specified in the query string request, or the results of the referenced XSLT stylesheet. Custom Web Publishing with PHP: When a web user accesses your Custom Web Publishing solution, PHP on FileMaker Server connects with the Web Publishing Engine and responds through the FileMaker API for PHP. Using the FileMaker Server Web Publishing Engine for Custom Web Publishing
1
2 Web Server
Web Browser
Products.fp7
Customers.fp7
Web Publishing Engine
Web Server Module
Database Server
FM API and PHP code
6
3
XSLT Stylesheets
5
4
How a Web Publishing Engine request is processed 1. A request is sent from a web browser or application to the web server. 2. The web server routes the request through FileMaker’s Web Server Module to the Web Publishing Engine. 3. The Web Publishing Engine requests data from the database hosted by the Database Server. 4. The FileMaker Server sends the requested FileMaker data to the Web Publishing Engine. 5. The Web Publishing Engine converts the FileMaker data to respond to the request.
1 For PHP requests, the Web Publishing Engine responds to the API request. 1 For XML requests, the Web Publishing Engine sends XML data directly to the web server. 1 For XSLT requests, the Web Publishing Engine uses an XSLT stylesheet to format or transform the XML data, and generates output as HTML pages, an XML document, or text to web server. 6. The web server sends the output to the requesting web browser or program. Important Security is important when you publish data on the web. Review the security guidelines in FileMaker Pro User’s Guide, available as a PDF file from www.filemaker.com/documentation.
Chapter 1
|
Introducing Custom Web Publishing
11
Custom Web Publishing with PHP The FileMaker API for PHP provides an object-oriented PHP interface to FileMaker databases. The FileMaker API for PHP enables both data and logic stored in a FileMaker Pro database to be accessed and published on the web, or exported to other applications. The API also supports complex and compound find commands for extracting and filtering data stored in FileMaker Pro databases. Originally designed as a procedural programming language, PHP has been enhanced as an object-oriented web development language. PHP provides programming language functionality for constructing virtually any type of logic within a site page. For example, you can use conditional logic constructs to control page generation, data routing, or workflow. PHP also provides for site administration and security. In addition, you can use FileMaker PHP Site Assistant to create PHP code that contains all of the necessary prerequisites and functions for properly accessing data in a FileMaker Pro database. PHP Site Assistant generates a multiple-page website that enables web users to search a database, view a list of records, browse records, sort records, add records, edit records, duplicate records, delete records, and view a summary report. FileMaker developers who have little PHP experience can use PHP Site Assistant to generate a complete PHP website. PHP developers who have little experience with FileMaker can use PHP Site Assistant to understand the FileMaker API for PHP objects and methods.
Custom Web Publishing with XML and XSLT FileMaker Custom Web Publishing with XML enables you to send query requests to a FileMaker Pro database hosted by FileMaker Server, and display, modify, or manipulate the resulting data. Using an HTTP request with the appropriate query commands and parameters, you can retrieve FileMaker data as an XML document. You can then export the XML data to other applications, or apply an XSLT stylesheet to the XML data. FileMaker Custom Web Publishing with XSLT lets you transform, filter, or format XML data for web browsers or other applications. You can:
1 use an XSLT stylesheet to transform the data between a FileMaker XML grammar and another XML grammar in other applications or databases.
1 filter the data by controlling which database fields are published by the stylesheet. 1 format how the data is presented in a web page, and control how the web user interacts with the data. The Web Publishing Engine uses your stylesheets to obtain data from a FileMaker database whenever a web user sends an HTTP request and a URL that references one of your XSLT stylesheets. The Web Publishing Engine uses a stylesheet to transform and format the XML data, and generates the resulting HTML page that the web user can work with. In addition, you can use FileMaker XSLT Site Assistant to create basic XSLT stylesheets as a starting point for Custom Web Publishing with XSLT. XSLT Site Assistant generates stylesheets for pages that search the database, browse one record at a time, list the records in the database, sort records, add records, edit records, duplicate records, delete records, and display a summary report.
12
FileMaker Server Custom Web Publishing with PHP
Comparing PHP to XML and XSLT The following sections provide some guidelines for determining the best solution for your site.
Reasons to choose PHP 1 PHP is a more powerful, object-oriented procedural scripting language, but is relatively easy to learn. There are many resources available for training, development, and support.
1 The FileMaker API for PHP enables data and logic stored in a FileMaker Pro database to be accessed and published on the web, or exported to other applications.
1 1 1 1 1
PHP lets you use conditional logic to control page construction or flow. PHP provides programming language functionality for constructing many types of logic on a site page. PHP is one of the most popular web scripting languages. PHP is an open source language, available at http://php.net. PHP enables access to a wide variety of third-party components that you can integrate into your solutions.
Reasons to choose XML and XSLT 1 FileMaker XML request parameter syntax is designed for database interaction, simplifying solution development.
1 XML and XSLT are W3C standards. 1 XML is a machine and human readable format that supports Unicode, enabling data to be communicated in any written language.
1 1 1 1 1
XML is well-suited for presenting records, lists and tree-structured data. XSLT lets you transform XML output into structured text documents such as RSS, RTF, vCard. You can use XSLT to transform XML output from one grammar to another. Templates make it easy to apply conditional formatting to variable data. You can use FMPXMLRESULT based stylesheets for Custom Web Publishing and for XML export from FileMaker Pro databases.
1 FileMaker Server handles FileMaker XSLT stylesheet processing, preventing unauthorized access to data that might be unprotected using client-side XSLT stylesheets. Note For more information about Custom Web Publishing with XSLT, see FileMaker Server Custom Web Publishing with XSLT.
Chapter 2 About Custom Web Publishing with PHP Custom Web Publishing with PHP lets you use the PHP scripting language to integrate data from FileMaker databases with your customized web page layouts. Custom Web Publishing with PHP provides the FileMaker API for PHP, which is a PHP class created by FileMaker that accesses databases hosted by FileMaker Server. This PHP class connects to the FileMaker Server Web Publishing Engine and makes data available to your web server’s PHP engine.
Key Features in Custom Web Publishing with PHP 1 Create web applications that use the Open Source PHP scripting language. Use the FileMaker Server supported version of PHP 5, or use your own version of PHP 5. (If you select to use your own version of PHP, see “Manually installing the FileMaker API for PHP” on page 15.)
1 Host databases on FileMaker Server. FileMaker Pro is not required for Custom Web Publishing because FileMaker Server hosts the databases.
1 Use PHP Site Assistant to create the PHP code for a website that accesses data in a hosted FileMaker database. See “Using FileMaker PHP Site Assistant to generate PHP websites” on page 24..
1 Write PHP code that can create, delete, edit, and duplicate records in a hosted FileMaker database. Your code can perform field and record validation before committing changes back to the hosted database.
1 Write PHP code that accesses layouts, portals, value lists, and related fields. Like FileMaker Pro, access to data, layouts, and fields is based on the user account settings defined in the database’s access privileges. The Web Publishing Engine also supports several other security enhancements. See “Protecting your published databases” on page 18.
1 Write PHP code that executes complex, multi-step scripts. FileMaker supports over 75 script steps in Custom Web Publishing. See “FileMaker scripts and Custom Web Publishing” on page 20.
1 Write PHP code that performs complex find requests.
Web Publishing Requirements This section explains what is required to develop a Custom Web Publishing solution using PHP, what web users need in order to access a Custom Web Publishing solution, and what impact hosting a web publishing solution may have on your server.
What is required to publish a database using Custom Web Publishing To publish databases using Custom Web Publishing with PHP, you need:
1 a FileMaker Server deployment, which includes three components. 1 a web server, either Microsoft IIS (Windows) or Apache (Mac OS). The FileMaker Web Server Module is installed on the web server.
1 the FileMaker Web Publishing Engine 1 the FileMaker Database Server
14
FileMaker Server Custom Web Publishing with PHP
1 PHP installed on the web server. FileMaker Server can install the supported version of PHP 5, or you can use your own version. The minimum required version of PHP on Windows and on Mac OS X v10.5 is PHP 5.2.11. The minimum required version of PHP on Mac OS X v10.6 is PHP 5.3.0. For information about PHP, see http://php.net. The version of PHP installed on the web server must support cURL (client URL library) functions. For information about cURL, see http://php.net/curl. Important When you install the FileMaker Server supported version of PHP 5, it does not show up in the Mac OS X Server Admin tool; it is not supposed to be listed. If you use the Mac OS X Server Admin tool to turn on PHP, you disable the FileMaker Server supported version of PHP 5, and enable your own version of PHP.
1 one or more FileMaker Pro databases hosted by FileMaker Server. 1 the IP address or domain name of the host running the web server 1 a web browser and access to the web server to develop and test your Custom Web Publishing solution For more information, see FileMaker Server Getting Started Guide.
What web users need to access a Custom Web Publishing solution To access a Custom Web Publishing solution that uses PHP, web users need:
1 a web browser 1 access to the Internet or an intranet and the web server 1 the IP address or domain name of the host running the web server If the database is password-protected, web users must also enter a user name and password for a database account.
Connecting to the Internet or an intranet When you publish databases on the Internet or an intranet, the host computer must be running FileMaker Server, and the databases you want to share must be hosted and available. In addition:
1 Publish your database on a computer with a full-time Internet or intranet connection. You can publish databases without a full-time connection, but they are only available to web users when your computer is connected to the Internet or an intranet.
1 The host computer for the web server that is part of the FileMaker Server deployment must have a dedicated static (permanent) IP address or a domain name. If you connect to the Internet with an Internet service provider (ISP), your IP address might be dynamically allocated (it is different each time you connect). A dynamic IP address makes it more difficult for web users to locate your databases. If you are not sure of the type of access available to you, consult your ISP or network administrator.
Chapter 2
|
About Custom Web Publishing with PHP
15
Manually installing the FileMaker API for PHP When you install FileMaker Server, you are given the option to install the FileMaker supported version of PHP (PHP 5). If you already have a PHP engine installed and configured and you want to add only the FileMaker API for PHP, then manually install the FileMaker API for PHP class to make it available to your PHP scripts. If you did not install the FileMaker supported version of PHP, be sure to do the following configuration tasks on your version of the PHP engine:
1 Enable the cURL module in php.ini. 1 Specify the location of the FileMaker API for PHP in the include_path variable in php.ini. 1 If you are accessing databases that contain dates and times, install the pear date package. For more information, see: http://pear.php.net/package/date/ Note FileMaker Server has been tested with PHP version 5.2.11, for Windows and for Mac OS X v10.5, and with PHP version 5.3.0, for Mac OS X v10.6. For best results, use the appropriate version of PHP. To make the FileMaker API for PHP accessible to your PHP scripts When you installed FileMaker Server, the FileMaker API for PHP package was included as a .zip file in the following location:
1 For IIS (Windows): :\Program Files\FileMaker\FileMaker Server\Web Publishing\FM_API_for_PHP_Standalone.zip where is the drive on which the web server component of your FileMaker server deployment resides.
1 For Apache (Mac OS): /Library/FileMaker Server/Web Publishing/FM_API_for_PHP_Standalone.zip The FM_API_for_PHP_Standalone.zip file contains a file called FileMaker.php and a folder called FileMaker. Unzip the file and copy the FileMaker.php file and the FileMaker folder to either of these locations:
1 the web server root folder where your PHP scripts reside. 1 For IIS (Windows): :\Inetpub\wwwroot where is the drive on which the Web Publishing Engine component of your FileMaker server deployment resides.
1 For Apache (Mac OS): /Library/WebServer/Documents 1 one of the include_path directories in your PHP installation. The default location for Mac OS X is /usr/lib/php.
Where to go from here Here are some suggestions to get started developing Custom Web Publishing solutions:
1 Use FileMaker Server Admin Console to enable Custom Web Publishing. See FileMaker Server Help and FileMaker Server Getting Started Guide.
1 In FileMaker Pro, open each FileMaker database that you want to publish and make sure the database has the appropriate extended privilege(s) enabled for Custom Web Publishing. See “Enabling Custom Web Publishing with PHP for databases” on page 17.
1 To learn how to access data in FileMaker databases using the FileMaker API for PHP, see chapter 5, “Using the FileMaker API for PHP.”
16
FileMaker Server Custom Web Publishing with PHP
Chapter 3 Preparing databases for Custom Web Publishing Before you can use Custom Web Publishing with a database, you must prepare the database and protect it from unauthorized access.
Enabling Custom Web Publishing with PHP for databases You must enable Custom Web Publishing with PHP in each database you want to publish. Otherwise, web users cannot use Custom Web Publishing to access the database, even if it is hosted by a FileMaker Server that is configured to support a Web Publishing Engine. To enable Custom Web Publishing for a database: 1. In FileMaker Pro, open the database you want to publish using an account with a Full Access or Manage Extended Privileges privilege set. 2. Assign the fmphp extended privilege to one or more privilege sets to allow Custom Web Publishing with PHP. 3. Assign the privilege set(s) with the Custom Web Publishing extended privilege to the appropriate accounts (for example, the Admin and Guest accounts). Important When defining account names and passwords for Custom Web Publishing solutions, use printable ASCII characters; for example, a-z, A-Z, and 0-9. For more secure account names and passwords, include certain non-alphanumeric characters such as an exclamation point (!) or percent sign (%). Colons (:) are not allowed. For details on setting up accounts, see FileMaker Pro Help. 4. Using the FileMaker Server Admin Console, verify that hosting is properly configured for the database, and that it is accessible to the FileMaker Server. See FileMaker Server Help for instructions. Note Because Custom Web Publishing with PHP does not use persistent database sessions, references to an external ODBC data source in the FileMaker Pro relationships graph may limit the functionality available to your PHP solution. If your database accesses data from an external SQL data source, you may not be able to update the external table’s record data.
Creating layouts for Custom Web Publishing with PHP Custom Web Publishing with PHP does not provide direct table access to data in a FileMaker Pro database, but uses the layouts defined in the databases. While there is no requirement to create a unique layout for Custom Web Publishing with PHP, creating a layout specifically for a PHP solution may be beneficial for several reasons:
1 Improve performance by creating a layout that is limited to the fields, labels, and portals that you need to include in the PHP solution.
1 Simplify your PHP code by doing less data processing because the records have fewer fields. 1 Separate the interface design work from the data so that you can tailor the interface for the web user.
18
FileMaker Server Custom Web Publishing with PHP
Protecting your published databases Custom Web Publishing with PHP enables you to restrict access to your published databases. You can use these methods:
1 Require passwords for database accounts used for Custom Web Publishing with PHP. 1 Enable the Custom Web Publishing with PHP extended privilege only in those privilege sets for which you want to allow access.
1 Disable Custom Web Publishing with PHP for a specific database by deselecting the fmphp extended privilege for all privilege sets in that database. See FileMaker Pro Help.
1 Enable or disable Custom Web Publishing for all Custom Web Publishing solutions in the Web Publishing Engine using FileMaker Server Admin Console. See FileMaker Server Getting Started Guide and FileMaker Server Help.
1 Configure your web server to restrict the IP addresses that can access your databases via the Web Publishing Engine. For example, specify that only web users from the IP address 192.168.100.101 can access your databases. For information on restricting IP addresses, see the documentation for your web server.
1 Use Secure Sockets Layer (SSL) encryption for communications between your web server and web browsers. SSL encryption converts information exchanged between servers and clients into unintelligible information using mathematical formulas known as ciphers. These ciphers are used to transform the information back into understandable data through encryption keys. For information on enabling and configuring SSL, see the documentation for your web server. For more information on securing your database, see the FileMaker Pro User’s Guide, available as a PDF file from www.filemaker.com/documentation.
Accessing a protected database When a web user accesses a database using a PHP solution, the PHP code must provide the credentials to the database using the FileMaker API for PHP. If the Guest account for the database is disabled, or does not have the fmphp extended privilege enabled, the FileMaker API for PHP returns an error and your PHP code must provide login information for the user. The FileMaker API for PHP tutorial includes an example showing how to use the setProperty() method to set the username and password for a protected database. See “FileMaker API for PHP Tutorial” on page 27. PHP Site Assistant supports two options for accessing protected databases:
1 the PHP code can prompt the web user for authentication when accessing site 1 the PHP code can store the database account name and password in site PHP files For more information, see PHP Site Assistant Help. The following list summarizes the process that occurs when using Custom Web Publishing to access a database:
1 If no password has been assigned for a Custom Web Publishing-enabled account, the PHP solution needs to provide the account name only.
1 If the Guest account is disabled, then the PHP solution needs to provide an account name and password. The PHP solution can either prompt the web user for the account name and password, or it can store the account name and password in the PHP code. The account must have the extended privilege fmphp enabled.
Chapter 3
|
Preparing databases for Custom Web Publishing
19
1 If the Guest account is enabled and has the fmphp extended privilege enabled: 1 The PHP solution does not need to prompt web users for an account name and password when opening a file. All web users are automatically logged in with the Guest account and assume the Guest account privileges.
1 The default privilege set for Guest accounts provides “read-only” access. You can change the default privileges, including Extended Privileges, for this account. See FileMaker Pro Help.
1 The PHP solution can use the Re-Login script step to allow users to log in using a different account (for example, to switch from the Guest account to an account with more privileges). See FileMaker Pro Help. However, because PHP connections do not use persistent database sessions, the PHP solution must store the account name and password to use them for each subsequent request. Note By default, web users cannot change their account passwords from a web browser. You can enable this feature for a database using the Change Password script step, which allows web users to change their passwords from browser. See FileMaker Pro Help.
Publishing the contents of container fields on the web The contents of a container field, such as an image file, can either be stored inside a FileMaker database, or stored as a file reference using a relative path. To use container field contents in a PHP solution:
1 Use the correct HTML tags to indicate the type of web-compatible object that is contained in the container field, and create a URL string that represents the file path for the HTML tag’s source attribute