Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("left")
- code = "!@#$"
- label = ""
- serverid = 886
- rednet.open("back")
- while true do
- os.pullEvent("disk")
- path = disk.getMountPath("front")
- if (path) then
- path2 = path.."/username"
- path = path.."/access"
- file = (fs.exists(path)) and io.open(path,"r") or nil
- file2 = (fs.exists(path2)) and io.open(path2,"r") or nil
- end
- disk.eject("front")
- if file then
- if file2 then
- username = file2:read()
- password = file:read()
- print(" ")
- print("username: "..username)
- rednet.send(serverid,username.." getPass")
- sender,hg = rednet.receive()
- if sender == serverid then
- code = hg
- end
- rednet.send(serverid,"getpermission "..username)
- sender1,out = rednet.receive()
- if sender1 == serverid then
- if out == "10" or out == "9" then
- if code == "false" then
- print("password false")
- mon.write("password false")
- else
- if (file and password==code )then
- rs.setOutput("bottom",true)
- mon.write("access granted")
- sleep(5)
- rs.setOutput("bottom",false)
- end
- end
- else
- mon.write("you dont have the permission")
- end
- end
- end
- else
- mon.write("the disk is not ")
- mon.setCursorPos(1,2)
- mon.write("compatible")
- end
- if(file2) then file2:close() file2 = nil end
- if(file) then file:close() file = nil end
- sleep(2)
- mon.clear()
- mon.setCursorPos(1,1)
- end
Add Comment
Please, Sign In to add comment