- slide 1 of 4
Password protection of a webpage comes after creating and saving webpages.
- Create a database to store user details. Two mandatory columns in the database table are name and password. An access privilege column is optional. Providing all users with the same password simply requires configuring the database application to enter the password in each new user record by default. Ensure that the database is connected using the insert record option in the menu.
- Create a new page in Macromedia Dreamweaver (File > New) and insert a HTML form (Insert > Form) at the required area in the page. Add text fields (Insert > Form Objects > Text Field) to collect the username, password any other detail. Each unit of information requires creation of a separate text field.
- Update the database table by setting the Insert Record Option (Window > Server Behavior> Insert Record). Identify the HTML form used to obtain the username and password in the Get Values pop-up menu (Connections > Insert Into Table > Get Values) menu.
- Select User Authentication > Check New Username from the pop up menu (Connections > Insert Into Values > Get Values) validate whether the entered username or password is unique. If username already exist, the server behavior cancels the insert record operation and opens a new page.
Repeat Steps 2, 3 and 4 for each object or unit of information. For instance, this process needs completed once for username, and again for the password.
To restrict access to a single user or to a closed group without users having to register, create a database table with username and password, and enter values directly into the table instead of steps 2, 3, and 4. Communicate the assigned username and password to the users, allowing them to log in directly.
- slide 2 of 4
User Log In
- Create a new login page (File > New)
- Add a HTML form to this new page (Insert > Form)
- Add text fields (Insert > Form Objects > Text Field) to collect the user’s name, password any other detail. Each unit of information requires creation of a separate text field. To mask the entered password, open Property Inspector (Window > Properties), and check the Password radio button. This displays the entered password character as asterisk (*.)
- Add a Submit button to the form (Insert > Form Objects > Button). To change the label of this button to “Log In," “Enter," or any other message, open the Property inspector (Window > Properties), and enter a new value in the Label box.
- Add a Log In User Server Behavior to validate the entered username and password. Select Window > Server Behaviors > User Authentication > Log In User. Specify the form and form object from where to collect the user input, and the database table and database column that store details of registered users. Also specify the page to open if the user values match with values in the database, and the page to open if the user values do not match.
The Log In User Server Behavior compares the values entered by the user against the values for registered users in the database table, and opens the specified page if the values match.
- slide 3 of 4
Activate Restrict Access to Page
Finally, add the Restrict Access to Page Server Behavior (Select Window > Server Behaviors) to the webpage. This ensures that the page becomes accessible only through the log in, and cause redirection to another page when users try to bypassing the login page and type the page URL directly in the browser.
The above process restricts access to the specific web page. To extend the same access restriction to the entire website, or multiple pages, copy and paste the access rights from one page to another using the “Copy" and “Paste" commands in the Windows > Server Behavior menu.
- slide 4 of 4
Varese, Jon Michael. Password Protecting Pages. Macromedia Dreamweaver UltraDev Support Center. http://www.adobe.com/support/ultradev/building/restricting_access/