02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

(<br />

'testuser',<br />

'a1645e41f29c45c46539192fe29627751e1838f7311eeb4',<br />

'admin@example.com'<br />

);<br />

CHAPTER 6 ■ PASSWORD PROTECTION SENSITIVE ACTIONS AND AREAS<br />

After executing the preceding code, click the php-jquery_example database, <strong>and</strong> then the users table.<br />

Select the Browse tab to view the user info in the table (see Figure 6-3).<br />

Figure 6-3. The test user data after inserting it into the database<br />

Now that a user exists in the user database with a salted hash stored, you can delete both the<br />

testSaltedHash() method from the Admin class <strong>and</strong> the entire test.php file.<br />

Modifying the App to H<strong>and</strong>le the Login Form Submission<br />

At this point, you’re almost ready to test a user login. Before it will work, however, you need to modify<br />

process.inc.php to h<strong>and</strong>le form submissions from the login form.<br />

Due to the way the file is set up, this change is as simple as adding a new element to the $actions<br />

array. Open process.inc.php <strong>and</strong> insert the following bold code:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!