Tài liệu The php anthology volume 2 pdf

412 376 0
Tài liệu The php anthology volume 2 pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

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: business@sitepoint.com 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 [...]... render SVG with PHP? 20 0 SVG Network Clock 20 2 How do I render WML with PHP? 20 5 HAWHAW 20 8 WML, Sessions and Security 21 4 How do I render XUL with PHP? 21 5 Further Reading 22 0 4 Stats and Tracking 22 1 What information can I gather about my site’s visitors? 22 2 IP Addresses 22 4 How do I store visitor statistics with PHP? 22 5 Logging... 22 6 Installing phpOpenTracker 22 8 The phpOpenTracker API 23 1 How do I recognize returning visitors? 23 2 How do I track exit links? 23 4 How do I record search engine queries? 23 6 Installing the phpOpenTracker Search Engine Plug-in 23 6 x www.it-ebooks.info How do I exclude search engines from my logs? 23 7 How do I get reports on my site’s statistics? 23 8 Further... client side caching with PHP? 26 2 Page Expiry 26 3 Page Modification Time 26 4 Further Reading 26 8 6 Development Technique 26 9 How do I optimize my code? 26 9 Most Probable First 27 1 The for Loop 27 4 Don’t Be Greedy 27 5 Lazy Inclusion 27 5 Quotes 27 6 Reference or Copy? 27 6 Xdebug 27 7 How do I structure my... the session It then passes the value to the browser; simultaneously, it creates a file on the server and includes the session ID in the filename There are two methods by which PHP can inform a browser of its session ID: by adding the ID to the query string of all relative links on the page, or by sending it as a cookie Within the file that’s stored on the server, PHP saves the names and values of the. .. Reading 310 7 Design Patterns 311 The Factory Method 313 xi www.it-ebooks.info The PHP Anthology The Iterator Pattern But, What’s the Point? Iterator APIs The Strategy Pattern The Adapter Pattern The Observer Pattern Further Reading 323 326 333 334 3 42 347 353 A PHP Configuration 355 Configuration Mechanisms... description from PHP hacker” to PHP developer.” Who should read this book? This book, The PHP Anthology, Volume II: Applications, builds on the first book, The PHP Anthology, Volume I: Foundations, to provide practical solutions that are commonly required in many of today’s online applications So, if you build Websites and Web applications with PHP, then this book is for you For less experienced PHP developers,... with PHP? Security and Authentication in Web Services Further Reading 111 114 123 127 128 135 138 141 1 42 146 150 157 165 166 3 Alternative Content Types 169 How do I render PDF documents with PHP? 169 PDF To Go… 170 PDF Strategy 176 How do I convert HTML to PDF? 177 Parsing HTML with SAX?!? 177 Laying the Foundations 181 Putting it Together... been told to store for the session When the browser makes a request for another page, it tells PHP which session it was assigned via the URL query string, or by returning the cookie PHP then looks up the file it created when the session was started, and so has access to the data stored within the session [4] http://pear .php. net/AUTH_HTTP 8 www.it-ebooks.info Session Security Once the session has been... 27 7 The Principles of N-Tier 27 8 But What’s the point? 27 9 How do I read API documentation? 28 3 Private, Protected and Public 28 6 Practice Makes Perfect 28 7 How do I generate API documentation? 29 1 Choose your Weapons 29 2 How do I set up automated tests of my code? 29 8 Test Infected 300 Test Drive 300 Mock Objects 306 Further... have been hijacked) To keep the session ID completely hidden, you’ll need to use SSL to encrypt the conversation What’s more, you should only use the cookie method of passing the session ID If you pass it in the URL, you may give away the session ID upon referring the visitor to another site, thanks to the referrer header in the HTTP request K The files PHP creates for the purpose of storing session . gather about my site’s visitors? 22 2 IP Addresses 22 4 How do I store visitor statistics with PHP? 22 5 Logging Strategy 22 6 Installing phpOpenTracker 22 8 The. render WML with PHP? 20 5 HAWHAW 20 8 WML, Sessions and Security 21 4 How do I render XUL with PHP? 21 5 Further Reading 22 0 4. Stats and Tracking 22 1 What information

Ngày đăng: 17/02/2014, 23:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan