Adding User Registration to the Application

Implementing a user registration system is a fairly involved process, not only because there's a lot to do in setting up a user account, but also because it's the first real interaction between the web application and the end-user that we've looked at in this book. The process of accepting user registrations will involve the following Adding navigation so the user can find the registration form Displaying the registration form to the user, including a CAPTCHA image Accepting and validating the...

Outputting FlashMessenger Messages on the Web Site

Finally, we must output any existing messages to the template. In order for messages to be displayed regardless of where the user is in the site in other words, so we can use it in other areas aside from managing blog posts , we add the display code to the footer.tpl template, because we will be displaying messages in the right column. Just like the error containers we created for form errors, we will reuse this message container for similar messages we generate from Ajax requests. To achieve...

Info Bzo

At the start of this template we include some basic introductory text that uses the totalPosts variable. Note that we change the language depending on the number of posts. This is simple to do, yet if you look closely at many computer or web applications, developers often seem to miss this have you ever noticed text along the lines of 1 blog posts found . The only thing to do now is to add a few extra styles to tidy up this output. We will make the date and title appear in bold, as well as...

Creating a Controller for Managing Blog Posts

In its current state, our application has three MVC controllers the index, account, and utility controllers. In this section, we will create a new controller class called BlogmanagerController specifically for managing blog posts. This controller will handle the creation and editing of blog posts, the previewing of posts as well as sending them live , as well as the deletion of posts. This controller will not perform any tasks relating to displaying a user's blog publicly either on the...

Adding Logging Capabilities

The final thing we will look at in this chapter is adding logging capabilities to our application. To do this, we will use the Zend_Log component of the Zend Framework, which we will use in various places in our application. For example, we will record an entry in the log every time a failed login occurs in the members section. Although it is possible to do some pretty fancy things with logging such as writing entries to a database, or sending e-mails to a site administrator , all we will do...

Functions for Resetting Passwords

There are two functions we need to add to DatabaseObject_User to implement the password resetting. The first is called fetchPassword , which does the following 1. Generates a new password using Text_Password. 2. Writes the new password to the user profile. 3. Writes the current date and time to the user profile, so we can ensure the new password can only be confirmed within one day. 4. Generates a key that must be supplied by the user to confirm their new password. We also write this to the...

User Registration Login and Logout

In Chapter 3 we looked closely at the user authentication and authorization aspects of the web application. We learned that authentication is when a user proves they are who they say they are, while authorization determines what that user is and isn't allowed to do. We created the necessary database tables to hold user details as well as the code to manage the database records. We then used the Zend_Auth and Zend_Acl components of the Zend Framework to control which areas of the web site users...

Handling Predispatch Errors

First we are going to handle any errors that may arise prior to dispatching the user request. In our application, before we dispatch the request, we load the configuration file, initialize the application logger, and connect to the database. Additionally, we are going to catch any errors that were not caught elsewhere that is, in the dispatch loop . Essentially what we are going to do is to wrap all of the code in the application bootstrap . htdocs index.php in a single try catch statement,...