Qbasicnews.com
October 19, 2021, 09:58:07 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Password string to ******** ??  (Read 2797 times)
-dezell-
New Member

Posts: 7



WWW
« on: September 26, 2004, 06:29:10 PM »

Once again, thanks guys, you've helped me without insulting me...
so i have a question...again Cheesy

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 Smiley

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

Thanks! Cool
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #1 on: September 26, 2004, 07:01:10 PM »

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$(Cool
 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
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Mango
Wandering Guru
***
Posts: 360



« Reply #2 on: September 27, 2004, 12:35:03 AM »

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

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!