Dreamweaver Simple Login Page
Hi everyone, today, we’ll be looking at how we can create a simple login system with dreamweaver. We’ll then go through how to restrict user access to pages of a site with Go To Related Page and Show Region behaviors tomorrow.
1. create two new files called login.asp and loginCheck.asp

2. in login.asp, insert form, and set its name to fmLogin and its action to point to loginCheck.asp
3. in form called fmLogin, insert two text fields called username and passwd, and a button
4. save login.asp
5. in loginCheck.asp, add two separate lines of:
Login successful
Incorrect username and password
6. in loginCheck.asp, add recordset called rsLoginCheck, and switch to advanced mode.
7. in recordset advanced mode, enter sql of:
select * from test.user where username=’varUsername’ and passwd=’varPasswd’
note: this assumes your schema is test and table is user, and the user table has fields or columns called username and passwd
8. add + button besides variables, and set name to varUsername, default value to none, and Run-time value to Request(”username”)

9. add + button besides variables, and set name to varPasswd, default value to none, and Run-time value to Request(”passwd”)
10. click ok

11. select line of “Login successful”, and select Server Behaviors tab, click +, select Show Region > Show Region if Recordset is not empty
note: if value entered in username and passwd textfields match a record in the table, then the recordset will be non-empty, so server will show text within this Show Region
12. select line of “Incorrect username and password”, and select Server Behaviors tab, click +, select Show Region > Show Region if Recordset is empty

enter valid username and password at login page

loginCheck page after successful login

loginCheck page after unsuccessful login with incorrect username or password

Comments »
No comments yet.
RSS feed for comments on this post.