In chapter 8 of the Turnbull textbook, you will create a basic dynamic
Web site. Since there are details you need to know to make this
work on our server, I have compiled some notes and video demonstrations
to help you.
| Section |
Notes |
Video Demonstrations |
| Creating the Database |
Create your database in Access. Make sure your field names
are as shown (no spaces or illegal characters). Save your database
in the database folder in your local root folder. When you
are done, upload the database to the cis2 server.
|
Creating
the Database (4.5 minutes)
Windows
Media,
Flash
|
| Setting up the Site |
SKIP THIS SECTION. Use your existing site definition. Create
a folder within the site named chapter8 and put all your files there
(except the database, which goes into the database folder). |
none |
| Home Page & CSS (page 263) |
Create a home page named index.asp and
an external CSS named ProdMXCh8.css.
Follow the textbook instructions to create session variables and
ASP code.
|
home
page & CSS (7 minutes)
Windows Media,
Flash
session
variables (8.5 minutes)
Windows
Media,
Flash |
| User Registration Page |
Before you begin, create a database connection using the following
custom connection string:
Driver={Microsoft
Access Driver (*.mdb)}; DBQ=C:\Inetpub\wwwroot\username\database\database_file_name.mdb
Don't forget to upload your connection after you create it.
|
Custom
Connection (1.5 minutes)
Windows
Media,
Flash |
insert
record
form |
The book has you create an insert record form manually, but
you can create the form more quickly by using the Insert Record
button. Then
you just need to remove a few fields (UID and UAccessLevel), add
a few notes, set the maxlength for the fields, and open the Insert
Record server behavior to reset it.
Be sure to test your form after you create it. |
Insert
Record form (5 minutes)
Windows
Media,
Flash |
validation |
You have to go to Macromedia
Exchange to get the required extension. I
found it by searching for Flocken and I had to quit and restart Dreamweaver
to get it to work. In Dreamweaver MX 2004, Behaviors are found in
the Tag Inspector panel group.
Test your form validation - try to submit your form with no values,
with an invalid email address, and with 2 passwords that don't
match. |
Validation (8
minutes)
Windows
Media,
Flash |
avoiding duplicate
usernames |
This section is actually pretty simple! :-) |
Avoiding
Duplicate Usernames (3.5 minutes)
Windows Media
Flash |
persisting
data |
This section is also simple. Here's the long string so
you don't have to type it in:
userreg.asp?UName="
& Request("UName")
&
"&UEmail=" & Request("UEmail")
& "&UPassword=" & Request("UPassword")& "&UPassword2=" & Request("UPassword2") & "&UAddress1=" & Request("UAddress1") & "&UAddress2=" & Request("UAddress2") & "&UAddress3=" & Request("UAddress3")
& "&UTown=" & Request("UTown") & "&UCounty=" & Request("UCounty") & "&UCountry=" & Request("UCountry") & "&UPostcode=" & Request("UPostcode") & "&UPhone=" & Request("UPhone")
& "&UFax=" & Request("UFax")
& "&UWebAddress=" & Request("UWebAddress") & "
|
Persisting
Data (3.5 minutes)
Windows Media
Flash |
| Login |
This is also fairly simple. Make sure your database (updated
version on the server) doesn't have any duplicate usernames before
you begin.
|
Login (6.5
minutes)
Windows Media
Flash |
| Storing a User's Login Details Using a Cookie |
Here is the code so you can copy & paste it:
<%
IF Request("Login") <> "" THEN
IF Request.Form("RememberMe") = "remember" THEN
Response.Cookies("ckUsername") = Request.Form("Username")
Response.Cookies("ckUsername").Expires = Date + 30
Response.Cookies("ckPassword") = Request.Form("Password")
Response.Cookies("ckPassword").Expires = Date + 30
ELSE
Response.Cookies("ckUsername") = ""
Response.Cookies("ckUsername").Expires = Date - 1
Response.Cookies("ckPassword") = ""
Response.Cookies("ckPassword").Expires = Date - 1
END IF
END IF
%>
|
Storing
a User's Login Details Using a Cookie (2 minutes)
Windows Media
Flash |
| Edit My Account page |
This is simple -- simplest if you use the Record Update Form wizard,
but you should create the recordset first. You
have to create a file called Edited.asp. I just copied the
recordset from editAccount.asp and displayed a few values -- enough
to show that the update worked. |
Update
account (5 minutes)
Windows Media
Flash |
| Administration Page |
When I followed the instructions on the bottom of page 287, my
dialog box looked like this:

Note that the first line is different from the one in the book.
|
|