ravneravn

password client

May 23rd, 2013
43
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local locker = true
  2. local failed = true
  3. local attempted_login = true
  4. local password_server = 9
  5. local modem = peripheral.wrap("left")
  6. modem.open(500)
  7. while locker do
  8. attempted_login = false
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. print("Welcome to a USERS PC : Roaming Profile Enabled")
  12. print("What would you like to do?")
  13. print("[1] Login (*)")
  14. print("[2] Shutdown")
  15. write("> ")
  16. local input = read()
  17. if input == "2" then
  18. os.shutdown()
  19. elseif input == "1" then
  20. attempted_login = true
  21. print("Please login...")
  22. write("Username= ")
  23. local username = read()
  24. write ("Password: ")
  25. local password = read("*")
  26. modem.transmit(500, 500, password_server, username, true)
  27. event, senderId, message, distance = os.pullEvent("modem_message")
  28. if password == message then
  29. failed = false
  30. locker = false
  31. term.clear()
  32. term.setCursorPos(1,1)
  33. print("Welcome ", username)
  34. else
  35. print("Invalid Username or Password.")
  36. sleep(3)
  37. end
  38. else
  39. print("Command not recognised...")
  40. sleep(2)
  41. end
  42. end
RAW Paste Data