PHP and MySQL Web Development, Third Edition

Book description

A new edition of this title is available, ISBN-10: 0672329166 ISBN-13: 9780672329166

We've taken the best and made it even better. The third edition of the best-selling PHP and MySQL Web Development has been updated to include material and code on MySQL 5, PHP 5 and on PHPs object model and validation. Through a clear, practical approach, you will learn to develop secure, dynamic websites by integrating and implementing the PHP scripting language and the MySQL database system. Real-world examples and working sample projects will give you a strong foundation on which to start building your own websites, complete with features such as SSL, shopping carts and payment systems. The accompanying CD includes the source code from each example in the book, the entire book in PDF format, and source code and binaries for PHP 5, MySQL 5 and Apache. Readers have called PHP and MySQL Web Development call it the best technical book they've ever read, but don't take their word for it. Find out for yourself!

Table of contents

  1. Copyright
    1. Dedication
  2. Praise for PHP and MySQL Web Development
  3. About the Authors
  4. About the Contributors
  5. Acknowledgments
  6. We Want to Hear from You!
  7. Reader Services
  8. Introduction
    1. Why You Should Read This Book
    2. What You Will Be Able to Achieve Using This Book
    3. What Is PHP?
    4. What Is MySQL?
    5. Why Use PHP and MySQL?
    6. Some of PHP's Strengths
      1. Performance
      2. Database Integration
      3. Built-in Libraries
      4. Cost
      5. Ease of Learning PHP
      6. Object-Oriented Support
      7. Portability
      8. Source Code
      9. Availability of Support
    7. What Is New in PHP 5.0?
    8. Some of MySQL's Strengths
      1. Performance
      2. Low Cost
      3. Ease of Use
      4. Portability
      5. Source Code
      6. Availability of Support
    9. What Is New in MySQL 5.0?
    10. How Is This Book Organized?
    11. Finally
  9. I. Using PHP
    1. 1. PHP Crash Course
      1. Using PHP
      2. Creating a Sample Application: Bob's Auto Parts
        1. Creating the Order Form
        2. Processing the Form
      3. Embedding PHP in HTML
        1. Use of PHP Tags
        2. PHP Tag Styles
        3. PHP Statements
        4. Whitespace
        5. Comments
      4. Adding Dynamic Content
        1. Calling Functions
        2. Using the date() Function
      5. Accessing Form Variables
        1. Form Variables
        2. String Concatenation
        3. Variables and Literals
      6. Understanding Identifiers
      7. Creating User-Declared Variables
      8. Assigning Values to Variables
      9. Examining Variable Types
        1. PHP's Data Types
        2. Type Strength
        3. Type Casting
        4. Variable Variables
      10. Declaring and Using Constants
      11. Understanding Variable Scope
      12. Using Operators
        1. Arithmetic Operators
        2. String Operators
        3. Assignment Operators
          1. Values Returned from Assignment
          2. Combination Assignment Operators
          3. Pre- and Post-Increment and Decrement
          4. References
        4. Comparison Operators
          1. The Equals Operator
          2. Other Comparison Operators
        5. Logical Operators
        6. Bitwise Operators
        7. Other Operators
          1. The Ternary Operator
          2. The Error Suppression Operator
          3. The Execution Operator
          4. Array Operators
          5. The Type Operator
      13. Using Operators: Working Out the Form Totals
      14. Understanding Precedence and Associativity: Evaluating Expressions
      15. Using Variable Functions
        1. Testing and Setting Variable Types
        2. Testing Variable Status
        3. Reinterpreting Variables
      16. Implementing Control Structures
      17. Making Decisions with Conditionals
        1. if Statements
        2. Code Blocks
        3. else Statements
        4. elseif Statements
        5. switch Statements
        6. Comparing the Different Conditionals
      18. Repeating Actions Through Iteration
        1. while Loops
        2. for and foreach Loops
        3. do..while Loops
      19. Breaking Out of a Control Structure or Script
      20. Employing Alternative Control Structure Syntax
      21. Using declare
      22. Next: Saving the Customer's Order
    2. 2. Storing and Retrieving Data
      1. Saving Data for Later
      2. Storing and Retrieving Bob's Orders
      3. Processing Files
      4. Opening a File
        1. Choosing File Modes
        2. Using fopen() to Open a File
        3. Opening Files Through FTP or HTTP
        4. Addressing Problems Opening Files
      5. Writing to a File
        1. Parameters for fwrite()
        2. File Formats
      6. Closing a File
      7. Reading from a File
        1. Opening a File for Reading: fopen()
        2. Knowing When to Stop: feof()
        3. Reading a Line at a Time: fgets(), fgetss(), and fgetcsv()
        4. Reading the Whole File: readfile(), fpassthru(), and file()
        5. Reading a Character: fgetc()
        6. Reading an Arbitrary Length: fread()
      8. Using Other Useful File Functions
        1. Checking Whether a File Is There: file_exists()
        2. Determining How Big a File Is: filesize()
        3. Deleting a File: unlink()
        4. Navigating Inside a File: rewind(), fseek(), and ftell()
      9. Locking Files
      10. Doing It a Better Way: Database Management Systems
        1. Problems with Using Flat Files
        2. How RDBMSs Solve These Problems
      11. Further Reading
      12. Next
    3. 3. Using Arrays
      1. What Is an Array?
      2. Numerically Indexed Arrays
        1. Initializing Numerically Indexed Arrays
        2. Accessing Array Contents
        3. Using Loops to Access the Array
      3. Arrays with Different Indices
        1. Initializing an Array
        2. Accessing the Array Elements
        3. Using Loops
      4. Array Operators
      5. Multidimensional Arrays
      6. Sorting Arrays
        1. Using sort()
        2. Using asort() and ksort() to Sort Arrays
        3. Sorting in Reverse
      7. Sorting Multidimensional Arrays
        1. User-Defined Sorts
        2. Reverse User Sorts
      8. Reordering Arrays
        1. Using shuffle()
        2. Using array_reverse()
      9. Loading Arrays from Files
      10. Performing Other Array Manipulations
        1. Navigating Within an Array: each(), current(), reset(), end(), next(), pos(), and prev()
        2. Applying Any Function to Each Element in an Array: array_walk()
        3. Counting Elements in an Array: count(), sizeof(), and array_count_values()
        4. Converting Arrays to Scalar Variables: extract()
      11. Further Reading
      12. Next
    4. 4. String Manipulation and Regular Expressions
      1. Creating a Sample Application: Smart Form Mail
      2. Formatting Strings
        1. Trimming Strings: chop(), ltrim(), and trim()
        2. Formatting Strings for Presentation
          1. Using HTML Formatting: The nl2br() Function
          2. Formatting a String for Printing
          3. Changing the Case of a String
        3. Formatting Strings for Storage: addslashes() and stripslashes()
      3. Joining and Splitting Strings with String Functions
        1. Using explode(), implode(), and join()
        2. Using strtok()
        3. Using substr()
      4. Comparing Strings
        1. Performing String Ordering: strcmp(), strcasecmp(), and strnatcmp()
        2. Testing String Length with strlen()
      5. Matching and Replacing Substrings with String Functions
        1. Finding Strings in Strings: strstr(), strchr(), strrchr(), and stristr()
        2. Finding the Position of a Substring: strpos() and strrpos()
        3. Replacing Substrings: str_replace() and substr_replace()
      6. Introducing Regular Expressions
        1. The Basics
        2. Character Sets and Classes
        3. Repetition
        4. Subexpressions
        5. Counted Subexpressions
        6. Anchoring to the Beginning or End of a String
        7. Branching
        8. Matching Literal Special Characters
        9. Reviewing the Special Characters
        10. Putting It All Together for the Smart Form
      7. Finding Substrings with Regular Expressions
      8. Replacing Substrings with Regular Expressions
      9. Splitting Strings with Regular Expressions
      10. Comparing String Functions and Regular Expression Functions
      11. Further Reading
      12. Next
    5. 5. Reusing Code and Writing Functions
      1. Reusing Code
        1. Cost
        2. Reliability
        3. Consistency
      2. Using require() and include()
        1. require()
        2. Filename Extensions and require()
        3. PHP Tags and require()
      3. Using require() for Website Templates
        1. Using include()
        2. Using require_once() and include_once()
        3. Using auto_prepend_file and auto_append_file
      4. Using Functions in PHP
        1. Calling Functions
        2. Calling an Undefined Function
        3. Understanding Case and Function Names
      5. Understanding Why You Should Define Your Own Functions
      6. Examining Basic Function Structure
        1. Naming Your Function
      7. Using Parameters
      8. Understanding Scope
      9. Passing by Reference Versus Passing by Value
      10. Returning from Functions
      11. Returning Values from Functions
        1. Code Blocks
      12. Implementing Recursion
      13. Further Reading
      14. Next
    6. 6. Object-Oriented PHP
      1. Understanding Object-Oriented Concepts
        1. Classes and Objects
        2. Polymorphism
        3. Inheritance
      2. Creating Classes, Attributes, and Operations in PHP
        1. Structure of a Class
        2. Constructors
        3. Destructors
      3. Instantiating Classes
      4. Using Class Attributes
      5. Controlling Access with private and public
      6. Calling Class Operations
      7. Implementing Inheritance in PHP
        1. Controlling Visibility Through Inheritance with private and protected
        2. Overriding
        3. Preventing Inheritance and Overriding with final
        4. Understanding Multiple Inheritance
        5. Implementing Interfaces
      8. Designing Classes
      9. Writing the Code for Your Class
      10. Understanding Advanced and New Object-Oriented Functionality in PHP
        1. Note: PHP4 Versus PHP5
        2. Using Per-Class Constants
        3. Implementing Static Methods
        4. Checking Class Type and Type Hinting
        5. Cloning Objects
        6. Using Abstract Classes
        7. Overloading Methods with __call()
        8. Using __autoload()
        9. Implementing Iterators and Iteration
        10. Converting Your Classes to Strings
        11. Using the Reflection API
      11. Next
    7. 7. Exception Handling
      1. Exception Handling Concepts
      2. The Exception Class
      3. User-Defined Exceptions
      4. Exceptions in Bob's Auto Parts
      5. Exceptions and PHP's Other Error Handling Mechanisms
      6. Further Reading
      7. Next
  10. II. Using MySQL
    1. 8. Designing Your Web Database
      1. Relational Database Concepts
        1. Tables
        2. Columns
        3. Rows
        4. Values
        5. Keys
        6. Schemas
        7. Relationships
      2. How to Design Your Web Database
        1. Think About the Real-World Objects You Are Modeling
        2. Avoid Storing Redundant Data
        3. Use Atomic Column Values
        4. Choose Sensible Keys
        5. Think About the Questions You Want to Ask the Database
        6. Avoid Designs with Many Empty Attributes
        7. Summary of Table Types
      3. Web Database Architecture
        1. Architecture
      4. Further Reading
      5. Next
    2. 9. Creating Your Web Database
      1. Using the MySQL Monitor
      2. Logging In to MySQL
      3. Creating Databases and Users
        1. Creating the Database
      4. Setting Up Users and Privileges
      5. Introducing MySQL's Privilege System
        1. Principle of Least Privilege
        2. User Setup: The GRANT Command
        3. Types and Levels of Privileges
        4. The REVOKE Command
        5. Examples Using GRANT and REVOKE
      6. Setting Up a User for the Web
        1. Logging Out as root
      7. Using the Right Database
      8. Creating Database Tables
        1. Understanding What the Other Keywords Mean
        2. Understanding the Column Types
        3. Looking at the Database with SHOW and DESCRIBE
        4. Creating Indexes
        5. A Note on Table Types
      9. Understanding MySQL Identifiers
      10. Choosing Column Data Types
        1. Numeric Types
          1. Date and Time Types
          2. String Types
      11. Further Reading
      12. Next
    3. 10. Working with Your MySQL Database
      1. What Is SQL?
      2. Inserting Data into the Database
      3. Retrieving Data from the Database
        1. Retrieving Data with Specific Criteria
        2. Retrieving Data from Multiple Tables
          1. Simple Two-Table Joins
          2. Joining More Than Two Tables
          3. Finding Rows That Don't Match
          4. Using Other Names for Tables: Aliases
          5. Summary of Joins
        3. Retrieving Data in a Particular Order
        4. Grouping and Aggregating Data
        5. Choosing Which Rows to Return
        6. Using Subqueries
          1. Basic Subqueries
          2. Subqueries and Operators
          3. Correlated Subqueries
          4. Row Subqueries
          5. Using a Subquery as a Temporary Table
      4. Updating Records in the Database
      5. Altering Tables After Creation
      6. Deleting Records from the Database
      7. Dropping Tables
      8. Dropping a Whole Database
      9. Further Reading
      10. Next
    4. 11. Accessing Your MySQL Database from the Web with PHP
      1. How Web Database Architectures Work
      2. Querying a Database from the Web
      3. Checking and Filtering Input Data
      4. Setting Up a Connection
      5. Choosing a Database to Use
      6. Querying the Database
      7. Retrieving the Query Results
      8. Disconnecting from the Database
      9. Putting New Information in the Database
      10. Using Prepared Statements
      11. Using Other PHP-Database Interfaces
      12. Using a Generic Database Interface: PEAR DB
      13. Further Reading
      14. Next
    5. 12. Advanced MySQL Administration
      1. Understanding the Privilege System in Detail
        1. The user Table
        2. The db and host Tables
        3. The tables_priv and columns_priv Tables
        4. Access Control: How MySQL Uses the Grant Tables
        5. Updating Privileges: When Do Changes Take Effect?
      2. Making Your MySQL Database Secure
        1. MySQL from the Operating System's Point of View
        2. Passwords
        3. User Privileges
        4. Web Issues
      3. Getting More Information About Databases
        1. Getting Information with SHOW
        2. Getting Information About Columns with DESCRIBE
        3. Understanding How Queries Work with EXPLAIN
      4. Speeding Up Queries with Indexes
      5. Optimizing Your Database
        1. Design Optimization
        2. Permissions
        3. Table Optimization
        4. Using Indexes
        5. Using Default Values
        6. Other Tips
      6. Backing Up Your MySQL Database
      7. Restoring Your MySQL Database
      8. Implementing Replication
        1. Setting Up the Master
        2. Performing the Initial Data Transfer
        3. Setting Up the Slave or Slaves
      9. Further Reading
      10. Next
    6. 13. Advanced MySQL Programming
      1. The LOAD DATA INFILE Statement
      2. Storage Engines
      3. Transactions
        1. Understanding Transaction Definitions
        2. Using Transactions with InnoDB
      4. Foreign Keys
      5. Stored Procedures
        1. Basic Example
        2. Local Variables
        3. Cursors and Control Structures
      6. Further Reading
      7. Next
  11. III. E-commerce and Security
    1. 14. Running an E-commerce Site
      1. Deciding What You Want to Achieve
      2. Considering the Types of Commercial Websites
        1. Publishing Information Using Online Brochures
          1. Failing to Provide Important Information
          2. Poor Presentation
          3. Failing to Answer Feedback Generated by the Website
          4. Allowing the Site to Age
          5. Failing to Track the Success of the Site
        2. Taking Orders for Goods or Services
          1. Unanswered Questions
          2. Trust
          3. Ease of Use
          4. Compatibility
        3. Providing Services and Digital Goods
        4. Adding Value to Goods or Services
        5. Cutting Costs
      3. Understanding Risks and Threats
        1. Crackers
        2. Failure to Attract Sufficient Business
        3. Computer Hardware Failure
        4. Power, Communication, Network, or Shipping Failures
        5. Extensive Competition
        6. Software Errors
        7. Evolving Governmental Policies and Taxes
        8. System Capacity Limits
      4. Deciding on a Strategy
      5. Next
    2. 15. E-commerce Security Issues
      1. How Important Is Your Information?
      2. Security Threats
        1. Exposure of Confidential Data
        2. Loss or Destruction of Data
        3. Modification of Data
        4. Denial of Service
        5. Errors in Software
          1. Poor Specifications
          2. Assumptions Made by Developers
          3. Poor Testing
        6. Repudiation
      3. Usability, Performance, Cost, and Security
      4. Security Policy Creation
      5. Authentication Principles
      6. Authentication
      7. Encryption Basics
      8. Private Key Encryption
      9. Public Key Encryption
      10. Digital Signatures
      11. Digital Certificates
      12. Secure Web Servers
      13. Auditing and Logging
      14. Firewalls
      15. Data Backups
        1. Backing Up General Files
        2. Backing Up and Restoring Your MySQL Database
      16. Physical Security
      17. Next
    3. 16. Implementing Authentication with PHP and MySQL
      1. Identifying Visitors
      2. Implementing Access Control
        1. Storing Passwords
        2. Encrypting Passwords
        3. Protecting Multiple Pages
      3. Using Basic Authentication
      4. Using Basic Authentication in PHP
      5. Using Basic Authentication with Apache's .htaccess Files
      6. Using Basic Authentication with IIS
      7. Using mod_auth_mysql Authentication
        1. Installing mod_auth_mysql
        2. Did It Work?
        3. Using mod_auth_mysql
      8. Creating Your Own Custom Authentication
      9. Further Reading
      10. Next
    4. 17. Implementing Secure Transactions with PHP and MySQL
      1. Providing Secure Transactions
        1. The User's Machine
        2. The Internet
        3. Your System
      2. Using Secure Sockets Layer (SSL)
      3. Screening User Input
      4. Providing Secure Storage
      5. Determining Whether to Store Credit Card Numbers
      6. Using Encryption in PHP
        1. Installing GPG
        2. Testing GPG
      7. Further Reading
      8. Next
  12. IV. Advanced PHP Techniques
    1. 18. Interacting with the File System and the Server
      1. Uploading Files
        1. HTML for File Upload
        2. A Note on Security
        3. Writing the PHP to Deal with the File
        4. Common Problems
      2. Using Directory Functions
        1. Reading from Directories
        2. Getting Information About the Current Directory
        3. Creating and Deleting Directories
      3. Interacting with the File System
        1. Getting File Information
        2. Changing File Properties
        3. Creating, Deleting, and Moving Files
      4. Using Program Execution Functions
      5. Interacting with the Environment: getenv() and putenv()
      6. Further Reading
      7. Next
    2. 19. Using Network and Protocol Functions
      1. Examining Available Protocols
      2. Sending and Reading Email
      3. Using Other Websites
      4. Using Network Lookup Functions
      5. Using FTP
        1. Using FTP to Back Up or Mirror a File
          1. Connecting to the Remote FTP Server
          2. Logging In to the FTP Server
          3. Checking File Update Times
          4. Downloading the File
          5. Closing the Connection
        2. Uploading Files
        3. Avoiding Timeouts
        4. Using Other FTP Functions
      6. Further Reading
      7. Next
    3. 20. Managing the Date and Time
      1. Getting the Date and Time from PHP
        1. Using the date() Function
        2. Dealing with Unix Timestamps
        3. Using the getdate() Function
        4. Validating Dates
      2. Converting Between PHP and MySQL Date Formats
      3. Calculating Dates in PHP
      4. Calculating Dates in MySQL
      5. Using Microseconds
      6. Using the Calendar Functions
      7. Further Reading
      8. Next
    4. 21. Generating Images
      1. Setting Up Image Support in PHP
      2. Understanding Image Formats
        1. JPEG
        2. PNG
        3. WBMP
        4. GIF
      3. Creating Images
        1. Creating a Canvas Image
        2. Drawing or Printing Text on the Image
        3. Outputting the Final Graphic
        4. Cleaning Up
      4. Using Automatically Generated Images in Other Pages
      5. Using Text and Fonts to Create Images
        1. Setting Up the Base Canvas
        2. Fitting the Text onto the Button
        3. Positioning the Text
        4. Writing the Text onto the Button
        5. Finishing Up
      6. Drawing Figures and Graphing Data
      7. Using Other Image Functions
      8. Further Reading
      9. Next
    5. 22. Using Session Control in PHP
      1. What Session Control Is
      2. Understanding Basic Session Functionality
        1. What Is a Cookie?
        2. Setting Cookies from PHP
        3. Using Cookies with Sessions
        4. Storing the Session ID
      3. Implementing Simple Sessions
        1. Starting a Session
        2. Registering Session Variables
        3. Using Session Variables
        4. Unsetting Variables and Destroying the Session
      4. Creating a Simple Session Example
      5. Configuring Session Control
      6. Implementing Authentication with Session Control
      7. Further Reading
      8. Next
    6. 23. Other Useful Features
      1. Using Magic Quotes
      2. Evaluating Strings: eval()
      3. Terminating Execution: die and exit
      4. Serializing Variables and Objects
      5. Getting Information About the PHP Environment
        1. Finding Out What Extensions Are Loaded
        2. Identifying the Script Owner
        3. Finding Out When the Script Was Modified
      6. Loading Extensions Dynamically
      7. Temporarily Altering the Runtime Environment
      8. Highlighting Source Code
      9. Using PHP on the Command Line
      10. Next
  13. V. Building Practical PHP and MySQL Projects
    1. 24. Using PHP and MySQL for Large Projects
      1. Applying Software Engineering to Web Development
      2. Planning and Running a Web Application Project
      3. Reusing Code
      4. Writing Maintainable Code
        1. Coding Standards
          1. Defining Naming Conventions
          2. Commenting Your Code
          3. Indenting
        2. Breaking Up Code
        3. Using a Standard Directory Structure
        4. Documenting and Sharing In-House Functions
      5. Implementing Version Control
      6. Choosing a Development Environment
      7. Documenting Your Projects
      8. Prototyping
      9. Separating Logic and Content
      10. Optimizing Code
        1. Using Simple Optimizations
        2. Using Zend Products
      11. Testing
      12. Further Reading
      13. Next
    2. 25. Debugging
      1. Programming Errors
        1. Syntax Errors
        2. Runtime Errors
          1. Calls to Functions That Do Not Exist
          2. Reading or Writing Files
          3. Interaction with MySQL or Other Databases
          4. Connections to Network Services
          5. Failure to Check Input Data
        3. Logic Errors
      2. Variable Debugging Aid
      3. Error Reporting Levels
      4. Altering the Error Reporting Settings
      5. Triggering Your Own Errors
      6. Handling Errors Gracefully
      7. Next
    3. 26. Building User Authentication and Personalization
      1. The Problem
      2. Solution Components
        1. User Identification and Personalization
        2. Storing Bookmarks
        3. Recommending Bookmarks
      3. Solution Overview
      4. Implementing the Database
      5. Implementing the Basic Site
      6. Implementing User Authentication
        1. Registering
        2. Logging In
        3. Logging Out
        4. Changing Passwords
        5. Resetting Forgotten Passwords
      7. Implementing Bookmark Storage and Retrieval
        1. Adding Bookmarks
        2. Displaying Bookmarks
        3. Deleting Bookmarks
      8. Implementing Recommendations
      9. Wrapping Up and Considering Possible Extensions
      10. Next
    4. 27. Building a Shopping Cart
      1. The Problem
      2. Solution Components
        1. Building an Online Catalog
        2. Tracking Users' Purchases While They Shop
        3. Implementing a Payment System
        4. Building an Administration Interface
      3. Solution Overview
      4. Implementing the Database
      5. Implementing the Online Catalog
        1. Listing Categories
        2. Listing Books in a Category
        3. Showing Book Details
      6. Implementing the Shopping Cart
        1. Using the show_cart.php Script
        2. Viewing the Cart
        3. Adding Items to the Cart
        4. Saving the Updated Cart
        5. Printing a Header Bar Summary
        6. Checking Out
      7. Implementing Payment
      8. Implementing an Administration Interface
      9. Extending the Project
      10. Using an Existing System
      11. Next
    5. 28. Building a Content Management System
      1. The Problem
      2. Solution Requirements
      3. Existing Systems
      4. Editing Content
        1. Getting Content into the System
          1. FTP/SCP
          2. File Upload Method
          3. Editing Online
        2. Databases Versus File Storage
        3. Document Structure
      5. Using Metadata
      6. Formatting the Output
      7. Solution Design/Overview
      8. Designing the Database
      9. Implementing the CMS
        1. Front End
          1. Image Manipulation
        2. Back End
        3. Searches
        4. Editor Screen
      10. Extending the Project
      11. Next
    6. 29. Building a Web-Based Email Service
      1. The Problem
      2. Solution Components
      3. Solution Overview
      4. Setting Up the Database
      5. Examining the Script Architecture
      6. Logging In and Out
      7. Setting Up Accounts
        1. Creating a New Account
        2. Modifying an Existing Account
        3. Deleting an Account
      8. Reading Mail
        1. Selecting an Account
        2. Viewing Mailbox Contents
        3. Reading a Mail Message
        4. Viewing Message Headers
        5. Deleting Mail
      9. Sending Mail
        1. Sending a New Message
        2. Replying To or Forwarding Mail
      10. Extending the Project
      11. Next
    7. 30. Building a Mailing List Manager
      1. The Problem
      2. Solution Components
        1. Setting Up a Database of Lists and Subscribers
        2. Using File Upload
        3. Sending Mail with Attachments
      3. Solution Overview
      4. Setting Up the Database
      5. Defining the Script Architecture
      6. Implementing Login
        1. Creating a New Account
        2. Logging In
      7. Implementing User Functions
        1. Viewing Lists
        2. Viewing List Information
        3. Viewing List Archives
        4. Subscribing and Unsubscribing
        5. Changing Account Settings
        6. Changing Passwords
        7. Logging Out
      8. Implementing Administrative Functions
        1. Creating a New List
        2. Uploading a New Newsletter
        3. Handling Multiple File Upload
        4. Previewing the Newsletter
        5. Sending the Message
      9. Extending the Project
      10. Next
    8. 31. Building Web Forums
      1. The Problem
      2. Solution Components
      3. Solution Overview
      4. Designing the Database
      5. Viewing the Tree of Articles
        1. Expanding and Collapsing
        2. Displaying the Articles
        3. Using the treenode Class
      6. Viewing Individual Articles
      7. Adding New Articles
      8. Adding Extensions
      9. Using an Existing System
      10. Next
    9. 32. Generating Personalized Documents in Portable Document Format (PDF)
      1. The Problem
        1. Evaluating Document Formats
          1. Paper
          2. ASCII
          3. HTML
          4. Word Processor Formats
          5. Rich Text Format
          6. PostScript
          7. Portable Document Format
      2. Solution Components
        1. Question and Answer System
        2. Document Generation Software
          1. Software to Create RTF Template
          2. Software to Create PDF Template
          3. Software to Create PDF Programmatically
      3. Solution Overview
        1. Asking the Questions
        2. Grading the Answers
        3. Generating an RTF Certificate
        4. Generating a PDF Certificate from a Template
        5. Generating a PDF Document Using PDFlib
        6. A Hello World Script for PDFlib
        7. Generating a Certificate with PDFlib
      4. Handling Problems with Headers
      5. Extending the Project
      6. Further Reading
      7. Next
    10. 33. Connecting to Web Services with XML and SOAP
      1. The Problem
        1. Understanding XML
        2. Understanding Web Services
          1. SOAP
          2. WSDL
      2. Solution Components
        1. Building a Shopping Cart
        2. Using Amazon's Web Services Interfaces
        3. Parsing XML
        4. Using SOAP with PHP
        5. Caching
      3. Solution Overview
        1. Core Application
        2. Showing Books in a Category
        3. Getting an AmazonResultSet Class
        4. Using REST/XML Over HTTP
        5. Using SOAP
        6. Caching the Data
        7. Building the Shopping Cart
        8. Checking Out to Amazon
      4. Installing the Project Code
      5. Extending the Project
      6. Further Reading
  14. VI. Appendixes
    1. A. Installing PHP and MySQL
      1. Running PHP as a CGI Interpreter or Module
      2. Installing Apache, PHP, and MySQL Under Unix
        1. Binary Installation
        2. Source Installation
          1. Installing MySQL
          2. Installing PDFlib
          3. Installing PHP
        3. httpd.conf File: Snippets
        4. Is PHP Support Working?
        5. Is SSL Working?
          1. Final Steps
      3. Installing Apache, PHP, and MySQL Under Windows
        1. Installing MySQL Under Windows
          1. Setting Your PATH
          2. Deleting the Anonymous User
          3. Setting the root Password
        2. Installing Apache Under Windows
        3. Installing PHP for Windows
          1. Adding PHP to Your Apache Configuration
          2. Adding PHP and MySQL to Microsoft IIS and PWS
          3. Testing Your Work
      4. Installing PEAR
      5. Setting Up Other Configurations
    2. B. Web Resources
      1. PHP Resources
      2. MySQL and SQL Specific Resources
      3. Apache Resources
      4. Web Development

Product information

  • Title: PHP and MySQL Web Development, Third Edition
  • Author(s): Luke Welling, Laura Thomson
  • Release date: September 2004
  • Publisher(s): Sams
  • ISBN: 9780672326721