Home > Store

PHP 5 Unleashed

Register your product to gain access to bonus material or receive a coupon.

PHP 5 Unleashed

Book

  • Sorry, this book is no longer in print.
Not for Sale

About

Features

  • Practical, example-rich introduction to Web programming with PHP—Covers all the fundamentals: file system manipulation, strings, arrays, regular expressions, forms, sessions, cookies, and much more.
    • Thoroughly prepares students to create the Web applications that represent PHPs primary area of usage.

  • Detailed introduction to PHP 5 object-oriented programming—Fully reflects PHP 5s major object-oriented improvements.
    • Helps students use the object-oriented techniques that will increasingly dominate PHP programming.

  • Complete section on PHPs e-mail features—Includes full chapters on accessing IMAP mail servers, writing MIME email in PHP, and accessing NNTP news servers.
    • Teaches students how to use PHP to automate a wide range of real-world e-mail tasks for business and other environments.

  • Start-to-finish coverage of data access, including XML-based techniques—Covers everything from basic database access to XML parsing, SOAP, and XSLT.
    • Teaches students how to build powerful Web applications and services that leverage data from virtually any source.

  • Advanced coverage—Contains detailed coverage that experienced PHP programmers have been searching for, including chapters on wireless applications and COM integration.
    • Grows with students to help them accomplish complex leading-edge tasks with PHP.

Description

  • Copyright 2005
  • Dimensions: 7-3/8" x 9-1/8"
  • Pages: 840
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-32511-X
  • ISBN-13: 978-0-672-32511-3

Over 12 million Internet domains worldwide use the PHP language to power their websites. If you are a programmer included in this group, or would like to be one, you should pick up a copy of PHP Unleashed. The definitive guide in PHP programming, PHP Unleashed thoroughly and authoritatively covers the release of PHP 5, as well as advanced topics not found in other books. It begins with a detailed summary of the basics and then quickly moves on to more advanced topics such as working with data, outputting graphical data and building complete applications. Whether you're an experienced programmer and new to PHP, or an experienced PHP programmer but new to PHP 5, this is the one PHP book you need in your library.

Downloads

Downloads

The source code for the examples developed in the book - 91 kb (code.zip)

Sample Content

Table of Contents

Introduction.

    Organization of the Book

I. WORKING WITH PHP FOR GENERAL WEB DEVELOPMENT.

1. Basic PHP Development.

    How PHP Scripts Work

    Basic PHP Syntax

    Basic PHP Data Types

    Variable Manipulation

    Control Structures

      Logical Control Structures

      Repetition Control Structures

      Embedding Control Structures

    User-Defined Functions

    Dynamic Variables and Functions

      Dynamic Variables

      Dynamic Functions

    Multiple File PHP Scripts

    References

      Variable References

      References Used in Functions

    Strings in PHP

      Speed and Efficiency of String Expressions

    Comparing Strings

    Advanced String Comparison

      Comparing Phrases

    Search and Replacement

      Replacing Strings

    Formatting Strings

      Alternatives to printf()

    Strings and Locales

      Formatting Currency Values

    Formatting Date and Time Values

    Summary

2. Arrays.

    Basic Arrays

      Array Syntax

      Working with Arrays

    Implementing Arrays

      Using an Array as a List

      Using Arrays as a Sortable Table

      Using Arrays as a Lookup Table

      Converting from Strings to Arrays and Back

    More Array Materials

3. Regular Expressions.

    The Basics of Regular Expressions

    Limitations of the Basic Syntax

    POSIX Regular Expressions

    Perl-Compatible Regular Expressions (PCRE)

      Named Patterns

    PCRE Modifiers

    A Few Final Words

4. Working with Forms in PHP.

    HTML Forms 101

      How Forms Are Created

      HTML Widgets

    Working with Form Submissions in PHP

      Retrieving Form Values

      Using Arrays as Widget Names

      Handling File Uploads

    Summary

5. Advanced Form Techniques.

    Data Manipulation and Conversion

      Dealing with Magic Quotes

      Data Conversion and Encoding

      Serialization

    Form Data Integrity

      Securing Hidden Elements

      The protect() Function

      The validate() Function

      Putting protect() and validate() into Action

    Form Processing

      Basic Form Processing and Validation

      General-Purpose Form Validation

      Separation of Presentation from Validation

    Summary

6. Persistent Data Using Sessions and Cookies.

    HTTP Cookies

      Cookie Features and Restrictions

      How Cookies Are Implemented

      Implementing Cookies in Your Scripts

    PHP Sessions

      Basic Session Use

      Session Propagation

    Advanced Sessions

      Custom Session Handling

      Customizing Session Support

    Summary

7. Using Templates.

    The What and Why of Templates

      Separating Common Elements from Code

      A (Quick) Template System Example

    The Smarty Template Engine

      Installing Smarty

      Basic Smarty: Variables and Modifiers

      Configuration Files and Functions

    Summary

II. ADVANCED WEB DEVELOPMENT.

8. PEAR.

    What Is PEAR?

      A Code Library

      A Coding Standard

      A System for Distribution and Maintenance

      The PHP Foundation Classes

      The PEAR Package Manager

      A Diverse Community

    Getting and Installing PEAR

      On *NIX Systems

      On Windows Systems

      Through a Web Browser

    Using the PEAR Package Manager

      Listing Packages

      Finding Packages

      Installing and Upgrading Packages

      Uninstalling Packages

      Alternative Installation Methods

    Using the PEAR Website

      Browsing the Package List

      Searching for a Package

      Downloading and Installing a Package

    Using PEAR Packages in Applications

      Setting Up php.ini

      Including the Package

      Using Packages Not Installed Through pear

    Summary

    Reference

      Mailing Lists/Newsgroups

      WWW

      Other

9. XSLT and Other XML Concerns.

    Relating XML to HTML

    Using XSLT to Describe HTML Output Using XML Input

      XSL Stylesheets

      XSLT File Format Basics

      Commonly Used XSLT Instructions

      Using XSLT Instruction Elements with XSLT Patterns

      Sample XML to HTML Transformation Using XSLT

    PHP4 and XSLT Using the DOM XML Module

      Sample Transformation Using PHP4 and DOM XML

      DOM XML Functions and Properties of Note for XSLT Users

      Including XSLT Support in PHP4 via DOM XML

    PHP4 and XSLT Using the XSLT Module

      Sample Transformation Using PHP4 and XSLT

      XSLT Functions and Properties of Note

      Including XSLT Support in PHP4 via XSLT

    PHP5 and XSLT

      Sample Transformation Using PHP5

      PHP5 Functions and Properties of Note for XSLT Users

      Including XSL Support in PHP5

    Accessing XML Data Using SimpleXML

      Using SimpleXML in PHP Scripts

      Additional Notes About SimpleXML in PHP Scripts

    Generating XML Documents Using PHP

      Functions and Properties for Storing XML Objects as Files

    Summary

    References

10. Debugging and Optimizations.

    Debugging Your PHP Scripts

      Syntax-Related Bugs

      Logical Bugs

    Optimizing Your PHP Scripts

      The Secret to Finding Optimizations-Profiling

      Common PHP Bottlenecks and Solutions

    Summary

11. User Authentication.

    Authenticating Users in PHP

      Why?

      Using HTTP Authentication with Apache

      Using HTTP Authentication

      Using PHP Sessions

    Securing PHP Code

      Register_Globals

      Maximum Error

      Trust No One-Especially Not User Data

      Printing User Data

      Working with Files

      Working with Databases

    Summary

12. Data Encryption.

    Shared Secret Versus Public Key

    Shared Secret Algorithms

      Phrase Substitution

      Character Substitution

      Taking It Further

      Stronger Encryption Algorithms

    Public Key Cryptography

      The RSA Algorithm

      Signing Versus Safeguarding

      Man in the Middle

    Using Public Keys in PHP

      SSL Streams

      Generating a Public Key Certificate and Private Key

      Encrypting/Decrypting Data

      Encrypting and Sending Secure Emails Using S/MIME

    Summary

13. Object-Oriented Programming in PHP.

    Why Objects?

    Creating Basic Classes

      Private, Protected, and Public

      Constructors and Destructors

      Class Constants

      Static Methods

      Class Inheritance

    Advanced Classes

      Abstract Classes and Methods

      Interfaces

      Final Classes and Methods

    Special Methods

      Getters and Setters

      The __call() Method

      The __toString() Method

    Class Autoloading

    Object Serialization

    Exceptions

      Understanding the Call Stack

      The Exception Class

      Throwing and Catching Exceptions

    Iterators

    Summary

14. Error Handling.

    The PHP Error-Handling Model

      Error Types

    What to Do About Errors

    The Default Error Handler

    Error Suppression

    Custom Error Handlers

    Causing Errors

    Putting It All Together

    Summary

15. Working with HTML/XHTML Using Tidy.

    Introduction

    Basic Tidy Usage

      Parsing Input and Retrieving Output

      Cleaning and Repairing Documents

      Identifying Problems Within Documents

    Tidy Configuration Options

      Tidy Options at Runtime

      Tidy Configuration Files

    Using the Tidy Parser

      How Documents Are Stored in Tidy

      The Tidy Node

    Applications of Tidy

      Tidy as an Output Buffer

      Converting Documents to CSS

      Reducing Bandwidth Usage

      Beautifying Documents

      Extracting URLs from a Document

    Summary

16. Writing Email in PHP.

    The MIME Protocol

    Implementing MIME Email in PHP

      The MIMEContainer and MIMESubcontainer Classes

      The MIMEAttachment, MIMEContent, and MIMEMessage Classes

    Summary

III. BUILDING APPLICATIONS IN PHP.

17. Using PHP for Console Scripting.

    Core CLI Differences

    Working with PHP CLI

      Command-Line Arguments and Return Codes

    CLI Tools and Extensions

      The Readline Extension

      Creating User Interfaces

    Summary

18. SOAP and PHP.

    What Are Web Services?

      Transport with SOAP

      Description with WSDL

      Directory Lookup with UDDI

    Installation

    Creating Web Services

    Consuming Web Services

    Looking for Web Services

    Summary

19. Building WAP-Enabled Websites.

    What Is WAP?

    System Requirements

      Nokia Mobile Internet Toolkit

      Ericsson WapIDE

      Openwave SDK

      Motorola Wireless IDE/SDK

    Introduction to WML

      WML Structure

      Text

      Links

      Graphics

      WML Forms

    Serving WAP Content

      MIME Types

      Web Server Configuration

      Setting MIME Type from PHP

      Client Detection

      Displaying Graphics

    Sample Applications

      Server-Side Form Data Processing

      WAP Cinema Reservation System

    Summary

IV. I/O, SYSTEM CALLS, AND PHP.

20. Working with the File System.

    Working with Files in PHP

      Reading and Writing Text Files

      Reading and Writing Binary Files

      Working with Directories in PHP

    File Permissions

      How Unix Permissions Work

      Working with Permissions from PHP

    File Access Support Functions

      Logic Functions

      File Manipulation

      Specialized File Access

    Summary

21. Network I/O.

    DNS/Reverse DNS Lookups

      Retrieving the DNS Record by IP

      Retrieving IP Addresses Based on Hostname

      Determining DNS Record Information

    Socket Programming

      Socket Basics

      Creating a New Socket

      Dealing with Socket Errors

      Creating Client Sockets

      Creating Server Sockets

      Working with Multiple Sockets at Once

    Network Helper Functions

    Summary

22. Accessing the Underlying OS from PHP.

    Introduction

    Unix-Specific OS Functionality

      Direct Input and Output (I/O)

      PHP POSIX Functions

      Unix Process Control

    Platform-Independent System Functions

      Executing Applications from PHP

      Basic External Application Execution

      Single-Direction External Command Pipes

      Dealing with the System Environment

    A Brief Note About Security

    Summary

V. WORKING WITH DATA IN PHP.

23. Introduction to Databases.

    Using the MySQL Client

    Basic MySQL Usage

      RDBMS Fundamentals

      Performing Queries Using SQL

    Summary

24. Using MySQL with PHP.

    Performing Queries from PHP

      MySQLi Basics

      Executing Multiple Queries

      Creating a Visitor-Tracking System

      Prepared Statements

      Transactions

    A MySQLi Session Handler

    What Is a Custom Session Handler?

      Defining Your Own Session Handler

      The MySQLi Session Handler

    Summary

25. Using SQLite with PHP.

    What Makes SQLite Unique?

      General Differences Between SQLite and MySQL

      How SQLite Deals with Textual and Numeric Types

      How SQLite Treats NULL Values

      Accessing a Database from Multiple Processes

    Basic SQLite Functionality

      Opening and Closing Databases

      Performing Queries

      Retrieving Results

      Handling Errors

      Navigating Resultsets

    Working with PHP UDFs in SQLite

      Calling PHP Functions in SQL Queries

    Odds and Ends

    Summary

26. PHP's dba Functions.

    Preparations and Settings

    Creating a File-Based Database

    Writing Data

    Reading Data

    Sample Application

    Conclusion

VI. GRAPHICAL OUTPUT WITH PHP.

27. Working with Images.

    Basic Image Creation Using GD

      Retrieving Image information

    Using the PHP/GD Drawing Functions

      Drawing Line-Based Geometric Shapes

      Drawing Curved Surfaces

      Filled Shapes and Image Functions

    Working with Colors and Brushes

      Working with the Image Palette

      Drawing Using Brushes

    Using Fonts and Printing Strings

      Using GD's Internal Fonts

      Using TrueType Fonts

      Using Postscript Type 1

    General Image Manipulation

      Copying One Image to Another

    Other Graphics Functions

      EXIF Functions

    Summary

28. Printable Document Generation.

      A Note Regarding the Examples in This Part

    Generating Dynamic RTF Documents

    Generating Dynamic PDF Documents

      The PDFLib Coordinate System

      Using PDFLib Configuration Parameters

      Generating PDF Documents from Scratch

    Related Resources

VII. APPENDIXES.

Appendix A. Installing PHP5 and MySQL.

    Installing PHP5

      Linux

      Windows

      Mac OS X

    Installing MySQL and PHP Modules

      Linux

      Windows

    Installing PEAR

Appendix B. HTTP Reference.

    What Is HTTP?

    PHP Programming Libraries for HTTP Work

    Understanding an HTTP Transaction

    HTTP Client Methods

    What Comes Back: Server Response Codes

    HTTP Headers

    Encoding

    Identifying Clients and Servers

    The "Referer"

    Fetching Content from an HTTP Source

    Media Types

    Cookies: Preserving State and a Tasty Treat

    Security and Authorization

    Client-Side Caching of HTTP Content

Appendix C. Migrating Applications from PHP4 to PHP5.

    Configuration

    Object-Oriented Programming (OOP)

    New Behavior of Functions

    Further Reading

Appendix D. Good Programming Techniques and Performance Issues.

    Common Style Mistakes

      Configuration Directives

      PHP Is Forgiving, to a Fault

      Reinventing the Wheel

      Variables-Use Them, Don't Abuse Them

    Common Security Concerns

      Unintended Consequences

      System Calls

      Preventing System Call Attacks

      Securing File Uploads

    Style and Security-Logging

      Logging Custom Error Messages

    Summary

Appendix E. Resources and Mailing Lists.

    Relevant Websites

    Mailing Lists and Newsgroups

Index.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020