وبلاگ بلیان

The PHP Anthology Object Oriented PHP Solutions Volume I

معرفی کتاب «The PHP Anthology Object Oriented PHP Solutions Volume I» نوشتهٔ Harry Fuecks; Kevin Yank; Georgina Laidlaw; Julian Carroll، منتشرشده توسط نشر SitePoint Pty در سال 2003. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «The PHP Anthology Object Oriented PHP Solutions Volume I» در دستهٔ بدون دسته‌بندی قرار دارد.

As a PHP developer, there are certain problems youвЂTMre almost guaranteed to face. Generating charts and graphs, converting HTML documents to PDF format—PHP is equipped to handle all of these, but coming up with the best implementation can be tricky! Now, instead of trawling through message boards and mailing lists for the answer, you can just crack open The PHP Anthology! The PHP Anthology is a complete reference guide for any PHP developer --hobbyist or professional-- to help you write better, faster and more secure code that solves common problems. The author, Harry Fuecks, has compiled over 100 best-practice solutions that any developer will find invaluable when building content management systems, intranets, shopping carts or anything else. The first book in The PHP Anthology will show you how to: - write truly portable code - work with PHPвЂTMs Object Oriented Programming (OOP) features, without a computer science degree - utilize MySQLвЂTMs little-known ''FULLTEXT'' search facility, repair MySQL tables, backup your database and avoid SQL injection attacks - fetch files over a network using PHPвЂTMs FTP features, create zipped archives and gain access to the local file system - validate and filter user submitted content, and avoid cross-site scripting hacks - learn how to produce professional charts and graphs, and create thumbnails and watermark images - send email using PHP, including HTML email with attachments and embedded images - create search engine friendly URLs so your sites can get spidered - create professional error handling routines The PHP Anthology, Volume I: Foundations......Page 1 Summary of Contents (linked)......Page 2 Cover Page Volume I: Foundations......Page 4 Copyright......Page 5 About SitePoint......Page 6 Dedication......Page 8 Table of Contents (linked)......Page 10 Preface......Page 16 What’s covered in this book?......Page 17 The Code Archive......Page 19 The SitePoint Newsletters......Page 20 Acknowledgements......Page 21 1. PHP Basics......Page 22 Reading the Manual......Page 23 Section II: Language Reference......Page 24 Section IV: Function Reference......Page 25 Further Help......Page 28 How do I fix an error that PHP finds in my script?......Page 29 Syntax Errors......Page 30 Environment Errors......Page 31 Logic Errors......Page 32 Mutual Inclusion......Page 33 Path Finding......Page 36 How do I write portable PHP code?......Page 37 Keep All Configuration Central......Page 38 register_globals off......Page 39 Magic Quotes......Page 40 Write Reusable Code......Page 41 Further Reading......Page 43 2. Object Oriented PHP......Page 44 What are the basics of object oriented PHP?......Page 47 Classes and Objects......Page 50 Understanding Scope......Page 55 A Three Liner......Page 56 How do references work in PHP?......Page 60 What Are References?......Page 61 Using a Reference......Page 63 The Importance of References......Page 64 Good and Bad Practices......Page 67 Performance Issues......Page 68 How do I take advantage of inheritance?......Page 69 Overriding......Page 70 Inheritance in Action......Page 73 Aggregation......Page 77 Composition......Page 79 Spotting the Difference......Page 80 Polymorphism......Page 81 Further Reading......Page 84 3. PHP and MySQL......Page 86 How do I access a MySQL database?......Page 87 A Basic Connection......Page 88 Reusable Code......Page 90 How do I fetch data from a table?......Page 94 Fetching with Classes......Page 96 How do I resolve errors in my SQL queries?......Page 99 How do I add or modify data in my database?......Page 100 Updating a Row......Page 101 Another Class Action......Page 102 The Great Escape......Page 104 SQL Injection Attacks......Page 107 How do I create flexible SQL statements?......Page 108 Counting Rows with PHP......Page 110 Counting Rows with MySQL......Page 111 Row Counting with Classes......Page 113 Counting Affected Rows......Page 114 Class Insert ID......Page 115 Select What You LIKE......Page 116 FULLTEXT Searches......Page 117 How do I back up my database?......Page 119 How do I repair a corrupt table?......Page 124 Do I really need to write SQL?......Page 125 Further Reading......Page 129 4. Files......Page 132 How do I read a local file?......Page 133 File Handles......Page 136 Saving Memory......Page 138 How do I modify a local file?......Page 140 How do I get information about a local file?......Page 142 How do I examine directories with PHP?......Page 144 How do I display the PHP source code online?......Page 146 How do I store configuration information in a file?......Page 148 How do I access a file on a remote server?......Page 150 How do I use FTP from PHP?......Page 152 How do I manage file downloads with PHP?......Page 156 File Distribution Strategy......Page 157 How do I create compressed ZIP/TAR files with PHP?......Page 159 Further Reading......Page 162 Dynamic Link URLs......Page 164 Form Fields and HTML Content......Page 166 Line Breaks in HTML......Page 167 Tag Stripping......Page 168 Search and Replace......Page 170 Demolitions......Page 171 Short Back and Sides, Please......Page 172 Formatting......Page 173 How do I implement custom formatting code?......Page 174 How do I implement a bad word filter?......Page 178 How do I validate submitted data?......Page 180 How do I filter out undesirable HTML code?......Page 184 Further Reading......Page 190 6. Dates and Times......Page 192 How do I store dates in MySQL?......Page 193 Unix Timestamps......Page 194 MySQL Timestamps......Page 195 Timestamps in Action......Page 196 How do I solve common date problems?......Page 201 Day of the Week......Page 203 Number of Days in a Month......Page 204 Leap Years......Page 206 Day of the Year......Page 207 First Day in the Month......Page 208 A Touch of Grammar......Page 209 How do I build an online calendar?......Page 211 A Roman Calendar......Page 216 PHP Filofax......Page 219 How do I deal with time zones?......Page 223 How do I time a PHP script?......Page 225 Installing Pseudo-cron......Page 226 Further Reading......Page 228 7. Images......Page 230 MIME Types......Page 231 How do I create thumbnail images?......Page 232 The Thumbnail Class......Page 235 How do I add a watermark to an image?......Page 244 How do I display charts and graphs with PHP?......Page 246 Bar Graph......Page 247 Pie Chart......Page 249 How do I prevent “hot linking” of images?......Page 251 Further Reading......Page 255 8. Email......Page 258 How do I simplify the generation of complex emails?......Page 259 How do I add attachments to messages?......Page 260 How do I send HTML email?......Page 264 How do I mail a group of people?......Page 266 How do I handle incoming mail with PHP?......Page 268 Further Reading......Page 272 9. Web Page Elements......Page 274 PEAR Shaped Tables......Page 276 How do I build a result pager?......Page 280 Sliding Page Numbers......Page 284 How do I handle HTML forms in PHP?......Page 289 Forms in Action with QuickForm......Page 290 QuickForm Validation Rule Types......Page 293 Sign Up Today......Page 295 How do I upload files with PHP?......Page 301 Using QuickForm for File Uploads......Page 304 Hansel and Gretel......Page 309 A Recursive Table Structure......Page 310 Feeding the Birds......Page 314 Staying in Context......Page 318 Drop Down Menu......Page 320 Collapsing Tree Menu......Page 322 Full Tree Menu......Page 324 Handling Different Table Structures......Page 326 Summary......Page 327 Doing Without the Query String......Page 328 Hiding PHP Scripts with ForceType......Page 331 Hiding PHP Scripts by Rewriting URLs......Page 333 Designing URLs......Page 335 Further Reading......Page 338 10. Error Handling......Page 340 Error Levels......Page 341 Generating Errors......Page 345 Strategy for Generating Errors......Page 346 Custom Error Handler......Page 347 Triggered Errors vs. Conditional Execution......Page 350 How do I log and report errors?......Page 352 How do I display errors gracefully?......Page 354 Further Reading......Page 357 Configuration Mechanisms......Page 360 Key Security and Portability Settings......Page 362 Includes and Execution Settings......Page 364 Error-Related Settings......Page 366 Miscellaneous Settings......Page 367 General Issues......Page 368 PHP-Related Issues......Page 370 The Top Security Vulnerabilities......Page 372 Appendix D: Working with PEAR......Page 376 Installing PEAR......Page 377 The PEAR Package Manager......Page 380 Installing Packages Manually......Page 381 Index (only Volume I links work)......Page 384 Back cover......Page 398 Errata at www.sitepoint.com......Page 0 RR......Page 399

A compilation of best practice solutions to common Web Development problems in PHP, focusing on the achievement of practical goals by applying well-structured, object orientated software design principles.

Volume 1 covers the foundations of PHP including writing portable and reusable code, storing and extracting data from files, manipulating text, working with email and error handling.

In addition to being an excellent reference with over 60 customizable solutions, the book acts as an excellent primer for Object Orientated Programming. PHP 5 has now been released and has been given significant OOP features, which are a must-learn for PHP Developers.

All code in the book is backwards compatible with earlier versions of PHP.

A compilation of best practice solutions to common Web development problems. It focuses on the achievement of practical goals with minimal effort by applying well-structured object-oriented software design principles.
دانلود کتاب The PHP Anthology Object Oriented PHP Solutions Volume I