Product Overview

The PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition

Table of Contents

- Here’s a look at the table of contents:

  1. Preface
    • Who Should Read this Book?
    • What’s Covered in this Book?
    • Running the Code Examples
    • The Book’s Web Site
      • The Code Archive
      • Updates and Errata
    • The SitePoint Forums
    • The SitePoint Newsletters
    • Your Feedback
    • Conventions Used in this Book
      • Code Samples
      • Tips, Notes, and Warnings
  2. Introduction
    • Where do I get help?
    • What is OOP?
    • How do I write portable PHP code?
    • Summary
  3. Using Databases with PDO
    • What is PDO?
    • How do I access a database?
    • How do I fetch data from a table?
    • How do I resolve errors in my SQL queries?
    • How do I add data to, or modify data in, my database?
    • How do I protect my web site from an SQL injection attack?
    • How do I create flexible SQL statements?
    • How do I find out how many rows I’ve touched?
    • How do I find out a new INSERT’s row number in an autoincrementing field?
    • How do I search my table?
    • How do I work with transactions?
    • How do I use stored procedures with PDO?
    • How do I back up my database?
    • Summary
  4. Strings
    • How do I output strings safely?
    • How do I preserve formatting?
    • How do I strip HTML tags from text?
    • How do I force text to wrap after a certain number of characters?
    • How do I perform advanced search and replace operations?
    • How do I break up text into an array of lines?
    • How do I trim whitespace from text?
    • How do I output formatted text?
    • How do I validate submitted data?
    • Summary
  5. Dates and Times
    • How do I use Unix timestamps?
    • How do I obtain the current date?
    • How do I find a day of the week?
    • How do I find the number of days in a month?
    • How do I create a calendar?
    • How do I store dates in MySQL?
    • How do I format MySQL timestamps?
    • How do I perform date calculations using MySQL?
    • Summary
  6. Forms, Tables, and Pretty URLs
    • How do I build HTML forms with PHP?
    • How do I display data in a table?
    • How do I display data in a sortable table?
    • How do I create a customized data grid?
    • How do I make “pretty” URLs in PHP?
    • Summary
  7. Working with Files
    • How do I read a local file?
    • How do I use file handles?
    • How do I modify a local file?
    • How do I access information about a local file?
    • How do I examine directories with PHP?
    • How do I display PHP source code online?
    • How do I store configuration information in a file?
    • How do I access a file on a remote server?
    • How do I use FTP from PHP?
    • How do I manage file downloads with PHP?
    • How do I create compressed ZIP/TAR files with PHP?
    • How do I work with files using the Standard PHP Library in PHP 5?
    • Summary
  8. Email
    • How do I send a simple email?
    • How do I simplify the generation of complex emails?
    • How do I add attachments to messages?
    • How do I send HTML email?
    • How do I mail a message to a group of people?
    • How do I handle incoming mail with PHP?
    • How can I protect my site against email injection attacks?
    • Summary
  9. Images
    • How do I specify the correct image MIME type?
    • How do I create thumbnail images?
    • How do I resize images without stretching them?
    • How can I put together a simple thumbnail gallery?
    • How do I extract EXIF information from images?
    • How do I add a watermark to an image?
    • How do I display charts and graphs with PHP?
    • How do I prevent the hotlinking of images?
    • How do I create images that can be verified by humans only?
    • Summary
  10. Error Handling
    • What error levels does PHP report?
    • What built-in settings does PHP offer for error handling?
    • How can I trigger PHP errors?
    • How do I implement a custom error handler with PHP?
    • How do I log and report errors?
    • How can I use PHP exceptions for error handling?
    • How do I create a custom Exception class?
    • How do I implement a custom exception handler with PHP?
    • How can I handle PHP errors as if they were exceptions?
    • How do I display errors and exceptions gracefully?
    • How do I redirect users to another page following an error condition?
    • Summary
  11. Access Control
    • How do I use HTTP authentication?
    • How do I use sessions?
    • How do I create a session class?
    • How do I create a class to control access to a section of the site?
    • How do I build a registration system?
    • How do I deal with members who forget their passwords?
    • How do I let users change their passwords?
    • How to do I build a permissions system?
    • How do I store sessions in a database?
    • Summary
  12. Caching
    • How do I prevent web browsers from caching a page?
    • How do I control client-side caching?
    • How do I examine HTTP headers in my browser?
    • How do I cache file downloads with Internet Explorer?
    • How do I use output buffering for server-side caching?
    • How do I cache just the parts of a page that change infrequently?
    • How do I use PEAR::Cache_Lite for server-side caching?
    • What configuration options does Cache_Lite support?
    • How do I purge the Cache_Lite cache?
    • How do I cache function calls?
    • Summary
  13. XML and Web Services
    • Which XML technologies are available in PHP 5?
    • Why should I use PHP’s XML extensions instead of PHP string functions?
    • How do I parse an RSS feed?
    • How do I generate an RSS feed?
    • How do I search for a node or content in XML?
    • How can I consume XML-RPC web services?
    • How do I serve my own XML-RPC web services?
    • How can I consume SOAP web services?
    • How do I serve SOAP web services?
    • How can I consume REST services?
    • How can I serve REST services?
    • Summary
  14. Best Practices
    • How do I track revisions to my project’s code?
    • How can I maintain multiple versions of a single codebase?
    • How can I write distributable code?
    • How can I document my code for later reference by myself or others?
    • How can I ensure future changes to my code won’t break current functionality?
    • How can I determine what remains to be tested?
    • I’ve reviewed some of my old code, and it’s horrible. How can I make it better?
    • How can I deploy code safely?
    • Summary

Appendix

  1. PHP Configuration
    • Configuration Mechanisms
    • Key Security and Portability Settings
    • Includes and Execution Settings
    • Error-related Settings
    • Miscellaneous Settings
  2. Hosting Provider Checklist
    • General Issues
      • Does the host support Linux and Apache?
      • Does the host provide you with SSH access to the server?
      • Is the host a reseller, or does it maintain servers itself?
      • To what degree does the host “overload” the server?
      • What’s the hosting provider’s policy on running scripts and programs from the command line?
      • Does the host provide you access to cron, the Unix utility that allows you to schedule batch jobs?
    • PHP-related Issues
      • Can you see the output of phpinfo on the server you will actually be assigned to?
      • Is PHP installed as an Apache module (not the CGI variant)?
      • Is the Apache settingAllowOverride set to Options or All?
      • Is PHP Safe Mode disabled?
      • Check the upgrade policy of your host.
      • Ask for a list of installed PHP extensions.
      • Will PHP be available for use from the command line?
      • What’s the host’s knowledge of PHP?
    • Security Checklist
      • Top Security Vulnerabilities
        • Cross-site Scripting (XSS)
        • Injection Flaws
        • Malicious File Execution
        • Insecure Direct Object Reference
        • Cross-site Request Forgery (CSRF)
        • Information Leakage and Improper Error Handling
        • Broken Authentication and Session Management
        • Insecure Cryptographic Storage
        • Insecure Communications
        • Failure to Restrict URL Access
      • Working with PEAR
        • Installing PEAR
        • The PEAR Package Manager
        • Installing Packages Manually
        • Alternatives to PEAR
      • Index

 



ebook only

Instant Download!
This title available in Adobe PDF, Kindle (mobi) and ePub (IOS) formats

SitePoint Books

  • advocate best practice techniques
  • lead you through practical examples
  • provide working code for your web site
  • make learning easy and fun

100% Money Back Guarantee