% Option Explicit %> <% on error resume next dim objConn,objRsMaterials,objRsUsers dim strUserID,strPassword,strError,strQuery,sql dim intID strUserID=request.form("txtUserID") strPassword=request.form("txtPassword") if not Session("DS_Login") and request.form("strBeenHere")<>"" then if strUserID="" then strError="Username is required" end if if strError="" then if strPassword="" then strError="Password required" end if end if if strError="" then set objConn=Server.CreateObject("ADODB.Connection") objConn.Open "DSN=DESIGNSPRINGS" set objRsUsers=Server.CreateObject("ADODB.Recordset") strQuery="SELECT * FROM tblUsers WHERE Username='" & LCase(strUserID) & "';" objRsUsers.Open strQuery,objConn,adOpenForwardOnly,adLockOptimistic,adCmdText if objRsUsers.eof then strError="Invalid login information" else if LCase(strPassword)<>objRsUsers("Password") then strError="Invalid login information" else Session("DS_Login")=true Session("DS_UserID")=objRsUsers("ID") if LCase(strUserID)<>"administrator" then sql="INSERT INTO tblLog (UserID,DateLogin,Address) VALUES (" & objRsUsers("ID") & ",#" & Now & "#,'" & request.servervariables("REMOTE_ADDR") & "');" objConn.Execute(sql) else Session("DS_Admin")=true end if objRsUsers.Close objConn.Close set objRsUsers=Nothing set objConn=Nothing response.redirect "default.asp" end if end if objRsUsers.Close objConn.Close set objRsUsers=Nothing set objConn=Nothing end if elseif Session("DS_Login") then response.redirect "default.asp" end if %>