Title: LoginEntry'asp
1actor
computer
USER LOGIN
LoginEntry.asp
Login Entry
LoginValidation.asp
Validate Login
USER
invalid login
Display Error
valid login
Display Success
2USER
CREATE TABLE USER ( ID TEXT (20) PRIMARY KEY NOT
NULL, Password TEXT (10) NOT NULL, Name TEXT (50)
NOT NULL, eMail TEXT (100) )
http//www.w3schools.com/sql/sql_create.asp
3LoginValidation.asp
lt ASP code gt
http//www.w3schools.com/asp/asp_syntax.asp
4LoginValidation.asp
'variables dim Connection, RecordSetData,
SQLStatement
http//www.w3schools.com/asp/asp_variables.asp
5LoginValidation.asp
'database connection Set ConnectionServer.Create
Object("ADODB.Connection") Connection.Provider
"Microsoft.Jet.OLEDB.4.0" Connection.Open(Server.
Mappath("fpdb/journal.mdb"))
http//www.w3schools.com/ado/ado_connect.asp
6LoginValidation.asp
Set RecordSetData Server.CreateObject("ADODB.Rec
ordset")
http//www.w3schools.com/ado/ado_recordset.asp
7LoginValidation.asp
'SQL statement for Validation SQLStatement
"SELECT FROM USER " SQLStatement
SQLStatement ""
http//www.w3schools.com/sql/sql_select.asp
8LoginValidation.asp
on error resume next RecordSetData.Open
SQLStatement, Connection IF err ltgt 0
THEN Response.write ("ltugtltbgtTHERE IS AN ERROR
PROCESSING YOUR REQUESTlt/bgtlt/ugt") Response.write
("ltbrgt") Response.write ("Error " err.Number
"ltbrgt") Response.write ("Source "
err.Source "ltbrgt") Response.write
("Description " err.Description
"ltbrgt") Response.write (SQLStatement
"ltbrgt") ELSE Response.write (SQLStatement
"ltbrgt") Response.write ("ltbgtS U C C E S
Slt/bgtltbrgt") Response.write ("The first User.ID
is " RecordSetData("ID").value "ltbrgt") END IF
http//www.w3schools.com/ado/ado_recordset.asp
http//www.w3schools.com/ado/ado_ref_error.asp
9LoginValidation.asp
DO UNTIL RecordSetData.EOF FOR EACH FieldName
IN RecordSetData.Fields Response.Write(Fiel
dName.name) Response.Write(" ")
Response.Write(FieldName.value "ltbrgt")
NEXT Response.Write("ltbrgt")
RecordSetData.MoveNext LOOP RecordSetData.close C
onnection.close
http//www.w3schools.com/ado/ado_recordset.asp
10LoginValidation.asp
lt 'variables dim Connection, RecordSetData,
SQLStatement 'database connection Set
ConnectionServer.CreateObject("ADODB.Connection")
Connection.Provider"Microsoft.Jet.OLEDB.4.0"
Connection.Open(Server.Mappath("fpdb/journal.mdb"
)) Set RecordSetData Server.CreateObject("ADODB
.Recordset") 'SQL statement for
Validation SQLStatement "SELECT FROM USER
" SQLStatement SQLStatement "" on error
resume next RecordSetData.Open SQLStatement,
Connection IF err ltgt 0 THEN Response.write
("ltugtltbgtTHERE IS AN ERROR PROCESSING YOUR
REQUESTlt/bgtlt/ugt") Response.write
("ltbrgt") Response.write ("Error " err.Number
"ltbrgt") Response.write ("Source "
err.Source "ltbrgt") Response.write
("Description " err.Description
"ltbrgt") Response.write (SQLStatement
"ltbrgt") ELSE Response.write (SQLStatement
"ltbrgt") Response.write ("ltbgtS U C C E S
Slt/bgtltbrgt") Response.write ("The first User.ID
is " RecordSetData("ID").value "ltbrgt") END
IF DO UNTIL RecordSetData.EOF FOR EACH
FieldName IN RecordSetData.Fields
Response.Write(FieldName.name)
Response.Write(" ") Response.Write(FieldN
ame.value "ltbrgt") NEXT
Response.Write("ltbrgt") RecordSetData.MoveNext
LOOP RecordSetData.close Connection.close gt
11LoginValidation.asp
'SQL statement for Listing UserID request.form
("ID") UserPassword request.form
("Password") SQLStatement "SELECT FROM USER
" SQLStatement SQLStatement "WHERE (ID '"
UserID "' " SQLStatement SQLStatement " AND
" SQLStatement SQLStatement "Password '"
UserPassword "' )" SQLStatement SQLStatement
""
http//www.w3schools.com/sql/sql_where.asp
12LoginEntry.asp
lthtmlgt ltheadgt lttitlegtLoginEntrylt/titlegt lt/headgt
ltbodygt lttable border"0" cellpadding"0"
cellspacing"0" width"600"gt lttrgt lttdgt
ltform method"POST" action"LoginValidation.asp"gt
ltpgt Please enter your User Id ltinput
type"text" name"ID" size"20"gt and
Password ltinput type"password" name"Password"
size"10"gt .lt/pgt ltpgtltinput type"submit"
value"Login" name"LoginButton"gtltinput
type"reset" value"Reset" name"ResetButton"gtlt/pgt
lt/formgt lt/tdgt lt/trgt lt/tablegt lt/bodygt
lt/htmlgt
http//www.w3schools.com/asp/asp_syntax.asp
13LoginValidation.asp
Response.Cookies("USER")("ID")
RecordSetData("ID").value Response.Cookies("USER")
("Name") RecordSetData("Name").value Response.Coo
kies("USER")("eMail") RecordSetData("eMail").valu
e IF RecordSetData("ID").value gt ""
THEN response.redirect ("TheNextPage.asp") ELSE
response.redirect ("LoginEntry.asp") END IF
http//www.w3schools.com/ado/ado_recordset.asp