Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Password string to ******** ??
#1
Once again, thanks guys, you've helped me without insulting me...
so i have a question...again Big Grin

How to make password string look like "******"

for example(you probably don't need it but I'm just trying to act smart Tongue )

Code:
CLS

'Socalled First Page

PRINT "Hello!"
PRINT
PRINT "You have entered to -dezell-'s program"
PRINT "Do you wish to continue?"
INPUT "You Choice:  1=[Yes] 2=[No]: "; choice
IF choice = 1 THEN GOTO 2
IF choice = 2 THEN GOTO 1
1 : CLS
END

'Identifying person

2 : PRINT "So you've decided to continue..."
PRINT "Now...identify yourself"
PRINT "Username"
DO
INPUT user$
LOOP UNTIL user$ = "dezell"
PRINT "Hi dezell !"
PRINT "Now I'd like to check your password"

'password section

DO
INPUT pas$
LOOP UNTIL pas$ = "BiBaBo"
CLS

'   --- And here should come the code, which would make pas$ characters look like ****** <-------


PRINT "Everything seems OK!"

Got too much creative on this one, but heck with it...u got it anyway Tongue
Waiting for any answers Smile

Oh, one more question
how do you make this QBASIC code?
with what tags?
[qbasic]
PRINT "mama"
[/qbasic]
doesn't seem to work...

Thanks! 8)
Reply
#2
You have to make your own input function. and since im in a thinking mood. I made one =P


[syntax="QBASIC"]FUNCTION inputblur$ (question$, blurchar$)
IF LEN(question$) > 0 THEN PRINT question$ + " ";
x = POS(0)
y = CSRLIN
DO
DO: press$ = INKEY$: LOOP UNTIL LEN(press$) > 0
SELECT CASE press$
CASE CHR$(13): EXIT DO
CASE CHR$(8)
IF LEN(foo$) > 0 THEN
LOCATE y, x: PRINT STRING$(LEN(foo$), " ")
foo$ = LEFT$(foo$, LEN(foo$) - 1)
END IF
CASE ELSE: foo$ = foo$ + press$
END SELECT
LOCATE y, x
IF LEN(blurchar$) > 0 THEN
PRINT STRING$(LEN(foo$), blurchar$)
ELSE
PRINT foo$
END IF
LOOP
inputblur$ = foo$
END FUNCTION[/syntax]

to use it you do

Code:
a$ = inputblur$ ("What's your name?", "*")

and to make it have syntax highlighting you use this tag

Code:
[syntax="QBASIC"]Print "PIE!"[/syntax]


EDIT: made it select case
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)