Muutke küpsiste eelistusi

Wicked Cool PHP: Real-world Scripts That Solve Difficult Problems [Pehme köide]

  • Formaat: Paperback / softback, 216 pages, Illustrations
  • Ilmumisaeg: 01-Feb-2008
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1593271735
  • ISBN-13: 9781593271732
Teised raamatud teemal:
  • Formaat: Paperback / softback, 216 pages, Illustrations
  • Ilmumisaeg: 01-Feb-2008
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1593271735
  • ISBN-13: 9781593271732
Teised raamatud teemal:
Rather than explain the basics of PHP, this guide provides scripts that can be implemented immediately to make programmers lives easier. Included are scripts for processing credit cards, getting live shipping quotes, and accepting PayPal payments online.

PHP is an easy-to-use scripting language perfect for quickly creating the Web features you need. Once you know the basics of how the language works, wouldn't it be great to have a collection of useful scripts that solve those tricky problems and add interesting functionality to your site? We thought so, too.

Instead of starting at "Hello World," Wicked Cool PHP assumes that you're familiar with the language and jumps right into the good stuff. After you learn the FAQs of life-the most commonly wished for PHP scripts-you'll work your way through smart configuration options and the art of forms, all the way through to complex database-backed scripts.

Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text. The 76 easily implemented scripts will also teach you how to:

Send and receive email notifications Track your visitors' behavior with cookies and sessions Override PHP's default settings Manipulate dates, images, and text on the fly Harness SOAP and other web services Create an online poll, ecard delivery system, and blog

But it's not all fun and games: Security is a big concern when programming any web application. So you'll learn how to encrypt your confidential data, safeguard your passwords, and prevent common cross-site-scripting attacks. And you'll learn how to customize all of the scripts to fit your own needs.

Dynamic Web content doesn't have to be difficult. Learn the secrets of the craft from two experienced PHP developers with Wicked Cool PHP.



Rather than explain the basics of PHP, this guide provides scripts that can be implemented immediately to make programmers lives easier. Included are scripts for processing credit cards, getting live shipping quotes, and accepting PayPal payments online.
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)
What Can Go Wrong?
3(1)
Highlighting Alternate Row Colors in a Table
4(3)
Hacking the Script
5(2)
Creating Previous/Next Links
7(4)
Using the Script
10(1)
Printing the Contents of an Array
11(1)
Turning an Array into a Nonarray Variable That Can Be Restored Later
12(1)
What Can Go Wrong?
12(1)
Sorting Multidimensional Arrays
13(1)
Hacking the Script
14(1)
Templating Your Site with Smarty
14(5)
Installing Smarty
14(1)
A Brief Smarty Tutorial
15(1)
What Can Go Wrong?
16(1)
Hacking the Script
17(2)
Configuring PHP
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)
Error Reporting
22(2)
Common Error Messages
23(1)
Suppressing All Error Messages
24(1)
Extending the Run Time of a Script
24(1)
What Can Go Wrong?
25(1)
Preventing Users from Uploading Large Files
25(1)
Turning Off Registered Global Variables
25(1)
Enabling Magic Quotes
26(1)
What Can Go Wrong?
26(1)
Restricting the Files that PHP Can Access
26(1)
What Can Go Wrong?
27(1)
Shutting Down Specific Functions
27(1)
Adding Extensions to PHP
27(6)
Adding PHP Extensions
28(1)
Installing Extensions with a Web-Based Control Panel
29(3)
What Can Go Wrong?
32(1)
PHP Security
33(12)
Recommended Security Configuration Options
35(1)
SQL Injection Attacks
35(2)
Preventing Basic XSS Attacks
37(1)
Using Safe HTML
38(2)
What Can Go Wrong?
39(1)
Protecting Data with a One-Way Hash
40(1)
Hacking the Script
41(1)
Encrypting Data with Mcrypt
41(2)
Hacking the Script
43(1)
Generating Random Passwords
43(2)
Using the Script
44(1)
Working with Forms
45(14)
Security Measures: Forms Are Not Trustworthy
45(1)
Verification Strategies
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)
Hacking the Script
51(1)
Using Multiple Submit Buttons
52(1)
Validating a Credit Card
52(3)
Using the Script
54(1)
Hacking the Script
55(1)
Double-Checking a Credit Card's Expiration Date
55(1)
Using the Script
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)
Hacking the Script
61(1)
Making a String Uppercase, Lowercase, or Capitalized
62(1)
What Can Go Wrong?
62(1)
Finding Substrings
63(1)
What Can Go Wrong?
64(1)
Replacing Substrings
64(1)
What Can Go Wrong?
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)
What Can Go Wrong?
69(1)
Regular Expressions
69(6)
Regular Expression Basics
69(1)
Special Character Sequences
70(1)
Pattern Repeaters
71(1)
Grouping
71(1)
Character Classes
71(1)
Putting It All Together
72(1)
Matching and Extracting with Regular Expressions
72(2)
Replacing Substrings with Regular Expressions
74(1)
Rearranging a Table
75(1)
Creating a Screen Scraper
75(2)
Hacking the Script
77(1)
Converting Plaintext into HTML-Ready Markup
77(3)
Automatically Hyperlinking URLs
80(1)
Stripping HTML Tags from Strings
80(1)
Working with Dates
81(10)
How Unix Time Works
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)
Using the Script
89(1)
Hacking the Script
90(1)
MySQL Date Formats
90(1)
Working with Files
91(12)
File Permissions
91(2)
Permissions with an FTP Program
92(1)
The Command Line
93(1)
What Can Go Wrong?
93(1)
Placing a File's Contents into a Variable
93(3)
Hacking the Script
95(1)
What Can Go Wrong?
95(1)
Creating and Writing to a File
96(1)
Checking to See If a File Exists
96(1)
Deleting Files
97(1)
Uploading Images to a Directory
97(4)
Using the Script
101(1)
What Can Go Wrong?
101(1)
Hacking the Script
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)
Cookies
104(1)
Sessions
104(1)
Creating a ``Welcome Back, Username!'' Message with Cookies
105(2)
What Can Go Wrong?
106(1)
Using Sessions to Temporarily Store Data
107(2)
What Can Go Wrong?
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)
Session Timeouts
115(1)
A Simple Login System
116(3)
Working with Email
119(10)
Using PHPMailer to Send Mail
120(4)
Installing PHPMailer
120(1)
Using the Script
121(1)
Adding Attachments
122(1)
What Can Go Wrong?
123(1)
Using Email to Verify User Accounts
124(5)
Working with Images
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)
Using Cookies
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)
Building a Web Service
151(4)
Intermediate Projects
155(28)
A User Poll
156(6)
Creating a Ballot Form
157(2)
Processing the Ballot
159(1)
Getting Poll Results
160(2)
Hacking the Script
162(1)
Electronic Greeting Cards
162(9)
Choosing a Card
164(1)
Sending the Card
165(4)
Viewing the Card
169(2)
Hacking the Script
171(1)
A Blogging System
171(12)
Creating Blog Entries
172(2)
Displaying an Entry
174(4)
Adding Comments
178(1)
Creating a Blog Index
178(3)
Hacking the Script
181(2)
Appendix 183(2)
Index 185