Ember_Celica

Login System

Jun 5th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. term.clear()
  3. term.setCursorPos(1, 1)
  4.  
  5. access = false
  6. username = {"user1", "user2"}
  7. password = {"pass1", "pass2"}
  8. write("Username: ")
  9. user = read()
  10.  
  11. write("Password: ")
  12. pass = read('*')
  13.  
  14. for i=1, #username do
  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. shell.openTab("monitor ENTERSIDE(Front,Back,Top,Bottom,Left,Right) Time1")
  25. redstone.setOutput("SIDE",true)
  26. print("Press A to reboot the system")
  27. local event, key = os.pullEvent("key")
  28. if key == keys.a then
  29. os.reboot()
  30. end
  31. end
  32. if access == false then
  33. print("Incorrect username and password combination")
  34. sleep(2)
  35. os.reboot()
  36. end
Add Comment
Please, Sign In to add comment