Back to Top
The nuts and bolts for
Creative web development

Create a Login page and Userdetails table

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. Prerequisites

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.

Details

1. Create a new database in your choice of flavour (Access, SQL Server, MySQL)
2. Create a new table, name it user_logins
3. Change to design view.
4. 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

Open Dreamweaver

* 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.

If you have more then one level of users on your site, you might wish to take a look at the Dynamically redirect your Login page tutorial

Carl Grint

Carl Grint" Since graduating from university, I have worked with Charities and the Public sector, with my longest time being 3 years with the NHS until returning to freelance in 2003.

I would like to think my diverse experience of working for both the Public and Private sector gives me a good all rounding which enables me to approach projects with a unique perspective and enables me to bring new thoughts and initiatives to my work.

I have always enjoyed passing on the lessons I have learned so other developers can bypass the 'working out' time I had to go through, and writing my first two articles for DMXzone has given me a chance to pass on what I think are some good ways to improve on the standard Authentication behaviours Macromedia supply with Dreamweaver."

See All Postings From Carl Grint >>

Share this Article