Synopses & Reviews
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 notificationsTrack your visitors' behavior with cookies and sessionsOverride PHP's default settingsManipulate dates, images, and text on the flyHarness SOAP and other web servicesCreate 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.
Wicked Cool PHP capitalizes on the success of the "Wicked Cool" series from No Starch Press. Rather than focus on the basics of the language, Wicked Cool PHP provides (and explains) PHP scripts that can be implemented immediately to simplify webmasters' lives. These include unique scripts for processing credit cards, checking for valid email addresses, templating, overriding PHP's default settings, and serving dynamic images and text. Readers will also find extensive sections on working with forms, words, and files; ways to harden PHP by closing common security holes; and instructions for keeping data and transactions secure. By exploring working code, readers learn how to customize their webserver's behavior, prevent spammers from adding annoying comments, scrape information from other web sites, and much more. This is a book that's sure to appeal to PHP programmers who have been there and done that and who want a book that delivers meaty content, not only promise.
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.
About the Author
William "The Ferrett" Steinmetz is an avid and eminently qualified gamer and LAN party participant, planner, host, and author. His gaming philosophy? "If it moves, shoot it."Brian Ward, associate professor of history at the University of Florida, is the editor of "Media, Culture, and the Modern African American Freedom Struggle" (UPF, 2001) and the author of "Just My Soul Responding: Rhythm and Blues, Black Consciousness, and Race Relations," which won the 1999 James A. Rawley Prize from the Organization of American Historians.
Table of Contents
WICKED COOL PHP.; INTRODUCTION; Chapter 1: THE FAQS OF LIFE--THE SCRIPTS EVERY PHP PROGRAMMER WANTS (OR NEEDS) TO KNOW; 1.1 #1: Including Another File as a Part of Your Script; 1.2 #2: Highlighting Alternate Row Colors in a Table; 1.3 #3: Creating Previous/Next Links; 1.4 #4: Printing the Contents of an Array; 1.5 #5: Turning an Array into a Nonarray Variable That Can Be Restored Later; 1.6 #6: Sorting Multidimensional Arrays; 1.7 #7: Templating Your Site with Smarty; Chapter 2: CONFIGURING PHP; 2.1 Configuration Settings and the php.ini File; 2.2 #8: Revealing All of PHP's Settings; 2.3 #9: Reading an Individual Setting; 2.4 #10: Error Reporting; 2.5 #11: Suppressing All Error Messages; 2.6 #12: Extending the Run Time of a Script; 2.7 #13: Preventing Users from Uploading Large Files; 2.8 #14: Turning Off Registered Global Variables; 2.9 #15: Enabling Magic Quotes; 2.10 #16: Restricting the Files that PHP Can Access; 2.11 #17: Shutting Down Specific Functions; 2.12 #18: Adding Extensions to PHP; Chapter 3: PHP SECURITY; 3.1 Recommended Security Configuration Options; 3.2 #19: SQL Injection Attacks; 3.3 #20: Preventing Basic XSS Attacks; 3.4 #21: Using SafeHTML; 3.5 #22: Protecting Data with a One-Way Hash; 3.6 #23: Encrypting Data with Mcrypt; 3.7 #24: Generating Random Passwords; Chapter 4: WORKING WITH FORMS; 4.1 Security Measures: Forms Are Not Trustworthy; 4.2 Verification Strategies; 4.3 Using $_POST, $_GET, $_REQUEST, and $_FILES to Access Form Data; 4.4 #25: Fetching Form Variables Consistently and Safely; 4.5 #26: Trimming Excess Whitespace; 4.6 #27: Importing Form Variables into an Array; 4.7 #28: Making Sure a Response Is One of a Set of Given Values; 4.8 #29: Using Multiple Submit Buttons; 4.9 #30: Validating a Credit Card; 4.10 #31: Double-Checking a Credit Card's Expiration Date; 4.11 #32: Checking Valid Email Addresses; 4.12 #33: Checking American Phone Numbers; Chapter 5: WORKING WITH TEXT AND HTML; 5.1 #34: Extracting Part of a String; 5.2 #35: Making a String Uppercase, Lowercase, or Capitalized; 5.3 #36: Finding Substrings; 5.4 #37: Replacing Substrings; 5.5 #38: Finding and Fixing Misspelled Words with pspell; 5.6 #39: Regular Expressions; 5.7 #40: Rearranging a Table; 5.8 #41: Creating a Screen Scraper; 5.9 #42: Converting Plaintext into HTML-Ready Markup; 5.10 #43: Automatically Hyperlinking URLs; 5.11 #44: Stripping HTML Tags from Strings; Chapter 6: WORKING WITH DATES; 6.1 How Unix Time Works; 6.2 #45: Getting the Current Timestamp; 6.3 #46: Getting the Timestamp of a Date in the Past or Future; 6.4 #47: Formatting Dates and Times; 6.5 #48: Calculating the Day of the Week from a Given Date; 6.6 #49: Finding the Difference Between Two Dates; 6.7 MySQL Date Formats; Chapter 7: WORKING WITH FILES; 7.1 File Permissions; 7.2 #50: Placing a File's Contents into a Variable; 7.3 #51: Creating and Writing to a File; 7.4 #52: Checking to See If a File Exists; 7.5 #53: Deleting Files; 7.6 #54: Uploading Images to a Directory; 7.7 #55: Reading a Comma-Separated File; Chapter 8: USER AND SESSION TRACKING; 8.1 Using Cookies and Sessions to Track User Data; 8.2 #56: Creating a "Welcome Back, Username!" Message with Cookies; 8.3 #57: Using Sessions to Temporarily Store Data; 8.4 #58: Checking to See If a User's Browser Accepts Cookies; 8.5 #59: Redirecting Users to Different Pages; 8.6 #60: Forcing a User to Use SSL-Encrypted Pages; 8.7 #61: Extracting Client Information; 8.8 #62: Session Timeouts; 8.9 #63: A Simple Login System; Chapter 9: WORKING WITH EMAIL; 9.1 #64: Using PHPMailer to Send Mail; 9.2 #65: Using Email to Verify User Accounts; Chapter 10: WORKING WITH IMAGES; 10.1 #66: Creating a CAPTCHA (Security) Image; 10.2 #67: Creating Thumbnail Images; Chapter 11: USING cURL TO INTERACT WITH WEB SERVICES; 11.1 #68: Connecting to Other Websites; 11.2 #69: Using Cookies; 11.3 #70: Transforming XML into a Usable Form; 11.4 #71: Using Mapping Web Services; 11.5 #72: Using PHP and SOAP to Request Data from Amazon.com; 11.6 #73: Building a Web Service; Chapter 12: INTERMEDIATE PROJECTS; 12.1 #74: A User Poll; 12.2 #75: Electronic Greeting Cards; 12.3 #76: A Blogging System; APPENDIX; COLOPHON;