When a person logs in onto the system it creates a session variable from the recordset of a table:
When I logout I run
Session.abandon
Response.redirect "index.html"
This works, but when I try to log back in it will give me an invalid login. Here is my code for login.
if isempty(Request.Form("cmdSubmit") then
strmsg = "Please enter your login information"
else
Set DbObj = Server.CreateObject("ADODB.Connection"
Set RSList = Server.CreateObject("ADODB.Recordset"
DbObj.Open "DSN=Byars-Project13;UID=;PWD=;"
SQL = "select * from tblCustomer where State = '" & Request.Form("cboState" & "' and DriversLicense = '" & Request.Form("txtDLNum" & "' and password = '" & Request.Form("txtPassword" & "';"
RsList.Open SQL, DbObj,adOpenForwardOnly, adLockReadOnly, adCmdText
' check end of file to see if login and password were legal
If Rslist.EOF Then
' if not legal, set session to "" and go to invalid page
Session ("CustomerID" = ""
strmsg = "Invalid login, please try again"
Else
' if legal login, set session to userID and go to main menu
Session ("CustomerID" = RsList("CustomerID"
Response.Redirect "main.asp"
End If
Rslist.close
set dbobj = nothing
set rslist = nothing
End If
%>
Robert
When I logout I run
Session.abandon
Response.redirect "index.html"
This works, but when I try to log back in it will give me an invalid login. Here is my code for login.
if isempty(Request.Form("cmdSubmit") then
strmsg = "Please enter your login information"
else
Set DbObj = Server.CreateObject("ADODB.Connection"
Set RSList = Server.CreateObject("ADODB.Recordset"
DbObj.Open "DSN=Byars-Project13;UID=;PWD=;"
SQL = "select * from tblCustomer where State = '" & Request.Form("cboState" & "' and DriversLicense = '" & Request.Form("txtDLNum" & "' and password = '" & Request.Form("txtPassword" & "';"
RsList.Open SQL, DbObj,adOpenForwardOnly, adLockReadOnly, adCmdText
' check end of file to see if login and password were legal
If Rslist.EOF Then
' if not legal, set session to "" and go to invalid page
Session ("CustomerID" = ""
strmsg = "Invalid login, please try again"
Else
' if legal login, set session to userID and go to main menu
Session ("CustomerID" = RsList("CustomerID"
Response.Redirect "main.asp"
End If
Rslist.close
set dbobj = nothing
set rslist = nothing
End If
%>
Robert