Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Password string to ******** ??
#3
I wrote this a while back...didn't look at the code before posting right now, so, I don't know if I should be embarassed by it's lameness or not...I did test it, however, and the sub works...

Cheers

Code:
DECLARE SUB passWithConfirm (word$)
DECLARE SUB getpassword (word$, lin%)

SCREEN 0
COLOR 7
DEFINT A-Z


CALL passWithConfirm(pword$)

PRINT pword$

SUB getpassword (word$, lin)
COLOR 7
IF lin = 0 THEN
  LOCATE 7, 1
  PRINT "        Password:";
ELSEIF lin = 1 THEN
  LOCATE 8, 1
  PRINT "Confirm Password:";
END IF
'star$ = "*"
DO

  DO
    a$ = INKEY$
  LOOP UNTIL a$ <> ""

  SELECT CASE a$
  CASE CHR$(8)                               '<backspace>
      IF LEN(word$) THEN
        word$ = LEFT$(word$, LEN(word$) - 1)
        star$ = LEFT$(star$, LEN(star$) - 1)
      END IF
CASE CHR$(13)                              '<enter>
    EXIT DO

CASE CHR$(27)
    PRINT "escape pressed"
    END
CASE ELSE
    star$ = star$ + "*"
    word$ = word$ + a$
END SELECT
COLOR 14

LOCATE 7 + lin, 19
PRINT star$; " "

LOOP
COLOR 7
END SUB

SUB passWithConfirm (pword$)
DO
CLS
PRINT "Enter Password for file"

pwa$ = ""
pwb$ = ""

lin = 0
CALL getpassword(pwa$, lin)
lin = 1
CALL getpassword(pwb$, lin)
IF pwa$ <> pwb$ THEN
PRINT
PRINT "Password not Confirmed"
PRINT
PRINT "try again"
t# = TIMER: DO UNTIL TIMER - t# > 1: LOOP    '2-second pause
CLS
END IF
LOOP UNTIL pwa$ = pwb$                  'valid password selected
pword$ = pwa$



END SUB
Reply


Messages In This Thread
Password string to ******** ?? - by -dezell- - 09-27-2004, 02:29 AM
Password string to ******** ?? - by Mango - 09-27-2004, 08:35 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)