home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
nvdc87
/
thinkpal
/
passwd.sc
< prev
Wrap
Text File
|
1987-08-31
|
2KB
|
55 lines
; Checkpass procedure to check passwords and user names
: NOTE: Requires Paradox 2.0
;
PROC Checkpass() ; header contains name of proc
PRIVATE nameok, pass, username ; variables private to proc
PASSWORD "dontshowit" ; present password for protected
; "secrets" table
VIEW "secrets" ; places secrets table on workspace
MOVETO FIELD "name" ; makes "name" field current
FOR i FROM 1 TO 3 ; top of FOR loop to check name
@2,4 ? "Enter your name: " ; prompt user
ACCEPT "A15" TO username ; get input
CURSOR OFF
@5,5 CLEAR EOS
CURSOR NORMAL
LOCATE username ; is name in the table?
IF retval ; Yes, so
THEN nameok = True ; go on to the
QUITLOOP ; next step
ELSE ; No, so
BEEP ; tell the user about it
MESSAGE "That name can't be found"
nameok = False
ENDIF
ENDFOR
IF nameok ; was a valid name presented?
THEN ; Yes, so
FOR i FROM 1 TO 3 ; check for valid password
@2,4 ? "Enter your password: "
ACCEPT "A15" TO pass
IF [password] = pass ; password is good
THEN
CLEARALL ; clear table from workspace
UNPASSWORD "dontshowit" ; reprotect table
RETURN True ; set value and return
ELSE ; password no good
BEEP
MESSAGE "Invalid password"
ENDIF
ENDFOR
CLEARALL ; user failed after 3 tries
UNPASSWORD "dontshowit"
RETURN False
ELSE ; user presented an invalid name
CLEARALL
UNPASSWORD "dontshowit"
RETURN False
ENDIF
ENDPROC ; end of procedure definition
IF NOT Checkpass() ; call Checkpass
THEN EXIT ; if not True, then exit ENDIF