ahead: you should really use proper HTML ... eg. <input type="text" name="username" />
Sub CheckLogin ... i would replace the LCase() by Trim() to filter trailing spaces and keep case sensivity
strUserName = Trim(Request.Form("username")) : strPass = Trim(Request.Form("userpass"))
for a basic security add some Replace() on both: strUserName and strPass
str = Replace(str, "'", "''") : str = Replace(str, "%", "") : str = Replace(str, "*", "")
Set objCon = Server.CreateObject("ADODB.Connection")
Set objRst = Server.CreateObject("ADODB.RecordSet")
objCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath("/database.mdb")
strSQL = "SELECT ID FROM tblUser WHERE UserName = '" & strUserName & "' AND Pass = '" & strPass & "'"
objRst = objCon.Execute(strSQL, lngRec, adCmdText)
IF NOT(objRst.EOF AND objRst.BOF) Then blnLogin = TRUE ELSE blnLogin = FALSE
objRst.Close : SET objRst = NOTHING
objCon.Close : SET objCon = NOTHING
IF blnLogin THEN
Session("UserLoggedIn") = TRUE
Response.Redirect("/protectedpage.asp")
ELSE
'prepare some error message eg. strMsg = "sorry, ...."
END IF
adCmdText is an ADO parameter and can be replaced by 1
lngRec is just a return value (see execute method for details)
intermediate using of blnLogin, what appears more complicated, allows to close and destroy objects either of you redirect or not (your server will appreciate this)
the - also more complicated looking - IF NOT() construct makes sure you're catching all unexpected positives
i'd recommend use Option Explicit after the language directive and declare variants to avoid basic mistakes
hth, christian