Posted: 7th Jan 2004 6:42
Here's a code for a password protection.The wrong thing about the code is it show the password, don't hide it with asterisk .

Right-click this links to download the media

http://www.mymedia.bravehost.com/media/arfimative.wav
http://www.mymedia.bravenethost.com/media/negative.wav



+ Code Snippet
LOAD SOUND "ARFIMATIVE.WAV",1 : LOAD SOUND "NEGATIVE.WAV",2  
 PASSWORD=300
DO
 MENUF:
 CLS : TEXT 150,0,"LOG ON AREA" : TEXT 150,103,"WHAT?" : TEXT 150,120,"1.LOG IN" : TEXT 150,133,"2.CHANGE PASSWORD"
 PRINT : INPUT "ENTER A # OF THE MENU>";ACTION : IF ACTION=1 THEN GOTO LOGIN 
 IF ACTION=2 THEN GOTO CHANGE
 LOGIN:
 CLS : TEXT 150,0,"LOG IN" : PRINT : INPUT "ENTER PASSWORD:";PASS : IF PASS=PASSWORD THEN PLAY SOUND 1 : SLEEP 3000 : GOTO MENUF ELSE PLAY SOUND 2 : SLEEP 3000 : TRIES#=1 : GOTO LOGIN 
 PRINT : PRINT "PRESS "SPACEBAR" TO GO TO THE MENU" : IF SPACEKEY()=1 THEN GOTO MENUF
 CHANGE:
 CLS : TEXT 150,0,"CHANGE PASSWORD" : PRINT : PRINT : INPUT "ENTER OLD PASSWORD:";OLD
 IF OLD<>PASSWORD THEN PRINT "INVALID OLD PASSWORD" : SLEEP 4000 : GOTO CHANGE : IF OLD$=PASSWORD$ THEN GOTO NEW
 NEW:
 INPUT "ENTER NEW PASSWORD (#'S ONLY):";NEW : PASSWORD=NEW
 SLEEP 4000
 GOTO MENUF
LOOP
Posted: 9th Jan 2004 0:33
when it is time to enter in the password, you could turn on the sync and go to a seperate do-loop. then, rather than using the input comand, you could use the inkey$() comand. each time a key is pressed, add a inc a varable that controls how many strisses are shown on the screen. then save whatever key that was pressed to a slot in an array. once they have entered in the right amount of digits to the code, convert each individual number to a string. combine them into one variable and then convert that single string back to numbers. then check it for accuracy and all that stuff. I'm not going to include any code because you have a rather unique personalized coding format and it's alwayse a pain trying to read the coding of others.

good luck
Posted: 9th Jan 2004 0:36
soary. forgot to tell you what that is for. that will make it so that *'s are shown instead of the password that they type in
Posted: 9th Jan 2004 0:48
The code was for the "bank" what I made http://darkbasic.thegamecreators.com/?m=forum_view&t=22726&b=6
.Thanks for the help
Posted: 9th Jan 2004 1:08
Here is a real-time password input for you

Enter "hi" and press enter

+ Code Snippet
rem Create a slowly sync'd loop for keyboard entry
sync on : sync rate 20

rem A nice font
set text font "Arial" : set text size 32

real_password$="hi"
rem Main loop
do
pasline$=""
rem Build line string
new$=entry$()
if returnkey()=1 and real_password$=line$ then end
for n=1 to len(new$)
	if asc(mid$(new$,n))=8
		line$=left$(line$,len(line$)-1)
	else
		line$=line$+mid$(new$,n)
	endif
next n
clear entry buffer

rem Show Entry Buffer
cls rgb(64,64,64)
center text 320,200,"ENTER YOUR PASSWORD"

for i=1 to len(line$)
	pasline$=pasline$+"*"
next i



center text 320,240,pasline$
`center text 320,260,line$
rem Update screen
sync

rem End loop
loop
Posted: 9th Jan 2004 1:13
Thanks.I'll put it in my code.I just wondering in a string variable I can store number too?
like this

realpass$="comando300"
Posted: 9th Jan 2004 2:56
Oh.I put the Piratss' code to mine.
Look


+ Code Snippet
sync on : sync rate 20

PASSWORD$="comando"
rem Main loop

pasline$=""
rem Build line string
new$=entry$()
if returnkey()=1 and PASSWORD$=line$ then GOTO MENU
for n=1 to len(new$)
	if asc(mid$(new$,n))=8
		line$=left$(line$,len(line$)-1)
	else
		line$=line$+mid$(new$,n)
	endif
next n
clear entry buffer

rem Show Entry Buffer
cls rgb(64,64,64)
center text 320,200,"ENTER YOUR PASSWORD"

for i=1 to len(line$)
	pasline$=pasline$+"*"
next i



center text 320,240,pasline$
`center text 320,260,line$
rem Update screen
sync

rem End loop
loop



If you can make it smaller or easy.Well,post it.
Posted: 9th Jan 2004 2:58
Opps that's not the code
It's


+ Code Snippet
 REM **************************************
 REM * A PASSWORD PROTECTION FOR THE BANK *
 REM *                       **************
 REM *       PABLO J.        *
 REM *                       *
 REM *      HOMESTUDIO®      *
 REM *************************
PASSWORD$="comando"
hide mouse
do
rem A nice font
set text font "Arial" : set text size 32
MENU:
CLS : TEXT 150,0,"LOG ON AREA" : TEXT 150,103,"WHAT?" : TEXT 150,130,"1.LOG IN" : TEXT 150,170,"2.CHANGE PASSWORD"
PRINT : print : print : INPUT "ENTER A # OF THE MENU>";ACTION : IF ACTION=1 THEN GOTO LOGIN 
IF ACTION=2 THEN GOTO CHANGE : IF ACTION=>3 THEN PRINT "INVALID INPUT" : SLEEP 1000 : GOTO MENU
loop



do 
LOGIN:
rem Create a slowly sync'd loop for keyboard entry
sync on : sync rate 20


rem Main loop

pasline$=""
rem Build line string
new$=entry$()
if returnkey()=1 and PASSWORD$=line$ then GOTO MENU
for n=1 to len(new$)
	if asc(mid$(new$,n))=8
		line$=left$(line$,len(line$)-1)
	else
		line$=line$+mid$(new$,n)
	endif
next n
clear entry buffer

rem Show Entry Buffer
cls rgb(64,64,64)
center text 320,200,"ENTER YOUR PASSWORD"

for i=1 to len(line$)
	pasline$=pasline$+"*"
next i



center text 320,240,pasline$
`center text 320,260,line$
rem Update screen
sync

rem End loop
loop



CHANGE:
cls
DO
sync on : sync rate 20


rem Main loop

pasline$=""
rem Build line string
new$=entry$()
if returnkey()=1 and PASSWORD$=line$ then GOTO NEW
for n=1 to len(new$)
	if asc(mid$(new$,n))=8
		line$=left$(line$,len(line$)-1)
	else
		line$=line$+mid$(new$,n)
	endif
next n
clear entry buffer

rem Show Entry Buffer
cls rgb(64,64,64)
center text 320,200,"ENTER OLD PASSWORD"

for i=1 to len(line$)
	pasline$=pasline$+"*"
next i



center text 320,240,pasline$
`center text 320,260,line$
rem Update screen
sync

rem End loop
loop


NEW:
cls
DO
sync on : sync rate 20


rem Main loop

pasline$=""
rem Build line string
new$=entry$()
if returnkey()=1 then GOTO MENU
for n=1 to len(new$)
	if asc(mid$(new$,n))=8
		line$=left$(line$,len(line$)-1)
	else
		line$=line$+mid$(new$,n)
	endif
next n
clear entry buffer

rem Show Entry Buffer
cls rgb(64,64,64)
center text 320,200,"ENTER NEW PASSWORD"

for i=1 to len(line$)
	pasline$=pasline$+"*"
next i

PASSWORD$=LINE$

center text 320,240,pasline$
`center text 320,260,line$
rem Update screen
sync

rem End loop
loop


If you can make ot smaller or easy.Well,post it
Posted: 9th Jan 2004 23:58
why do you bother giving them the optiton of changing the password if your just goin to tell the program to change the password back to "commando" everytime they run the program again
Posted: 10th Jan 2004 6:53
I know,I know,but this just an idea.Then you can use open to read, read long, etc... commands to the program save the lastest changes
Posted: 13th Jan 2004 22:49
Why is it called 'protection' if the password isn't stored, read, or even encrypted in any form?
Posted: 13th Jan 2004 23:21
I know,I know,but this just an idea.Then you can use open to read, read long, etc... commands to the program save the lastest changes

This is just for the people borrow it.And put it their programs then they can make changes.