Guest User

Untitled

a guest
Jul 23rd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. mon = peripheral.wrap("left")
  2. code = "!@#$"
  3. label = ""
  4.  
  5. serverid = 886
  6.  
  7. rednet.open("back")
  8. while true do
  9. os.pullEvent("disk")
  10. path = disk.getMountPath("front")
  11. if (path) then
  12. path2 = path.."/username"
  13. path = path.."/access"
  14. file = (fs.exists(path)) and io.open(path,"r") or nil
  15. file2 = (fs.exists(path2)) and io.open(path2,"r") or nil
  16. end
  17.  
  18. disk.eject("front")
  19. if file then
  20. if file2 then
  21. username = file2:read()
  22. password = file:read()
  23. print("  ")
  24. print("username: "..username)
  25. rednet.send(serverid,username.." getPass")
  26. sender,hg = rednet.receive()
  27. if sender == serverid then
  28. code = hg
  29. end
  30. rednet.send(serverid,"getpermission "..username)
  31. sender1,out = rednet.receive()
  32. if sender1 == serverid then
  33. if out == "10" or out == "9" then
  34.  
  35. if code == "false" then
  36. print("password false")
  37. mon.write("password false")
  38. else
  39. if (file and password==code )then
  40. rs.setOutput("bottom",true)
  41. mon.write("access granted")
  42. sleep(5)
  43. rs.setOutput("bottom",false)
  44. end
  45. end
  46. else
  47. mon.write("you dont have the permission")
  48. end
  49. end
  50. end
  51. else
  52. mon.write("the disk is not ")
  53. mon.setCursorPos(1,2)
  54. mon.write("compatible")
  55. end
  56. if(file2) then file2:close() file2 = nil end
  57. if(file) then file:close() file = nil end
  58. sleep(2)
  59. mon.clear()
  60. mon.setCursorPos(1,1)
  61.  
  62. end
Add Comment
Please, Sign In to add comment