Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging In and Out with Sessions

Status
Not open for further replies.

rchen

IS-IT--Management
Mar 7, 2003
16
0
0
SG
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top