Harry Fuecks9780957921856, 0-9579218-5-3
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’s Object Oriented Programming (OOP) features, without a computer science degree
– utilize MySQL’s little-known “FULLTEXT” search facility, repair MySQL tables, backup your database and avoid SQL injection attacks
– fetch files over a network using PHP’s 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
Table of contents :
Cover……Page 1
Summary of Contents……Page 3
The PHP Anthology, Volume I……Page 5
Preface……Page 17
What’s covered in this book?……Page 18
The Code Archive……Page 20
The SitePoint Newsletters……Page 21
Acknowledgements……Page 22
1. PHP Basics……Page 23
Reading the Manual……Page 24
Section II: Language Reference……Page 25
Section IV: Function Reference……Page 26
Further Help……Page 29
How do I fix an error that PHP finds in my script?……Page 30
Syntax Errors……Page 31
Environment Errors……Page 32
Logic Errors……Page 33
Mutual Inclusion……Page 34
Path Finding……Page 37
How do I write portable PHP code?……Page 38
Keep All Configuration Central……Page 39
register_globals off……Page 40
Magic Quotes……Page 41
Write Reusable Code……Page 42
Further Reading……Page 44
2. Object Oriented PHP……Page 45
What are the basics of object oriented PHP?……Page 48
Classes and Objects……Page 51
Understanding Scope……Page 56
A Three Liner……Page 57
How do references work in PHP?……Page 61
What Are References?……Page 62
Using a Reference……Page 64
The Importance of References……Page 65
Good and Bad Practices……Page 68
Performance Issues……Page 69
How do I take advantage of inheritance?……Page 70
Overriding……Page 71
Inheritance in Action……Page 74
Aggregation……Page 78
Composition……Page 80
Spotting the Difference……Page 81
Polymorphism……Page 82
Further Reading……Page 85
3. PHP and MySQL……Page 87
How do I access a MySQL database?……Page 88
A Basic Connection……Page 89
Reusable Code……Page 91
How do I fetch data from a table?……Page 95
Fetching with Classes……Page 97
How do I resolve errors in my SQL queries?……Page 100
How do I add or modify data in my database?……Page 101
Updating a Row……Page 102
Another Class Action……Page 103
The Great Escape……Page 105
SQL Injection Attacks……Page 108
How do I create flexible SQL statements?……Page 109
Counting Rows with PHP……Page 111
Counting Rows with MySQL……Page 112
Row Counting with Classes……Page 114
Counting Affected Rows……Page 115
Class Insert ID……Page 116
Select What You LIKE……Page 117
FULLTEXT Searches……Page 118
How do I back up my database?……Page 120
How do I repair a corrupt table?……Page 125
Do I really need to write SQL?……Page 126
Further Reading……Page 130
Configuration Mechanisms……Page 133
Key Security and Portability Settings……Page 135
Includes and Execution Settings……Page 137
Error-Related Settings……Page 139
Miscellaneous Settings……Page 140
General Issues……Page 141
PHP-Related Issues……Page 143
The Top Security Vulnerabilities……Page 145
Appendix D: Working with PEAR……Page 149
Installing PEAR……Page 150
The PEAR Package Manager……Page 153
Installing Packages Manually……Page 154
Index……Page 157
What’s Next?……Page 171
Reviews
There are no reviews yet.