Login & Passwords Problem

Results 1 to 2 of 2

Thread: Login & Passwords Problem

  1. #1
    Join Date
    Dec 1969

    Default Login & Passwords Problem

    Hi i am asp newbie and want some help.<BR>i have created a login page which collects<BR>email id and password from the user and <BR>call another asp page which processes this<BR>information . the email-id and password are<BR>stored in the msaccess database and if they match<BR>with the info supplied by the form , the user<BR>is redirected to success page other wise he <BR>is transferred to failure page.<BR>i am having problems with the script.<BR>below is the code ....<BR>&#060;% @Language ="VBScript" %&#062;<BR>&#060;!-- #include file ="db.inc" --&#062;<BR> <BR>&#060;%<BR> dim mailvar<BR> dim rssql<BR> dim rs<BR>mailvar= Request.Form("femail") <BR>rssql="select cemail, cpass from customers where (cemail = &#039" & mailvar & "&#039)"<BR> <BR> set rs = Server.CreateObject("ADODB.RecordSet")<BR> rs.open rssql, dbc<BR>%&#062;<BR>&#060;% <BR><BR><BR>if not rs.eof then rs.movefirst<BR>if not rs.eof then<BR> if request.form("fpass") = rs("cpass") and request.form("femail") = rs("cemail") then<BR> response.redirect "success.asp"<BR>else<BR> response.redirect "failure.asp"<BR> end if<BR>end if <BR>%&#062;<BR>&#060;% <BR>rs.close<BR>set rs=nothing<BR>dbc.close<BR>set dbc = nothing<BR>%&#062;<BR><BR>the user is always getting redirected to<BR>the failure page even when the email and password<BR>are correct.<BR><BR> thanks in advance & bye<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Login & Passwords Problem

    You have an extra If Then statement in your code. Try something like this:<BR><BR>&#060;% Response.Buffer = True %&#062;<BR><BR>&#060;%<BR>&#039Let&#039s get the values from the previous page<BR>mailvar = Request.Form("femail") <BR>mailvar = Request.Form("fpass") <BR><BR><BR>&#039 Create our connection<BR>Set Conntemp=Server.Createobject("ADODB.Connection")<B R>Conntemp.Open "DSN=DSNName"<BR><BR>&#039Create our recordset<BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR><BR>sqlT ext = "SELECT cemail, cpass FROM Customers "<BR>sqlText = sqlText & " WHERE cemail =&#039" & mailvar & "&#039"<BR>rs.Open sqlText, "DSN=DSNName"<BR><BR>&#039 Check for empty recordset which indicates user information was not found<BR>If NOT rs.EOF Then<BR> &#039Login was successful<BR> Response.Redirect "Success.asp"<BR>Else<BR> Response.Redirect "Failure.asp"<BR>End If<BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts