Advertisement
Guest User

Untitled

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