Guest User

Untitled

a guest
Nov 16th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. local locker = true
  2. local attempted_login = true
  3. local password_server = 19 -- change to the ID of your password server computer
  4. rednet.open("top") -- change to the side your rednet modem is on
  5. while locker do
  6. attempted_login = false
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. print("Welcome to a USERS PC : Roaming Profile Enabled")
  10. print("What would you like to do?")
  11. print("[1] Login (*)")
  12. print("[2] Shutdown")
  13. write("> ")
  14. local input = read()
  15. if input == "2" then
  16. os.shutdown()
  17. elseif input == "1" then
  18. attempted_login = true
  19. print("Please login...")
  20. write("Username: ")
  21. local username = read()
  22. write("Password: ")
  23. local password = read("*")
  24. rednet.send(password_server, username)
  25. senderId, message, distance = rednet.receive(5)
  26. if password == message then
  27. locker = false
  28. term.clear()
  29. term.setCursorPos(1,1)
  30. print("Welcome ", username)
  31. else
  32. print("Not authorised.")
  33. sleep(1)
  34. end
  35. else
  36. print("Command not recognised...")
  37. sleep(2)
  38. end
  39. end
Add Comment
Please, Sign In to add comment