Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --#Variables
- --##GLOBAL
- F16 = {}
- F16.author = "Adam Hellberg"
- F16.version = 0.1
- F16.longver = "Version 0.1 (1)"
- F16.errors = {}
- F16.errorcount = 0
- --#
- --##LOCAL
- local userbase = {}
- local user
- local password = {}
- local welmsgs = {}
- local loop = true
- --#
- --#Set default values
- userbase.admin = "s3cr37p455"
- password.set = "null"
- password.check = "null"
- welmsgs[1] = "Welcome, press any key to login... "
- welmsgs[2] = "Hi, press any key to login... "
- welmsgs[3] = "Howdy, press button to login... "
- welmsgs[4] = "Yo, press da button to login... "
- --#
- --#Functions
- function welmsg()
- welmsgs.select = math.random(1, 4)
- print(welmsgs[welmsgs.select])
- end
- function createuser()
- print("\nInput the username you want: ")
- user = io.read()
- print("\nInput the password you want: ")
- password.set = io.read()
- print("\nInput password again to check: ")
- password.check = io.read()
- if password.set == password.check then
- print("\n\nSuccess! User created. Press any key to continue...")
- userbase[user] = password.set
- io.read()
- else
- print("\n\n\nAction failed. User not created (The passwords didn't match or you did something very wrong.)\nThe program will now exit...")
- F16.errorcount = F16.errorcount + 1
- F16.errors[F16.errorcount] = "Action failed. User not created (The passwords didn't match or you did something very wrong. The program will now exit..."
- loop = false
- io.read()
- end
- end
- function login()
- print("\n\nPlease input username: ")
- user = io.read()
- if userbase[user] == nil then
- print("\n\n\nError, user does not exist. Create it? Y/N... ")
- user = io.read()
- if user == "Y" or user == "y" or user == "yes" then
- createuser()
- else
- user = "null"
- end
- else
- print("\nPlease input password: ")
- password.set = io.read()
- if userbase[user] == password.set then
- print("\n\nLogin successful! Press any key to restart... ")
- io.read()
- user = "null"
- password.set = "null"
- end
- end
- end
- function startloop()
- while loop == true do
- print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
- welmsg()
- io.read()
- login()
- end
- print("\n\n\nError occurred, press any key to exit... ")
- io.read()
- end
- --#
- --#Main
- startloop()
- --#DEBUGGING
- local debugcount
- for debugcount=1,20,1 do
- print(F16.errors[debugcount]
- end
- --#
- --#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement