4 digit password entry method

Post Reply
User avatar
Dav
Posts: 279
Joined: Tue Dec 30, 2014 5:12 pm
My devices: iPad Mini, iPod Touch.
Location: North Carolina, USA
Contact:

4 digit password entry method

Post by Dav »

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

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


User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: 4 digit password entry method

Post by rbytes »

Works like a charm :P
The only thing that gets me down is gravity...

Post Reply