Corrections to ‘Adobe Dreamweaver CS5 with PHP: Training from the Source’

Book coverAccompanying files: The files for the lessons in the book are on the CD-ROM at the back of the printed version. If your version didn't contain a CD-ROM, or it's damaged, send an email to, including the book's ISBN (978-0-321-71984-3), details of the problem, and your mailing address. There's no CD-ROM with the Kindle edition, but details of how to obtain the files are on the penultimate page. If you can't find the details there, look at the very beginning of the book, before the page at which the book automatically opens. If you're reading the book in Safari Books Online or Creative Edge, the files are in the Extras tab.

The gremlins have been at work—or maybe it's just brain fade—but the following errors have been found in the book.

Page 29: Since the book was published, the Adobe Developer Connection has reorganized its tutorial pages so that each article is now on a single page. Remove the underscore and number from each page name.

The following links take you to relevant sections of the articles on the Adobe site:

Pages 200–201: In step 2 at the bottom of page 200, the Columns radio button should be set to All, rather than Selected. The second paragraph on page 201 should read: “The sha1() function used earlier in the lesson to encrypt the password performs one-way encryption, so there’s no point in displaying it in the update form. However, you need to reinsert the encrypted value in the database if the user decides to retain the same password.”

Page 204: In step 7, the code should be amended as follows:

if (isset($_POST['password'])) { if (empty($_POST['password'])) { $_POST['password'] = $row_getUser['password']; } else { $_POST['password'] = sha1($_POST['password']); } }

Page 235: In the code in step 5, $errors['username'] should be $errors['password'].

Page 247: In step 2, the email address is missing from the $data array that's inserted into the users table. The correct code should be as follows:

$data = array('first_name' => $_POST['first_name'], 'family_name' => $_POST['surname'], 'username' => $_POST['username'], 'email' => $_POST['email'], 'password' => sha1($_POST['password']));

Page 274: The code in step 6 is slightly different from the code in process_comments.php in the book's accompanying files. However, they both produce the same result. The code printed in the book adds the <html>, <head>, <title>, and <body> elements to the HTML version of the email. These elements are required in HTML 4.01, but email programs make no objections if you omit them.

Pages 291–292: The code as printed in step 5 of the book is correct. However, the versions of request_reset.php and request_reset_unsub.php on the CD contain the following extra line of code on line 21:

$where = $dbWrite->quoteInto('email = ?', $_POST['email']);

This line of code is unnecessary and can be deleted. However, leaving it in makes no difference.

Step 6 instructs you to add the script inside the else block. Unfortunately, I failed to follow my own instructions when creating the files for the CD. The script on the CD still works, but it generates a warning notice about the token being undefined if someone enters an email address that isn't registered in the database. The same error affects request_reset_unsub.php. Updated files for Lesson 8.

Page 295: I'm grateful to Willem van Leeuwen for pointing out that setting $_SESSION['nomatch'] to TRUE at the beginning of reset_password.php prevents the script from redisplaying the form if the passwords don't match. The simple way to avoid this is to check for the existence of $_SESSION['user_id'] like this:

if (!isset($_SESSION['user_id'])) { $_SESSION['nomatch'] = TRUE; }

$_SESSION['user_id'] is set by the code in step 7 on pages 296–297 if there's a match for the user_id and token in the database. So, $_SESSION['nomatch'] will be reset to TRUE only if $_SESSION['user_id'] doesn't exist—in other words, if someone attempts to access the form directly. The same amendment applies to reset_password_unsub.php. Updated files for Lesson 8.

Page 337: The script that adds attachments to the email fails if the original filename contains spaces. To fix the problem, amend the first line inside the foreach loop in step 3 like this:

$current_file = $destination . '/' . $_SESSION['att_id'] . str_replace(' ', '_', $attached);

More About This Book

Book Description

Other Books & Videos by David Powers

Introducing PHP

Up & Running with phpMyAdmin

Responsive Design with Bootstrap and Dreamweaver CC 2015

PHP Solutions, Third Edition

PHP for Web Designers

Beginning CSS3

Dreamweaver CS6: Learn by Video

PHP Object-Oriented Solutions

Buy from one of these online stores

Free 7-day trial

Books & Videos by David Powers

PHP SolutionsBeginning CSS3Dreamweaver CS6: Learn by VideoDreamweaver CS5.5: Learn by VideoDreamweaver CS5.5 for MobileDreamweaver CS5 with PHP