4 digit password entry method
Posted: Thu Sep 24, 2015 2:37 pm
I needed a simple password method for a private journal program I made and came up with this. It prompts the user for a four digit password. Nothing fancy. Has option of hiding password on screen. I'll try and post a screenshot soon.
- Dav
- Dav
Code: Select all
'4pass.txt
'A simple 4 digit password entry method.
'Can hide password while typing.
'Coded by Dav, SEP/2015
graphics
graphics clear
set buttons custom
set buttons font size 56
draw font size 56
draw text "Enter code.." at 200,56
draw font size 300
password$="0000" '<<< your password here
showpass=0 '<<< set 0 to show * instead
draw color 0,0,0
for t =0 to 9
button t text t at 60+(t*60), 400
next t
count=0
do
for t =0 to 9
if button_pressed(str$(t)) then
count=count+1
pass$=pass$&str$(t)
graphics clear
if showpass=1 then
draw text pass$ at 10,100
else
'draw text "*" at 10,100
draw text string$(count,"*") at 10,100
end if
end if
next t
until count=4
for t =0 to 9 ! button t delete ! next t
graphics clear
draw font size 56
if pass$<>password$ then
draw text "WRONG!" at 300,56
else
draw text "RIGHT!" at 300,56
end if
def string$(num, a$)
b$=""
for g=1 to num
b$=b$&a$
next g
return b$
end def