This Tutorial walks you through setting up a database table to house your Users login details, and set up a Login page within Dreamweaver.
It also included details on Restricting access to pages within your site to only those who have logged in via your Login page.
You will need either PWS or IIS running on your computer to run the ASP pages.
This Tutorial expects some experience in developing ASP pages in Dreamweaver MX, although each part will be walked through point by point, so you really just need to feel comfortable using Dreamweaver MX (trial version can be downloaded from macromedia.com)
You will need to know how to create a datebase and add tables.
- Create a new database in your choice of flavour (Access, SQL Server, MySQL)
- Create a new table, name it user_logins
- Change to design view.
- Create a column for AccountID, UserName, UserPassword and any others you may wish, i.e UserReal, UserEmail etc, CreatedDate but the first 3 are a minimum
Types for each column
- AccountID (Access= Autonumber, SQL server = int, Identity, not for repeating)<–primary key
- UserName (Access=text, SQL server = varchar (50) )
- UserPassword (Access=text, SQL server = varchar (50) )
- If using Created Date (Access=date, default = now() SQL server=Date/time, default=getdate() )
Save your table
- Create a new ASP page.
- Add a form tag (call it something like fmlogin)
- Add 2 text fields, call 1=Username, 2=Userpassword
- Add a Submit button
- In the Application palette…Server Behaviours…Authenticate User…Login user
- Choose your connection (this will need setting up before hand to either talk to an ODBC or DSN-less connection)
- Select the user_logins table.
- Dreamweaver would have already entered the Form fields for Username and Password, you will need to tell it which columns in the database are for Username and Password.
- Enter the page you wish it to go to if the login is successful, and the one if the login fails.
You have finished your login page.
If you only want people who have logged in to see them, you will need to restrict each page you are protecting with this login.
Open each page you want to protect …. In the Application pallete…Server Behaviours…Authenticate User…Restrict access to page.
Enter the page to go to if someone tries to access the page without logging in, or if their session has timed out.