error in login page

Results 1 to 3 of 3

Thread: error in login page

  1. #1
    Tran Guest

    Default error in login page

    Hi I&#039;m writing a login page to check for the userid & password.<BR>I&#039;m getting this error:<BR>Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record. <BR><BR>I understand what it means, but why do I get this error??<BR>First I&#039;m checking if the input userid or password doesn&#039;t match the ones in the database then display error.htm. If the userid=&#039;user1&#039; & password =&#039;user1&#039; then display page1.htm. Then if everybody else display page2.htm.<BR>Thanks for your help!<BR><BR>&#060;%Response.Buffer = true%&#062; <BR>&#060;!--#include file ="ADOVBS.asp"--&#062;<BR>&#060;%<BR>id=Request.Querystring("id")< BR>pass=Request.Querystring("pass")<BR><BR>Dim cn,rs,str,varid,varpass<BR>set cn=Server.CreateObject("ADODB.connection")<BR>set rs=Server.CreateObject("ADODB.Recordset")<BR>cn.Op en "DSN=pass"<BR><BR>str="SELECT * FROM table1 WHERE userid=&#039;" & id & "&#039; and password=&#039;" & pass & "&#039; "<BR>rs.Open str, cn<BR><BR>varid=rs("userid")<BR>varpass=rs("passwo rd")<BR><BR>if varid &#060;&#062; id or varpass &#060;&#062; pass then<BR>response.redirect "error.htm"<BR>end if<BR>if (varid="user1" and varpass="user1") then<BR>response.redirect "page1.htm"<BR>else<BR>response.redirect "page2.htm"<BR>end if<BR><BR>rs.MoveNext<BR>rs.Close<BR>Set rs=nothing<BR>cn.Close<BR>Set cn=nothing<BR><BR>%&#062;<BR><BR>

  2. #2
    BAM Guest

    Default RE: error in login page

    If there is not a valid user then the recordset will be empty. So on your error checking instead of doing if varid&#060;&#062; id, etc. Do if rs.eof then redirect to the error page. Understand?? There will be no varid or varpass to compare the input to if the recordset is empty.

  3. #3
    LL Guest

    Default RE: error in login page

    perform 2 checks:<BR><BR>1st check:<BR>id=Request.Querystring("id") <BR>pass=Request.Querystring("pass") <BR>Response.write "id " & ID & " " & "pass " & pass<BR><BR>2nd check:<BR>If Id and Pass are blank then your recordset will be empty, or maybe your table doesn&#039;t contain any data that match id and pass.<BR>check here

Posting Permissions

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