As discussed in the previous recipe, Implementing a CAPTCHA on user forms using an online service, adding a CAPTCHA to visitor-facing forms helps reduce unwanted submissions to a website. After seeing how to integrate an online third-party service, this recipe shows how to download and integrate a local PHP script to generate and validate CAPTCHA images locally.
You should be running the final version of the Book Reviews plugin created in Chapter 4, The Power of Custom Post Types, and should have already followed the Sending email notifications upon new submissions recipe. Alternatively, you can get the resulting files from the code bundle (
Chapter 4/ch4-book-reviews/ch4-book-reviews-v11.php and
Chapter 6/ch6-book-review-user-submission/ch6-book-review-user-submission-v3.php) and rename
ch6-book-review-user-submission.php before starting the recipe.
The GD and FreeType libraries...