I need to do an assignment with IF and ELSE conditional statements in a textbox entry form. I am stuck because I can basically create two text fields where it asks first name and second name BUT when I need to enter a password in a text box it stops working because it is a string not a statement. Does that make sense to anyone? PLease can you help me as I am really REALLY stressed.
Thanks
PLease can you help with my computer programming?
What are the conditional statements supposed to do? check for valid values?
you would use an
if %26lt;condition1%26gt;
elseif %26lt;condition2%26gt;
elseif %26lt;condition3%26gt;
endif
a textbox that is a password is exactly the same as a textbox for name..
if you update or email me with more info I can try and help out more.
Reply:Sound like you have
If(myPassword) Then
End If
'you need a comparison against the string.
If(myPassword = storedPassword) Then
'Your code to sign in
End If
Reply:Am simply extracting this from my program, hope you can understand it:
This part of the program is where Password is requested for and accepted;
SELECT FSPASWOD
SET EXACT ON
CNT1 := 17
PASSWDROW := 17
PASSWDCOL := 10
cPassReqd := "PW"
getpass(cPassReqd)
USERPWOD := PASSWORDER
IF ALLTRIM(USERPWOD) != ALLTRIM(MVUSERPWOD)
SET EXACT OFF
ERRORCOUNT --
MVERRCOUNT ++
SELECT FSPASWOD
REPLACE FSPASWOD-%26gt;MPERRCOUNT WITH MVERRCOUNT
TONE(800,14)
TONE(400,12)
TONE(200,18)
@ 16,7 CLEAR TO 19,67
@ 16,8 SAY "Forgotten Your PASSWORD ?, See Computer Manager For Help" COLOR "R+/N"
@ 17,10 SAY "You Have " COLOR "R+/N"
@ 17,COL() SAY TRANSFORM(ERRORCOUNT,"9") COLOR "GR+/N"
@ 17,COL() SAY " More Attempts Before You Are Locked Out" COLOR "R+/N"
@ 18,20 SAY "PRESS ANY KEY TO RETRY" COLOR "GR+/N"
i_ky := INKEY(0)
@ 16,7 CLEAR TO 19,67
SELECT FSUSELOG
MVLOGNUMBR := FSUSELOG-%26gt;MPLOGNUMBR + 1
IF NetTryUI(5, {|| DbAppend(), !NetErr()}, ;
{|| Alert("Append Failed, Retry? ", {"Yes", "No"}) == 1})
REPLACE FSUSELOG-%26gt;MPLOGNUMBR WITH MVLOGNUMBR
REPLACE FSUSELOG-%26gt;MPUSERNAME WITH MVUSERNAME
REPLACE FSUSELOG-%26gt;MPDESCRPTN WITH MVDESCRPTN
REPLACE FSUSELOG-%26gt;MPRUNDATED WITH DATE()
REPLACE FSUSELOG-%26gt;MPRUNTIMED WITH TIME()
REPLACE FSUSELOG-%26gt;MPJOBSNAME WITH "LOGGING IN"
REPLACE FSUSELOG-%26gt;MPUSERPWOD WITH TRIM(USERPWOD)
REPLACE FSUSELOG-%26gt;MPUSERSPIN WITH TRIM(USERSPIN)
REPLACE FSUSELOG-%26gt;MPCOMMENTS WITH "FAILED"
REPLACE FSUSELOG-%26gt;MPJOBSTATU WITH "FAILED"
ENDIF
UNLOCK ALL
IF TRIM(USERNAME) = "MANAGER"
ERRFLAG := "T"
CNT1 := 1
CLOSE DATABASES
RELEASE ALL
DO WHILE ERRFLAG
SET ESCAPE OFF
TONE(800,4)
TONE(400,2)
TONE(200,8)
@ 16,8 CLEAR TO 19,67
@ 17,12 SAY "UNSUCCESFUL ATTEMPT TO USE MANAGER'S FACILITIES" COLOR "GR+/N"
@ 18,12 SAY "PLEASE CALL ME THE COMPUTER MANAGER IMMEDIATELY" COLOR "GR+/N"
@ 16,8 CLEAR TO 19,67
TONE(800,4)
TONE(400,2)
TONE(200,8)
LOOP
ENDDO
@ 1,0 CLEAR TO 23,79
CLOSE DATABASES
RELEASE ALL
QUIT
ELSE
IF FSPASWOD-%26gt;MPERRCOUNT %26gt; 5
TONE(500,2)
TONE(400,2)
@ 17,7 CLEAR TO 19,67
@ 17,10 SAY "Password Error, You Will Be Suspended For A Week" COLOR "GR+/N"
@ 18,10 SAY "You May See Computer Manager For Early Clearance" COLOR "GR+/N"
SELECT FSPASWOD
REPLACE FSPASWOD-%26gt;MPSUSPDATE WITH DATE() + 7
i_ky := INKEY(15)
CLEAR
CLOSE DATABASES
QUIT
ELSE
TONE(800,4)
LOOP
ENDIF
ENDIF
ENDIF
**************************************...
And this is the routine that does the Password validation.
* Getpass.prg
*
* Password GET - echoing asterisks
*/
#include "Getexit.ch"
#include "Inkey.ch"
#include "Getpass.ch"
FUNCTION Getpass(cPassReqd)
//LOCAL cVar1 := Space(10), ;
LOCAL cVar1 := Space(16), ;
cVar2 := Space(15), ;
cVar3 := Space(12)
LOCAL GetList := {}
if cPassReqd = "PW"
@ PASSWDROW,PASSWDCOL SAY " Enter User Password : " ;
GET cVar1 PASSWORD PICTURE "XXXXXXXXXXXXXXXX"
READ
else
@ PASSWDROW,PASSWDCOL SAY "Enter User Pin Number : " ;
GET cVar1 PASSWORD PICTURE "XXXXXXXXXXXXXXXX"
READ
endif
PASSWORDER := cVar1
RETURN NIL
proc GetPassword( oGet )
LOCAL nKey, ;
nChar, ;
cKey
// read the GET if the WHEN condition is satisfied
IF ( GetPreValidate(oGet) )
// activate the GET for reading
oGet:SetFocus()
oGet:cargo := ""
DO WHILE ( oGet:exitState == GE_NOEXIT )
// check for initial typeout (no editable positions)
IF ( oGet:typeOut )
oGet:exitState := GE_ENTER
ENDIF
// apply keystrokes until exit
DO WHILE ( oGet:exitState == GE_NOEXIT )
nKey := InKey(0)
IF nKey %26gt;= 32 .AND. nKey %26lt;= 255
oGet:cargo += Chr(nKey)
GetApplyKey(oGet, Asc("*"))
ELSEIF nKey == K_BS
oGet:cargo := Substr(oGet:cargo, 1, Len(oGet:cargo) - 1)
GetapplyKey(oGet, nKey)
ELSEIF nKey == K_ENTER
GetApplyKey(oGet, nKey)
ENDIF
ENDDO
// disallow exit if the VALID condition is not satisfied
IF ( !GetPostValidate(oGet) )
oGet:exitState := GE_NOEXIT
ENDIF
ENDDO
// de-activate the GET
oGet:KillFocus()
ENDIF
IF oGet:exitState != GE_ESCAPE
oGet:varPut(oGet:cargo)
ENDIF
RETURN
wedding song
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment