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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login code problem

Status
Not open for further replies.

jhonny03

Programmer
Oct 28, 2015
23
PH
here is my code in my login form:

Code:
LOCATE FOR Username = ALLTRIM(thisform.txtuname.value) AND utype = ALLTRIM(thisform.combo1.DisplayValue)
  IF FOUND()
 
    If  alltrim(thisform.txtuname.value)= alltrim(Username) AND ALLTRIM(thisform.combo1.DisplayValue) =ALLTRIM(utype) AND ALLTRIM(thisform.Cmb_question.DisplayValue) =ALLTRIM(Question) AND ALLTRIM(thisform.txt_ans.value) =ALLTRIM(Ans) THEN 
        Do something...
    else
        messagebox('Please recheck your input1!',16," Error input!")
    ENDIF
  else
        messagebox('Please recheck your input2!',16," Error input!")
    endif

my problem is that it always shows the 1st message:
Code:
 messagebox('Please recheck your input1!',16," Error input!")

I already check the code:
Code:
 If  alltrim(thisform.txtuname.value)= alltrim(Username) AND ALLTRIM(thisform.combo1.DisplayValue) =ALLTRIM(utype) AND ALLTRIM(thisform.Cmb_question.DisplayValue) =ALLTRIM(Question) AND ALLTRIM(thisform.txt_ans.value) =ALLTRIM(Ans) THEN
and it seems to be correct..
Is there something wrong in my code?
tns in advance..
 
Have you used the debugger to look at the actual values you're using in this locate? That's usually pretty good at telling you exactly what's there.

Is one side of the equation all upper while the other side is mixed case?

The debugger will tell you.
 
tnx for your reply..
I got the solution to my problem and it was the data on my table..
it was me being careless..by the way thanks..
 
By the way: Comparisons like Field = ALLTRIM(inputvalue) are inviting users to get through login with no input, ie see what "Admin"="" is - with EXACT OFF (that is the default setting) this'll be true.

Ensure your string comparisons are always made exact by using == instead of = or via SET EXACT ON.
Also ensure users can't enter NULL via CTRL+0 by disabling that hotkey via ON KEY LABEL CTRL+0 *, because "Username"=NULL is NULL, not false.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top