This page lists the table of contents for MySQL and Perl for the Web.
0 Introduction How This Book is Organized Conventions Other Information Acknowledgments 1 Introduction to MySQL & Perl What You'll Need Software Requirements Hardware and Operating System Requirements Adapting This Book For Other Systems What You Should Know (Reader Requirements!) Audience 2 Getting Connected--Putting Your Database On the Web Required Tools MySQL Configuration Apache Configuration Configuring Apache for CGI Program Execution Apache's Parent-Child Architecture Starting and Stopping Apache Using apachectl Verify that Apache is Serving Pages Writing Perl Scripts Write a Simple Perl Script Verify That You Can Access CGI.pm and DBI Write a Script to Generate a Web Page Write a Script to Access MySQL Write a Script to Access MySQL Over the Web More About Retrieving Data from MySQL Queries That Modify the Database Using Placeholders Modifying Existing Records Specifying MySQL Connection Parameters Using a Library Error Handling and Debugging DBI Error-Processing and Tracing Facilities Monitoring Query Execution A Simple Web-Based Application--To-Do List Maintenance Create the To-Do Table Design an Item Entry Form Display Existing Items Add Item Editing Capabilities Add Item Searching Capabilities Shortcomings of the To-Do Application Adapting the To-Do Application for Other Uses What You've Achieved 3 Improving Performance with mod_perl What mod_perl is and How It Works Should You Use mod_perl? Other Uses for mod_perl Alternatives to mod_perl mod_perl Configuration Create a Directory for mod_perl Scripts Verify That mod_perl is Installed Configure httpd.conf Test Your mod_perl Configuration Set Up a mod_perl Startup File Alternatives to the Startup File Writing mod_perl Scripts 4 Generating and Processing Forms Form Anatomy Beginning and Ending a Form Form Components Form Submission Elements Text Input Elements File Upload Elements Hidden Field Elements Multiple-Choice Elements Recovering Values of Form Elements Displaying Text in Forms Including HTML Markup in Forms URL Encoding URL Shortcuts A Short Form Element Demonstration Form Design Issues 5 Writing Form-Based Applications Product Registration Designing the Form Generating the Form Processing Form Submissions Storing the Registration Record Suggested Modifications Using E-Mail from within Applications Sending E-Mail from Scripts Removing Guestbook Entries Dealing with High Guestbook Traffic Suggested Modifications Other Uses for E-Mail Running a Giveaway Contest Detecting Fraud Designing the Contestant Table Collecting Contest Entries Picking Winning Entries Notifying the Winner Dealing with Old Entries Suggested Modifications Conducting a Poll Suggested Modifications Storing and Retrieving Images Serving Images Suggested Modifications Electronic Greeting Cards--Send a Friend a Greeting Card Storage and Retrieval Utility Routines Card Construction Main Logic Displaying the Card Information Form Presenting the Picture Gallery Sending the Card Retrieving Cards for Display Expiring Old Cards Suggested Modifications 6 Automating the Form-Handling Process Obtaining Database and Table Information Listing Databases and Tables Listing Table Structure Information The SHOW COLUMNS Statement Using SHOW COLUMNS Output To Build Forms Other Ways to Initialize Forms Limitations of Automatic Form Construction Using SHOW COLUMNS Output To Validate Form Submissions Using SHOW COLUMNS Output To Insert or Update Records Inserting New Records Updating Existing Records Generating Form Elements from Lookup Tables and Query Results Using Lookup Tables for Enumerations Using Lookup Tables for Form Generation Using Lookup Tables for Validation Other Ideas for Using Lookup Tables Using Lookup Tables for Sets Automating Poll Processing Closing a Poll Displaying Results of Multiple Polls Suggested Modifications 7 Performing Searches Writing a Form-Based Search Application Setting Up the Database Tables Setting Up the Main Logic Creating the Search Form Interpreting Search Parameters and Constructing the Query Testing Single-Valued Parameters Testing Multiple-Valued Parameters Presenting the Search Results Extending the Search Application Changing the Price Points Giving the User Control Over Sort Order Searching for Keywords in Text Adding Search-by-Age Capability Adding Pictures, Changing the Display Format, and E-Mailing Listings Generating the Summary Table Displaying or E-Mailing Individual Listings Presenting Multiple-Page Search Results Extending the features Column to Include More Items Suggestions for Modification Providing Link-Based Navigation Presenting a Single-Page Directory Presenting a Multiple-Page Directory Suggested Modifications 8 Session Management State Maintenance Techniques Client-Side State Maintenance Server-Side State Maintenance Client Identification Passive Client Identification Methods Active Client Identification Methods Implementing Session Support What to Include in the Session Record The Apache::Session Module Setting Up To Use Apache::Session Opening a Session Accessing Session Data Closing or Terminating a Session The WebDB::Session Module Passing Session IDs in URLs Passing Session IDs in Hidden Fields Passing Session IDs in Cookies Expiring Sessions Adding a Timestamp to Session Records Storing Expiration Values in Session Data Adding an Expiration Column to Session Records Strategies for Using Expiration Dates Storing User Preferences Other Applications for User Profiles Implementing Resumable Sessions Suggested Modifications When Sessions Aren't Enough 9 Security and Privacy Issues Channels of Information Dangers Presented by Remote Users Sources of Client Input Illegitimate Manipulation of Input Data Responding to User Input Detecting Form Tampering Handling User Input Safely for Query Construction File Upload Issues Dangers Presented by Local Users Dangers from Other Users with Apache Access mod_perl in a Shared Environment Limiting Access by Other Users Script Location Issues MySQL Server Access Issues Network Access and Client Privacy Protection The Basis for Secure Web Connections Using Secure Connections A Sample mod_ssl Installation Procedure Configuring Apache for SSL Support Starting Apache with SSL Support Enabled Setting Up Secure MySQL Connections Writing a Secure Application Setting Up the Table Overall Application Flow Preventing Session and Record ID Tampering Main Dispatch Logic Presenting the Login Stage Presenting the Editing Page Confirming the User's Changes Making the Session Secure Suggested Modifications Flotsam and Jetsam 10 E-Commerce Applications The Place of a Database in E-Commerce Should You Use MySQL for E-Commerce? Setting Up a Virtual Storefront Support Routines Configuring Apache to Recognize the Site Presenting Static Library Pages An Online Document Sales Application Setting Up the Tables Presenting the Document Catalog Collecting Billing Information Closing the Order and Delivering the Documents Getting a Credit Authorization Performing Transactions MySQL and DBI Transaction Syntax Requirements for Transaction Support Storing Document Orders Using Transactions Providing the Documents for Download Suggested Modifications Collecting Payment Information Credit Card Processing How Credit Card Transactions Work Collecting Credit Card Information Obtaining Credit Card Authorizations Protecting Credit Card Information Other Payment Options A Cart-Based Sales Application Catalog Presentation Issues Setting Up the Tables Tracking the Customer's Selections Presenting the Shopping Session Presenting the Catalog Interfaces Displaying the Shopping Cart Checking Out Canceling the Order Modifying the Shopping Cart Finishing Up Suggested Modifications Completing the Site Collecting Feedback and Questions Asking Visitors To Rate the Site Suggested Site-Wide Modifications Conclusion