|All reviews||Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems||Latest reviews||Best sellers ranking|
Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
February 9, 2008
Week: Not ranked All time: 99
Chetankumar Digambarrao Akarte
renukatechnologies.inPHP is a widely used server side scripting language for producing dynamic Web pages.
In the PHP development life-cycle everyone faces common problems. Considering this, No Starch Press came with a good book named "Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems" written by William Steinmetz and Brian Ward.
Wicked Cool PHP is a wide collection of complete PHP scripts that solve specific problems frequently encountered by PHP coders. The book contains 12 chapters covering 76 frequently encountered problems.
Chapter 1, "The FAQs of Life—The Scripts Every PHP Programmer Wants (or Needs) to Know", answers several questions that are frequently asked on PHP forums and discussion groups all over the world.
This chapter gives quick solutions and tricks on errors we face while including other files as a part of your scripts, highlighting row colors in a table, implementing pagination and dealing with arrays. It also gives a quick introduction on the most frequently used templating solution: Smarty.
The php.ini file defines PHP options. Chapter 2, “Configuring PHP” gives a brief overview of the PHP configuration options that can be set in php.ini, getting PHP option values, error reporting, suppressing error messages, enabling PHP extensions, dealing with file uploads, registered global variables, magic quotes, and many other tricks related to php.ini .
Security is the major concern in Web development. You must always keep security in mind while developing your code. Chapter 3, “PHP Security”, focuses briefly on the concept of security configuration.
You also get an idea about SQL injection attacks and XSS (Cross-Site Scripting) attacks, and ways to protect from these kinds of attacks like using safe HTML or protecting data with a one-way hash. This chapter also talks about on encrypting data with mcrypt and random password generation techniques.
Web forms are very useful and important when taking the input, suggestions or feedback from user. Usually data is submitted using an Web forms. We have to take care of security measures because forms are not a trusted source of input.
Chapter 4, “Working With Forms” explores topics like validation strategies, using $_POST, $_GET, $_REQUEST, and $_FILES to access form data, fetching form variables consistently and safely, trimming exceeding white space, importing form variables into an array, assuring that a response is one of a set of given values, and using multiple submit buttons.
It also introduces advanced form processing techniques like validating a credit card, double-checking credit cards expiration date, checking valid email addresses and checking American phone numbers.
Chapter 5, “Working with Text and HTML” focus on string operations with elementary techniques, like extracting part of a string, making a string upper case, lower case, or capitalized, finding and replacing sub-strings, stripping HTML tags from strings.
Then it goes in-depth with finding and fixing misspelled words with pspell, regular expressions, rearranging a table, creating a screen scraper, converting plain text into HTML markup, anf automatically linking URLs.
Chapter 6, “Working with Dates” shows how to work with dates and times in PHP. PHP has good date manipulation support but tasks become tedious while accessing MySQL databases.
In this chapter it teaches more about how UNIX time works and MySQL date formats. This chapter also provides quick solution on getting the current timestamp, getting the timestamp of a date in the past or future, formatting dates and times, calculating the day of the week of a given date, and finding the difference between two dates.
File manipulation is an important part of PHP programming. To accomplish your tasks you often have perform lots of file related issues. Chapter 7, “Working with Files” deals with file permissions, reading from and writing to a file, reading a comma-separated file, checking whether a file exists on the server, and deleting a file.
While dealing with a shopping carts or accessing secure pages, user tracking and sessions are usually Web application tasks that play an important role.
Chapter 8, “User AND Session Tracking” shows how to track users' data using cookies and sessions, store user information in a cookie and display it, check weather the user's browser supports cookies, extracting client information, temporarily storing data in sessions, session timeouts, redirecting and forcing to use SSL encrypted pages. At the end, all the techniques above are used to implement a simple login system.
In PHP we need to we often need to use email to send confirmation messages to users and administrators about account settings, orders, and so on. Chapter 9, "Working With email" illustrates how the mail() function works, installing and using PHPMailer to send mail, using email to validate user accounts.
Chapter 10, "Working with Images" shows how to create and manipulate images in formats such as GIF and JPEG. In this chapter we learn tricks to generate CAPTCHA verification image to secure our PHP form processing or any kind of user interaction with our Web sites.
The GD extension provides flexibility to generate dynamic CAPTCHA validation image and images thumbnails. A script presented in this chapter shows how to do it using GD.
Chapters 11, “Using cURL to interact with Web Services” introduces how to use cURL PHP library to handle the connection between your Web server and other servers.
Here we learn more about using cookies with cURL, using mapping Web services, using PHP and Simple Object Access Protocol (SOAP) to retrieve data from Amazon.com, transforming XML into data in an usable format, and building a Web service.
Chapter 12, “Intermediate Projects” explore three sets of scripts that implement common features of many content-based Web sites: a voting system (user poll), an electronic card service, and a blog.
This book also has an appendix that contains the schema of the product information table with details of the inventory for a hypothetical store, which is mentioned in the book several times while presenting the solutions.
PHP is popular web development language. Lots of tips and tutorials are freely available on the Web. But they are scattered and very difficult to decide which is the a right solution to use for each kind of problem.
During the development stage of a project, time is an important factor. This book is a handy solution on the problems commonly faced by every programmer during their PHP development experience. Therefore this book is recommended to new and enthusiastic PHP coders.
1. PHPClasses.org: Book Review: Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems (2008-08-14 08:47)