www.it-ebooks.info Summary of Contents: Volume I Preface ........................................................................................................ ix 1. PHP Basics .............................................................................................. 1 2. Object Oriented PHP ............................................................................. 23 3. PHP and MySQL ................................................................................... 65 4. Files ..................................................................................................... 111 5. Text Manipulation ............................................................................... 143 6. Dates and Times .................................................................................. 171 7. Images ................................................................................................. 209 8. Email ................................................................................................... 237 9. Web Page Elements.............................................................................. 253 10. Error Handling ................................................................................... 319 A. PHP Configuration .............................................................................. 339 B. Hosting Provider Checklist................................................................... 347 C. Security Checklist ................................................................................ 351 D. Working with PEAR ............................................................................ 355 Index ....................................................................................................... 363 Summary of Contents: Volume II Preface ...................................................................................................... xiii 1. Access Control ......................................................................................... 1 2. XML ...................................................................................................... 79 3. Alternative Content Types ................................................................... 169 4. Stats and Tracking ............................................................................... 221 5. Caching ............................................................................................... 241 6. Development Technique ...................................................................... 269 7. Design Patterns .................................................................................... 311 A. PHP Configuration .............................................................................. 355 B. Hosting Provider Checklist................................................................... 363 C. Security Checklist ................................................................................ 367 D. Working with PEAR ............................................................................ 371 Index ....................................................................................................... 379 www.it-ebooks.info www.it-ebooks.info The PHP Anthology Volume II: Applications by Harry Fuecks www.it-ebooks.info The PHP Anthology, Volume II: Applications by Harry Fuecks Copyright © 2003 SitePoint Pty. Ltd. Editor: Georgina Laidlaw Technical Editor: Kevin Yank Cover Design: Julian Carroll Printing History: First Edition: December 2003 Notice of Rights All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews. Notice of Liability The author and publisher have made every effort to ensure the accuracy of the information herein. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors and SitePoint Pty. Ltd., nor its dealers or distributors will be held liable for any damages to be caused either directly or indirectly by the instructions contained in this book, or by the software or hardware products described herein. Trademark Notice Rather than indicating every occurrence of a trademarked name as such, this book uses the names only in an editorial fashion and to the benefit of the trademark owner with no intention of infringe- ment of the trademark. Published by SitePoint Pty. Ltd. 424 Smith Street Collingwood VIC Australia 3066. Web: www.sitepoint.com Email: [email protected] ISBN 0-9579218-4-5 Printed and bound in the United States of America www.it-ebooks.info About The Author Harry is a technical writer, programmer, and system engineer. He has worked in corporate IT since 1994, having completed a Bachelor’s degree in Physics. He first came across PHP in 1999, while putting together a small Intranet. Today, he’s the lead developer of a corporate Extranet, where PHP plays an important role in delivering a unified platform for numerous back office systems. In his off hours he writes technical articles for SitePoint and runs phpPatterns (http://www.phppatterns.com/), a site exploring PHP application design. Originally from the United Kingdom, he now lives in Switzerland. In May, Harry became the proud father of a beautiful baby girl who keeps him busy all day (and night!) About SitePoint SitePoint specializes in publishing fun, practical and easy-to-understand content for Web Professionals. Visit http://www.sitepoint.com/ to access our books, newsletters, articles and community forums. www.it-ebooks.info www.it-ebooks.info For Natalie and Masha www.it-ebooks.info viii www.it-ebooks.info Table of Contents Preface ................................................................................................... xiii Who should read this book? ...................................................... xiv What’s covered in this book? ..................................................... xiv The Book’s Website.................................................................... xv The Code Archive ............................................................... xv Updates and Errata ............................................................ xvi The SitePoint Forums ................................................................ xvi The SitePoint Newsletters.......................................................... xvi Your Feedback .......................................................................... xvii Acknowledgements ................................................................... xvii 1. Access Control ....................................................................................... 1 How do I use HTTP authentication with PHP? ............................ 3 Heads Up ............................................................................ 3 Not by the Hairs of my Chin… ............................................ 6 How do I authenticate users with sessions? ................................... 8 Session Security ................................................................... 9 Getting Started .................................................................. 11 Authentication in Action .................................................... 21 Room for Improvement ...................................................... 24 How do I build a user registration system?.................................. 25 More Classes!..................................................................... 25 Missing Pieces .................................................................... 36 How do I protect my site from auto sign ups? ............................. 37 Here’s One I Wrote Earlier ................................................. 38 How do I deal with members who forget their passwords?........... 46 Password Reminder ............................................................ 46 New Password.................................................................... 51 How do I let users change their passwords? ................................ 55 How do I build a permissions system? ........................................ 61 How do I store sessions in MySQL? ........................................... 71 How do I track who is online? .................................................... 73 Further Reading ......................................................................... 76 2. XML .................................................................................................... 79 SAX, DOM and PHP ................................................................. 80 Installation Issues .............................................................. 82 About DOM ...................................................................... 83 How do I parse an RSS feed with PHP and SAX? ....................... 85 How do I parse an RSS feed with PHP and DOM? ................... 102 www.it-ebooks.info
Description: