13. Controlling Access
Dreamweaver includes four User Authentication server behaviorsLog In User, Check New Username, Restrict Access to Page, and Log Out Userthat you can use to control access to your entire site or certain sections of it. Before you add these User Authentication server behaviors to your site pages, however, you need to create a database table to store user information. If you want to include different access levels for the site so that registered users can access more sections of the site than unregistered users can, you'll also need to add access information to the database table.
Once you've created the database table, you can create a registration page to register users, and a login page where registered users can log in to the site. The registration page includes the Insert Record server behavior and the Check New Username behavior. The login page includes a login form and the Log In User server behavior. The Log Out User behavior is added to restricted pages so that users can log out of the site at any time. To prevent users who haven't registered and logged in from accessing restricted pages, you can add a Restrict Access to Page behavior.
In this chapter, you'll learn to create a MySQL database table to store user information, build a registration page and a registration form, and build a login page and a login form. In addition, you'll learn how to enable users to log out of your site and how to prevent unauthorized access to restricted pages.
We use PHP for the tasks in this chapter, but Dreamweaver's user-authentication process is the same for PHP, ASP, and ColdFusion. The process is also the same for JSP, but Dreamweaver doesn't include User Authentication server behaviors for ASP.NET.