% dbpath=Request.ServerVariables("PATH_TRANSLATED") dbpath=Replace(dbpath,"login.asp","RoyalMintExchange.mdb") Application("DBProvider")="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbpath + ";Persist Security Info=False" if Request.Form("rsvCommand")="csLogin" then strUsername=Request.Form("Username") strPassword=Request.Form("Password") errImminent=0 if len(StrUsername)=0 then errUsername=1 errImminent=1 end if if len(StrPassword)=0 then errPassword=1 errImminent=1 end if 'Now we check with the database if errImminent=false then Set conDatabase=Server.CreateObject("ADODB.Connection") conDatabase.Open Application("DBProvider") Set recRecordset=conDatabase.Execute ("SELECT lngID FROM tblUsers WHERE strUsername=""" + strUsername + """ AND strPassword=""" + strPassword + """") if recRecordset.EOF=false then conDatabase.close Set conDatabase=nothing Response.Cookies("Login")("Username")=strUsername Response.Cookies("Login")("Password")=strPassword Response.Cookies("Login").Path="/" response.redirect "frmmain.asp" else errImminent=2 end if conDatabase.close Set conDatabase=nothing end if end if %>
|