The login page is straightforward, but I've added a new twist to keep it interesting. The page consists of a form with two text fields: one for the user name and the other for password (see Figure 3).

Figure 3. The login page
Setting up the server-side code for this page is equally direct and requires a single server behavior. The interesting part is how failed log-ons are handled: rather than send the user to another page—from which he or she would have to click the Back button—you'll display the error message on the same page for a quicker and smoother response.
From the Server Behaviors panel, click Add (+) and choose User Authentication > Log In User.
In the sample file, the two fields are named appropriately: Email and Password. The Password field, additionally, is set to mask the entered values.
When the Log In User dialog box opens (see Figure 4), leave the selected form in place and make sure the Username field is set to email and the Password field to password.
Set the Restrict access based on option to Username and password and click OK.

Figure 4. The Log In User server behavior
When activated by clicking the Log In button, the Log In User server behavior verifies that the supplied e-mail address and password match values found in the subs table. If a match is found, the subscription management page, cleverly called manage_subs.php, is displayed; if not, the login page is reshown and the Email and Password fields are cleared. Although some folks might think this is enough of a hint to site visitors that they need to try again, it's better to be as clear as possible when it comes to error messages. In the next step, you'll insert an error message that displays on the login page.
The basic Dreamweaver server behaviors—such as insert, update, and delete—all depend on the form being submitted to the same page in which the server-side code is inserted. The Log In server behavior works the same way. You can use this knowledge to create a same-page error message.
Place your cursor anywhere in the form and, from the Tag Selector, choose <form>.
Although you could put the error message anywhere on the page, placing it below the form works well.
Press the right arrow key once.
By selecting the form and then moving to one side of it,
you're sure to insert your <p> tag in the right place.
Switch to Code view and insert the following:
<?php echo (isset($_GET['failed']))?'<p class="error">Log In failed - Please try again.</p>':''; ?>
This code is a ternary (or conditional) statement. Translated
into English, it reads, "If there is a URL parameter called 'failed',
insert the error message; otherwise, don't insert anything." You'll recall
that in the Log In dialog box, you entered the current page with the URL
parameter string failed=true as the page to display should the log-on not be
successful, like this: login.php?failed=true. The CSS class .error will
display the message in a noticeable red.
Now for the main event: the subscription management page.