Introduction |
|
1 | (1) |
|
Who Should Read This Book? |
|
|
1 | (1) |
|
How This Book Is Organized |
|
|
2 | (1) |
|
About the Book's Source Code |
|
|
3 | (1) |
|
Conventions Used in This Book |
|
|
3 | (4) |
|
Part I: Getting Up and Running |
|
|
|
Installation QuickStart Guide |
|
|
7 | (14) |
|
|
7 | (3) |
|
|
10 | (6) |
|
|
16 | (4) |
|
|
20 | (1) |
|
Installing and Configuring MySQL |
|
|
21 | (22) |
|
Current and Future Versions of MySQL |
|
|
21 | (1) |
|
|
22 | (1) |
|
Installing MySQL on Linux/UNIX |
|
|
22 | (2) |
|
Installing MySQL on Mac OS X |
|
|
24 | (2) |
|
Installing MySQL on Windows |
|
|
26 | (6) |
|
Troubleshooting Your Installation |
|
|
32 | (1) |
|
Basic Security Guidelines |
|
|
33 | (2) |
|
Introducing the MySQL Privilege System |
|
|
35 | (2) |
|
Working with User Privileges |
|
|
37 | (2) |
|
|
39 | (1) |
|
|
40 | (1) |
|
|
40 | (3) |
|
Installing and Configuring Apache |
|
|
43 | (22) |
|
Current and Future Versions of Apache |
|
|
43 | (1) |
|
Choosing the Appropriate Installation Method |
|
|
44 | (1) |
|
Installing Apache on Linux/UNIX |
|
|
45 | (2) |
|
Installing Apache on Mac OS X |
|
|
47 | (1) |
|
Installing Apache on Windows |
|
|
48 | (2) |
|
Apache Configuration File Structure |
|
|
50 | (6) |
|
|
56 | (1) |
|
|
57 | (1) |
|
Starting Apache for the First Time |
|
|
58 | (2) |
|
|
60 | (2) |
|
|
62 | (1) |
|
|
62 | (1) |
|
|
63 | (2) |
|
Installing and Configuring PHP |
|
|
65 | (22) |
|
Current and Future Versions of PHP |
|
|
65 | (1) |
|
Building PHP on Linux/UNIX with Apache |
|
|
66 | (3) |
|
Installing PHP on Mac OS X |
|
|
69 | (2) |
|
Installing PHP on Windows |
|
|
71 | (2) |
|
|
73 | (1) |
|
Testing Your Installation |
|
|
74 | (1) |
|
Getting Installation Help |
|
|
74 | (2) |
|
The Basics of PHP Scripts |
|
|
76 | (5) |
|
|
81 | (1) |
|
|
81 | (1) |
|
|
82 | (5) |
|
Part II: PHP Language Structure |
|
|
|
The Building Blocks of PHP |
|
|
87 | (24) |
|
|
87 | (3) |
|
|
90 | (6) |
|
Operators and Expressions |
|
|
96 | (9) |
|
|
105 | (2) |
|
|
107 | (1) |
|
|
107 | (1) |
|
|
108 | (3) |
|
Flow Control Functions in PHP |
|
|
111 | (20) |
|
|
111 | (6) |
|
|
117 | (8) |
|
Code Blocks and Browser Output |
|
|
125 | (2) |
|
|
127 | (1) |
|
|
128 | (1) |
|
|
128 | (3) |
|
|
131 | (18) |
|
|
131 | (1) |
|
|
132 | (1) |
|
|
133 | (3) |
|
Returning Values from User-Defined Functions |
|
|
136 | (1) |
|
|
137 | (3) |
|
Saving State Between Function Calls with the Static Statement |
|
|
140 | (2) |
|
|
142 | (3) |
|
Testing for the Existence of a Function |
|
|
145 | (1) |
|
|
146 | (1) |
|
|
147 | (1) |
|
|
147 | (2) |
|
|
149 | (10) |
|
|
149 | (1) |
|
|
150 | (4) |
|
Some Array-Related Functions |
|
|
154 | (2) |
|
|
156 | (1) |
|
|
156 | (1) |
|
|
156 | (3) |
|
|
159 | (12) |
|
|
159 | (5) |
|
|
164 | (2) |
|
|
166 | (1) |
|
|
166 | (1) |
|
|
167 | (4) |
|
Part III: Getting Involved with the Code |
|
|
|
Working with Strings, Dates, and Time |
|
|
171 | (30) |
|
Formatting Strings with PHP |
|
|
172 | (8) |
|
Investigating Strings in PHP |
|
|
180 | (4) |
|
Manipulating Strings with PHP |
|
|
184 | (7) |
|
Using Date and Time Functions in PHP |
|
|
191 | (6) |
|
Other String, Date, and Time Functions |
|
|
197 | (1) |
|
|
197 | (1) |
|
|
198 | (3) |
|
|
201 | (22) |
|
Creating a Simple Input Form |
|
|
201 | (2) |
|
Accessing Form Input with User-Defined Arrays |
|
|
203 | (3) |
|
Combining HTML and PHP Code on a Single Page |
|
|
206 | (2) |
|
Using Hidden Fields to Save State |
|
|
208 | (1) |
|
|
209 | (2) |
|
Sending Mail on Form Submission |
|
|
211 | (6) |
|
Working with File Uploads |
|
|
217 | (4) |
|
|
221 | (1) |
|
|
221 | (2) |
|
Working with Cookies and User Sessions |
|
|
223 | (16) |
|
|
223 | (2) |
|
Setting a Cookie with PHP |
|
|
225 | (2) |
|
Deleting a Cookie with PHP |
|
|
227 | (1) |
|
Session Function Overview |
|
|
227 | (1) |
|
|
228 | (1) |
|
Working with Session Variables |
|
|
229 | (4) |
|
Passing Session IDs in the Query String |
|
|
233 | (1) |
|
Destroying Sessions and Unsetting Variables |
|
|
234 | (1) |
|
Using Sessions in an Environment with Registered Users |
|
|
234 | (1) |
|
|
235 | (1) |
|
|
236 | (1) |
|
|
236 | (3) |
|
Working with Files and Directories |
|
|
239 | (30) |
|
Including Files with include() |
|
|
239 | (5) |
|
|
244 | (4) |
|
Creating and Deleting Files |
|
|
248 | (1) |
|
Opening a File for Writing, Reading, or Appending |
|
|
249 | (1) |
|
|
250 | (5) |
|
Writing or Appending to a File |
|
|
255 | (2) |
|
|
257 | (3) |
|
Opening Pipes to and from Processes Using popen() |
|
|
260 | (2) |
|
Running Commands with exec() |
|
|
262 | (1) |
|
Running Commands with system() or passthru() |
|
|
263 | (2) |
|
|
265 | (1) |
|
|
266 | (1) |
|
|
266 | (3) |
|
|
269 | (24) |
|
Understanding the Image-Creation Process |
|
|
269 | (1) |
|
Necessary Modifications to PHP |
|
|
270 | (1) |
|
|
271 | (4) |
|
Getting Fancy with Pie Charts |
|
|
275 | (4) |
|
Modifying Existing Images |
|
|
279 | (3) |
|
Image Creation from User Input |
|
|
282 | (4) |
|
Using Images Created by Scripts |
|
|
286 | (2) |
|
|
288 | (1) |
|
|
289 | (1) |
|
|
289 | (4) |
|
Part IV: PHP and MySQL Integration |
|
|
|
Understanding the Database Design Process |
|
|
293 | (12) |
|
The Importance of Good Database Design |
|
|
293 | (1) |
|
Types of Table Relationships |
|
|
294 | (4) |
|
Understanding Normalization |
|
|
298 | (3) |
|
Following the Design Process |
|
|
301 | (2) |
|
|
303 | (1) |
|
|
303 | (1) |
|
|
303 | (2) |
|
Learning Basic SQL Commands |
|
|
305 | (48) |
|
Learning the MySQL Data Types |
|
|
306 | (3) |
|
Learning the Table Creation Syntax |
|
|
309 | (1) |
|
|
310 | (2) |
|
|
312 | (3) |
|
Using WHERE in Your Queries |
|
|
315 | (2) |
|
Selecting from Multiple Tables |
|
|
317 | (6) |
|
Using the UPDATE Command to Modify Records |
|
|
323 | (2) |
|
Using the REPLACE Command |
|
|
325 | (1) |
|
|
326 | (2) |
|
Frequently Used String Functions in MySQL |
|
|
328 | (8) |
|
Using Date and Time Functions in MySQL |
|
|
336 | (12) |
|
|
348 | (1) |
|
|
349 | (1) |
|
|
350 | (3) |
|
Using Transactions and Stored Procedures in MySQL |
|
|
353 | (8) |
|
|
353 | (4) |
|
What Are Stored Procedures? |
|
|
357 | (2) |
|
|
359 | (1) |
|
|
359 | (1) |
|
|
359 | (2) |
|
Interacting with MySQL Using PHP |
|
|
361 | (14) |
|
MySQL Versus MySQLi Functions |
|
|
361 | (1) |
|
Connecting to MySQL with PHP |
|
|
361 | (4) |
|
|
365 | (6) |
|
|
371 | (1) |
|
|
372 | (1) |
|
|
372 | (3) |
|
|
|
Managing a Simple Mailing List |
|
|
375 | (14) |
|
Developing the Subscription Mechanism |
|
|
375 | (8) |
|
Developing the Mailing Mechanism |
|
|
383 | (3) |
|
|
386 | (1) |
|
|
387 | (1) |
|
|
387 | (2) |
|
Creating an Online Address Book |
|
|
389 | (26) |
|
Planning and Creating the Database Tables |
|
|
389 | (3) |
|
Creating an Include File for Common Functions |
|
|
392 | (1) |
|
|
393 | (1) |
|
Creating the Record Addition Mechanism |
|
|
394 | (4) |
|
|
398 | (7) |
|
Creating the Record Deletion Mechanism |
|
|
405 | (2) |
|
Adding Subentries to a Record |
|
|
407 | (5) |
|
|
412 | (1) |
|
|
413 | (1) |
|
|
413 | (2) |
|
Creating a Simple Discussion Forum |
|
|
415 | (18) |
|
Designing the Database Tables |
|
|
415 | (1) |
|
Creating an Include File for Common Functions |
|
|
416 | (1) |
|
Creating the Input Forms and Scripts |
|
|
417 | (4) |
|
Displaying the Topic List |
|
|
421 | (3) |
|
Displaying the Posts in a Topic |
|
|
424 | (4) |
|
|
428 | (3) |
|
|
431 | (1) |
|
|
431 | (1) |
|
|
432 | (1) |
|
Creating an Online Storefront |
|
|
433 | (12) |
|
Planning and Creating the Database Tables |
|
|
433 | (4) |
|
Displaying Categories of Items |
|
|
437 | (4) |
|
|
441 | (3) |
|
|
444 | (1) |
|
|
444 | (1) |
|
Creating a Shopping Cart Mechanism |
|
|
445 | (14) |
|
Planning and Creating the Database Tables |
|
|
445 | (2) |
|
Integrating the Cart with Your Storefront |
|
|
447 | (8) |
|
Payment Methods and the Checkout Sequence |
|
|
455 | (2) |
|
|
457 | (1) |
|
|
458 | (1) |
|
Creating a Simple Calendar |
|
|
459 | (22) |
|
Building a Simple Display Calendar |
|
|
459 | (14) |
|
Creating a Calendar Library |
|
|
473 | (6) |
|
|
479 | (1) |
|
|
479 | (1) |
|
|
480 | (1) |
|
Restricting Access to Your Applications |
|
|
481 | (20) |
|
|
481 | (2) |
|
Apache Authentication Module Functionality |
|
|
483 | (5) |
|
Using Apache for Access Control |
|
|
488 | (2) |
|
Combining Apache Access Methods |
|
|
490 | (1) |
|
Limiting Access Based on HTTP Methods |
|
|
491 | (1) |
|
Restricting Access Based on Cookie Values |
|
|
492 | (5) |
|
|
497 | (1) |
|
|
498 | (1) |
|
|
498 | (3) |
|
Logging and Monitoring Web Server Activity |
|
|
501 | (16) |
|
Standard Apache Access Logging |
|
|
501 | (6) |
|
Standard Apache Error Logging |
|
|
507 | (2) |
|
|
509 | (2) |
|
Logging Custom Information to a Database |
|
|
511 | (4) |
|
|
515 | (1) |
|
|
516 | (1) |
|
|
516 | (1) |
|
|
517 | (12) |
|
About Internationalization and Localization |
|
|
517 | (1) |
|
|
518 | (1) |
|
Environment Modifications |
|
|
519 | (2) |
|
Creating a Localized Page Structure |
|
|
521 | (5) |
|
|
526 | (1) |
|
|
526 | (1) |
|
|
527 | (2) |
|
|
529 | (14) |
|
|
529 | (3) |
|
Accessing XML in PHP Using DOM Functions |
|
|
532 | (3) |
|
Accessing XML in PHP Using SimpleXML Functions |
|
|
535 | (3) |
|
|
538 | (1) |
|
|
538 | (1) |
|
|
539 | (4) |
|
Part VI: Administration and Fine-Tuning |
|
|
|
Apache Performance Tuning and Virtual Hosting |
|
|
543 | (18) |
|
|
543 | (4) |
|
Load Testing with ApacheBench |
|
|
547 | (2) |
|
Proactive Performance Tuning |
|
|
549 | (2) |
|
|
551 | (1) |
|
Implementing Virtual Hosting |
|
|
552 | (5) |
|
|
557 | (1) |
|
|
557 | (1) |
|
|
558 | (3) |
|
Setting Up a Secure Web Server |
|
|
561 | (14) |
|
|
561 | (1) |
|
|
562 | (5) |
|
Obtaining and Installing SSL Tools |
|
|
567 | (3) |
|
|
570 | (2) |
|
|
572 | (1) |
|
|
573 | (1) |
|
|
574 | (1) |
|
|
574 | (1) |
|
Optimizing and Tuning MySQL |
|
|
575 | (16) |
|
Building an Optimized Platform |
|
|
575 | (2) |
|
|
577 | (2) |
|
Optimizing Your Table Structure |
|
|
579 | (1) |
|
|
580 | (1) |
|
|
581 | (1) |
|
|
582 | (6) |
|
|
588 | (1) |
|
|
589 | (1) |
|
|
589 | (2) |
|
|
591 | (6) |
|
|
591 | (2) |
|
|
593 | (1) |
|
|
593 | (2) |
|
|
595 | (1) |
|
|
595 | (1) |
|
|
596 | (1) |
Index |
|
597 | |