Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("bottom")
- pw = "io"
- if fs.exists("mgpw") then
- print("Password file found")
- h = fs.open("mgpw", "r")
- pw = h.readLine()
- h.close()
- else
- print("Password file not found!")
- print("You will need to setup a card.")
- write("The password to be stored on the magcard: ")
- ag1 = read()
- write("The label of the magcard: ")
- ag2 = read()
- print("The password will be "..ag1.." and the label will be "..ag2..". Insert the magcard.")
- p.beginWrite(ag1, ag2)
- print("Waiting for card to write to...")
- event,arg1,arg2,arg3 = os.pullEvent("mag_write_done")
- h = fs.open("mgpw", "w")
- h.write(ag1)
- h.close()
- print("Operation complete. Rebooting...")
- sleep(1)
- os.reboot()
- end
- print("Waiting for card")
- event,arg1,arg2,arg3 = os.pullEvent("mag_swipe")
- if arg1 == pw then
- print("Correct card")
- rs.setOutput("left", true)
- sleep(2)
- rs.setOutput("left", false)
- else
- print("Incorrect card")
- end
- sleep(1)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment