how can i Match user name and password ?

seenunandagiri

New Member
which code I need to replace in place of "?" in the following code in order to retrieve the user details from a database table?

<!--WSS
if get-value("loginName") ne "" then
DO:
if get-value("loginName") eq " ?" AND get-value("password") eq "?" then

-->
 
My best guess is it would be something like this (you will have to change it to make it work with your database tables of course):
Code:
[FONT=Courier New]<!--WSS[/FONT]
[FONT=Courier New]define variable cLogin    as character no-undo.[/FONT]
[FONT=Courier New]define variable cPassword as character no-undo.[/FONT]
[FONT=Courier New]define variable cMessage  as character no-undo.[/FONT]
 
[FONT=Courier New]assign cLogin   = get-value("loginName":U)[/FONT]
[FONT=Courier New]      cPassword = get-value("password":U).[/FONT]
 
[FONT=Courier New]if cLogin ne "":U and cLogin ne ? then[/FONT]
[FONT=Courier New]do:[/FONT]
[FONT=Courier New] find <userTable> no-lock where [/FONT]
[FONT=Courier New]      <userTable>.loginName eq cLogin [/FONT]
[FONT=Courier New]      no-error.[/FONT]
 
[FONT=Courier New] if   not available <userTable> [/FONT]
[FONT=Courier New] or   (available <userTable> and <userTable>.password ne encode(cPassword)[/FONT]
[FONT=Courier New] then cMessage = "Invalid Login Name or Password. Please try again".[/FONT]
[FONT=Courier New] else ......[/FONT]
 
[FONT=Courier New]end.[/FONT]
[FONT=Courier New]-->[/FONT]
HTH

Paul
 
Hi paul,

I tried with the code that u provided for login. But, I didn't get the desired output. what type of code I need to provide at the end "else" part to get the output.
 
Back
Top