Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- mag = peripheral.wrap("bottom")
- mag.setInsertCardLight(false)
- function start()
- term.clear()
- term.setCursorPos(1,1)
- print("Validazione carta di credito")
- print("\nAccedere al conto:")
- print("\nNome utente:")
- print("\nPIN:")
- term.setCursorPos(14, 5)
- user = read()
- term.setCursorPos(6, 7)
- pin = read("*")
- tab = textutils.unserialize(http.get("http://172.16.20.220/luanet/lolz/banca.php?richiesta=verifica&user="..user.."&pin="..pin).readAll())
- if tab.stato == "OK" then
- timer = os.startTimer(30)
- term.clear()
- term.setCursorPos(1,1)
- print("Accesso riuscito")
- print("\nInserire la carta di credito vuota per validarla")
- _, data, side = os.pullEvent()
- if _ == "mag_swipe" then
- mag.beginWrite("{t=\"BDNR\", user="..user.."}", "BNR Credit")
- term.clear()
- term.setCursorPos(1,1)
- print("Inserire nuovamente per confermare")
- mag.setInsertCardLight(true)
- os.pullEvent("mag_write_done")
- mag.setInsertCardLight("false")
- print("Fatto!")
- sleep(2)
- os.reboot()
- elseif _ == "timer" then
- os.reboot()
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("Autenticazione fallita!")
- os.reboot()
- end
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement