Advertisement
Sluethen

Lock system

Jul 20th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. --Usernames
  2. user1 = "Sluethen"
  3. user2 = "Admin"
  4. user3 = "Dev"
  5. --Passwords
  6. pass1 = "Sluethen"
  7. pass2 = "Admin"
  8. pass3 = "Dev"
  9. --End of Passwords
  10. function Verify(user,pass)
  11.    allowed = false
  12.    if user == user1 then
  13.      if pass == pass1 then
  14.        allowed = true
  15.      end
  16.    elseif user == user2 then
  17.       if pass == pass2 then
  18.         allowed = true
  19.       end
  20.    elseif user == user3 then
  21.       if pass == pass3 then
  22.         allowed = true
  23.       end
  24.     end
  25. end
  26. --Main program
  27. term.clear()
  28. term.setCursorPos(20,1)
  29. print("Security Lock")
  30. term.setCursorPos(15,2)
  31. print("Please enter your username")
  32. term.setCursorPos(15,5)
  33. write("Username:")
  34. username = read()
  35. term.setCursorPos(15,7)
  36. write("Password:")
  37. password = read("*")
  38. Verify(username,password)
  39. if allowed == true then
  40.   term.clear()
  41.   term.setCursorPos(1,1)
  42.   shell.run("cd users/"..username)
  43. else
  44.   term.setCursorPos(15,10)
  45.   print("Access denied!")
  46.   print("Rebooting...")
  47.   sleep(1)
  48.   shell.run("lock")
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement