Before you start
This tutorial is for Web application developers investigating the XForms Web form processing technology. This tutorial is the first tutorial and second installment of a six-part series. The login form and account registration forms are developed in this tutorial. First, the tutorial will address some of the basics of XForms development including text entry, password obscuring text entry, and the data structures that are required. Then, the tutorial will cover the processing of the XForms data in PHP and the supporting MySQL database structures. The last part of the login is addressing what happens when a login is successful or unsuccessful. A requirement to being able to log in is having an account. The creation of accounts is made possible through a registration process, which is covered after the login.
The login form is nearly omnipresent throughout the Internet, supporting everything from e-mail access to shopping carts and even online banking. Logging in provides users data customized to their specific account and provides the system a way to control usage. Typical approaches to logging in require the user to enter a username and password that are then authenticated against a database set up prior to the login attempt. This tutorial does not purport to be an example of security in user authentication; instead, it will demonstrate the usage of XForms in the well-known algorithm for logging in and account creation.
Logging in requires the following basic process, and they will be covered in this tutorial:
- Enter a username and password into text entry boxes.
- Send username and password to authentication service.
- Use the given username and account to determine if there is an account with the specified username and password given.
- Store the result (true or false) such that all subsequent activities performed by that user are automatically associated with that authentication.
- Allow the user access if the login succeeded or deny the user access and provide a message to indicate that the username and password could not be found.
The purpose of the series is to demonstrate the use of XForms in the development of realistic Web applications and to instruct the reader in the use of XForms.
- Part 1 is an introduction to the entire series, summarizing all the portions of the end result and what facets of the XForms specification each part covers.
- Part 2 covers logging in and account management.
- Part 3 covers the development of forms pertaining to asset management.
- Part 4 continues the coverage of the development of asset management and reporting of various accounting aspects of a business.
- Part 5 covers liability management and more enhancements.
- Part 6 concludes the series with a summary of the developed tools, and some suggestions for improvement and further work for the tool set.
This tutorial uses a MySQL database for storage and reference. Necessary SQL commands appear throughout the article, but require a working knowledge of MySQL. PHPMyAdmin offers equivalent access to configure the MySQL database and view the entries from a menu-driven graphical interface.
Though the purpose of the series is to educate the reader about the use of XForms, some background knowledge is expected of the reader. There are some very good articles and introductory series concerning XForms available on developerWorks (see Resources). XForms is built on XML, and, hence, a basic understanding of XML is also assumed.
Other technologies and concepts may also be involved, but they will be to a much lesser extent and should be inconsequential to the reader's comprehension of the topic. Some software is also required:
- A browser capable of displaying XForms, such as Firefox 2.0.1.
- A Web server with PHP enabled, such as WAMP
- An SQL server, MySQL, which is part of the WAMP package in this case.