Introduction |
|
xiii | |
|
The FAQS of Life---The Scripts Every PHP Programmer Wants (Or Needs) to Know |
|
|
1 | (18) |
|
Including Another File as a Part of Your Script |
|
|
2 | (2) |
|
|
3 | (1) |
|
Highlighting Alternate Row Colors in a Table |
|
|
4 | (3) |
|
|
5 | (2) |
|
Creating Previous/Next Links |
|
|
7 | (4) |
|
|
10 | (1) |
|
Printing the Contents of an Array |
|
|
11 | (1) |
|
Turning an Array into a Nonarray Variable That Can Be Restored Later |
|
|
12 | (1) |
|
|
12 | (1) |
|
Sorting Multidimensional Arrays |
|
|
13 | (1) |
|
|
14 | (1) |
|
Templating Your Site with Smarty |
|
|
14 | (5) |
|
|
14 | (1) |
|
|
15 | (1) |
|
|
16 | (1) |
|
|
17 | (2) |
|
|
19 | (14) |
|
Configuration Settings and the php.ini File |
|
|
20 | (1) |
|
Locating Your php.ini File |
|
|
20 | (1) |
|
Revealing All of PHP's Settings |
|
|
21 | (1) |
|
Reading an Individual Setting |
|
|
21 | (1) |
|
|
22 | (2) |
|
|
23 | (1) |
|
Suppressing All Error Messages |
|
|
24 | (1) |
|
Extending the Run Time of a Script |
|
|
24 | (1) |
|
|
25 | (1) |
|
Preventing Users from Uploading Large Files |
|
|
25 | (1) |
|
Turning Off Registered Global Variables |
|
|
25 | (1) |
|
|
26 | (1) |
|
|
26 | (1) |
|
Restricting the Files that PHP Can Access |
|
|
26 | (1) |
|
|
27 | (1) |
|
Shutting Down Specific Functions |
|
|
27 | (1) |
|
|
27 | (6) |
|
|
28 | (1) |
|
Installing Extensions with a Web-Based Control Panel |
|
|
29 | (3) |
|
|
32 | (1) |
|
|
33 | (12) |
|
Recommended Security Configuration Options |
|
|
35 | (1) |
|
|
35 | (2) |
|
Preventing Basic XSS Attacks |
|
|
37 | (1) |
|
|
38 | (2) |
|
|
39 | (1) |
|
Protecting Data with a One-Way Hash |
|
|
40 | (1) |
|
|
41 | (1) |
|
Encrypting Data with Mcrypt |
|
|
41 | (2) |
|
|
43 | (1) |
|
Generating Random Passwords |
|
|
43 | (2) |
|
|
44 | (1) |
|
|
45 | (14) |
|
Security Measures: Forms Are Not Trustworthy |
|
|
45 | (1) |
|
|
46 | (1) |
|
Using $_POST, $_GET, $_REQUEST, and $_FILES to Access Form Data |
|
|
47 | (1) |
|
Fetching Form Variables Consistently and Safely |
|
|
47 | (1) |
|
Trimming Excess Whitespace |
|
|
47 | (1) |
|
Importing Form Variables into an Array |
|
|
48 | (3) |
|
Making Sure a Response Is One of a Set of Given Values |
|
|
51 | (1) |
|
|
51 | (1) |
|
Using Multiple Submit Buttons |
|
|
52 | (1) |
|
|
52 | (3) |
|
|
54 | (1) |
|
|
55 | (1) |
|
Double-Checking a Credit Card's Expiration Date |
|
|
55 | (1) |
|
|
56 | (1) |
|
Checking Valid Email Addresses |
|
|
56 | (1) |
|
Checking American Phone Numbers |
|
|
57 | (2) |
|
Working with Text and HTML |
|
|
59 | (22) |
|
Extracting Part of a String |
|
|
59 | (3) |
|
|
61 | (1) |
|
Making a String Uppercase, Lowercase, or Capitalized |
|
|
62 | (1) |
|
|
62 | (1) |
|
|
63 | (1) |
|
|
64 | (1) |
|
|
64 | (1) |
|
|
65 | (1) |
|
Finding and Fixing Misspelled Words with pspell |
|
|
65 | (4) |
|
Working with the Default Dictionary |
|
|
66 | (2) |
|
Adding a Custom Dictionary to pspell |
|
|
68 | (1) |
|
|
69 | (1) |
|
|
69 | (6) |
|
Regular Expression Basics |
|
|
69 | (1) |
|
Special Character Sequences |
|
|
70 | (1) |
|
|
71 | (1) |
|
|
71 | (1) |
|
|
71 | (1) |
|
|
72 | (1) |
|
Matching and Extracting with Regular Expressions |
|
|
72 | (2) |
|
Replacing Substrings with Regular Expressions |
|
|
74 | (1) |
|
|
75 | (1) |
|
Creating a Screen Scraper |
|
|
75 | (2) |
|
|
77 | (1) |
|
Converting Plaintext into HTML-Ready Markup |
|
|
77 | (3) |
|
Automatically Hyperlinking URLs |
|
|
80 | (1) |
|
Stripping HTML Tags from Strings |
|
|
80 | (1) |
|
|
81 | (10) |
|
|
81 | (1) |
|
Getting the Current Timestamp |
|
|
82 | (1) |
|
Getting the Timestamp of a Date in the Past or Future |
|
|
83 | (2) |
|
Creating Timestamps from a String |
|
|
83 | (1) |
|
Creating Timestamps from Date Values |
|
|
84 | (1) |
|
Formatting Dates and Times |
|
|
85 | (3) |
|
Calculating the Day of the Week from a Given Date |
|
|
88 | (1) |
|
Finding the Difference Between Two Dates |
|
|
88 | (2) |
|
|
89 | (1) |
|
|
90 | (1) |
|
|
90 | (1) |
|
|
91 | (12) |
|
|
91 | (2) |
|
Permissions with an FTP Program |
|
|
92 | (1) |
|
|
93 | (1) |
|
|
93 | (1) |
|
Placing a File's Contents into a Variable |
|
|
93 | (3) |
|
|
95 | (1) |
|
|
95 | (1) |
|
Creating and Writing to a File |
|
|
96 | (1) |
|
Checking to See If a File Exists |
|
|
96 | (1) |
|
|
97 | (1) |
|
Uploading Images to a Directory |
|
|
97 | (4) |
|
|
101 | (1) |
|
|
101 | (1) |
|
|
101 | (1) |
|
Reading a Comma-Separated File |
|
|
101 | (2) |
|
User and Session Tracking |
|
|
103 | (16) |
|
Using Cookies and Sessions to Track User Data |
|
|
104 | (1) |
|
|
104 | (1) |
|
|
104 | (1) |
|
Creating a ``Welcome Back, Username!'' Message with Cookies |
|
|
105 | (2) |
|
|
106 | (1) |
|
Using Sessions to Temporarily Store Data |
|
|
107 | (2) |
|
|
109 | (1) |
|
Checking to See If a User's Browser Accepts Cookies |
|
|
109 | (1) |
|
Redirecting Users to Different Pages |
|
|
110 | (1) |
|
Forcing a User to Use SSL-Encrypted Pages |
|
|
111 | (1) |
|
Extracting Client Information |
|
|
111 | (4) |
|
|
115 | (1) |
|
|
116 | (3) |
|
|
119 | (10) |
|
Using PHPMailer to Send Mail |
|
|
120 | (4) |
|
|
120 | (1) |
|
|
121 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
Using Email to Verify User Accounts |
|
|
124 | (5) |
|
|
129 | (12) |
|
Creating a CAPTCHA (Security) Image |
|
|
129 | (7) |
|
Creating Thumbnail Images |
|
|
136 | (5) |
|
Using cURL to Interact with Web Services |
|
|
141 | (14) |
|
Connecting to Other Websites |
|
|
142 | (2) |
|
|
144 | (1) |
|
Transforming XML into a Usable Form |
|
|
144 | (2) |
|
Using Mapping Web Services |
|
|
146 | (3) |
|
Using PHP and SOAP to Request Data from Amazon.com |
|
|
149 | (2) |
|
|
151 | (4) |
|
|
155 | (28) |
|
|
156 | (6) |
|
|
157 | (2) |
|
|
159 | (1) |
|
|
160 | (2) |
|
|
162 | (1) |
|
Electronic Greeting Cards |
|
|
162 | (9) |
|
|
164 | (1) |
|
|
165 | (4) |
|
|
169 | (2) |
|
|
171 | (1) |
|
|
171 | (12) |
|
|
172 | (2) |
|
|
174 | (4) |
|
|
178 | (1) |
|
|
178 | (3) |
|
|
181 | (2) |
Appendix |
|
183 | (2) |
Index |
|
185 | |