Advertisement
55Navyboy

Login System 0.1

May 14th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw -- Prevents CTRL+T shortcut
  2.  
  3. term.clear() -- Clears the screen
  4. term.setCursorPos(1, 1) -- This places the print position to the top of screen
  5.  
  6. username = {"Aryan", "user2", "user3"} -- Here you need to define all usernames available
  7. password = {"Cooldogchris12", "pass2", "pass3"} -- Here you define what password each user has, remember to put user1's password in the first row and so on.
  8. print("|########################|")
  9. print("| SYSTEM LOGIN |")
  10. print("| OS Version : 1.3 |")
  11. print("|########################|")
  12. print("")
  13. write("Username: ")
  14. user = read()
  15.  
  16. write("Password: ")
  17. pass = read('*') -- This prevents people from reading the password as you put it in
  18.  
  19. for i=1, #username do -- Starts a loop
  20. if user == username[i] and pass == password[i] then
  21. access = true
  22. end
  23. end
  24.  
  25. if access == true then
  26. print("Logging in...")
  27. sleep(1)
  28. print("Welcome "..user)
  29. else
  30. print("Incorrect username and password combination")
  31. sleep(2)
  32. os.reboot()
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement