
Username
<%
dim username, password, loginButton
username=TRIM(Request("username"))
password=TRIM(Request("password"))
logButton=Request("loginButton")="Login"
if logButton then
Dim Con, sql, rec
set Con = Server.CreateObject("ADODB.Connection")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
'Select the record matching the username.
sql = "SELECT * FROM tblusers WHERE UCase(username)='
"& UCase(username) & "' AND UCase(password)=' " & UCase(password) & " ' "
set rec=Con.execute(sql)
'If no match found, EOF is not true.
if NOT rec.EOF then
Response.Redirect("somepage.asp") 'Change to page redirect to after login
else
blankError="Invalid username." 'EOF is true, no match found.
end if
end if
%>
Login
EMPLOYEE EMAIL
|