skare

client

Jun 22nd, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local locker = true
  3. local failed = true
  4. local attempted_login = true
  5. local password_server = 23 -- change to the ID of your password server computer
  6. rednet.open("right") -- change to the side your rednet modem is on
  7. while locker do
  8. attempted_login = false
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. print("Ordi protegez via MSC, entreprise de donnée")
  12. print("Que voulez-vous faire ?")
  13. print("[1] se connecter (*)")
  14. print("[2] Arreter")
  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("Veuillez vous connectez ...")
  22. write("Identifiants: ")
  23. local username = read()
  24. write("Mot de passe: ")
  25. local password = read("*")
  26. rednet.send(password_server, username, true)
  27. senderId, message, distance = rednet.receive(5)
  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
Advertisement
Add Comment
Please, Sign In to add comment