Advertisement
MrDionesalvi

Untitled

Jul 1st, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. mag = peripheral.wrap("bottom")
  4. mag.setInsertCardLight(false)
  5. function start()
  6. term.clear()
  7. term.setCursorPos(1,1)
  8.   print("Validazione carta di credito")
  9.   print("\nAccedere al conto:")
  10.   print("\nNome utente:")
  11.   print("\nPIN:")
  12.   term.setCursorPos(14, 5)
  13.   user = read()
  14.   term.setCursorPos(6, 7)
  15.   pin = read("*")
  16.   tab = textutils.unserialize(http.get("http://172.16.20.220/luanet/lolz/banca.php?richiesta=verifica&user="..user.."&pin="..pin).readAll())
  17.   if tab.stato == "OK" then
  18.     timer = os.startTimer(30)
  19.     term.clear()
  20.     term.setCursorPos(1,1)
  21.     print("Accesso riuscito")
  22.     print("\nInserire la carta di credito vuota per validarla")
  23.     _, data, side = os.pullEvent()
  24.     if _ == "mag_swipe" then
  25.     mag.beginWrite("{t=\"BDNR\", user="..user.."}", "BNR Credit")
  26.     term.clear()
  27.     term.setCursorPos(1,1)
  28.     print("Inserire nuovamente per confermare")
  29.     mag.setInsertCardLight(true)
  30.     os.pullEvent("mag_write_done")
  31.     mag.setInsertCardLight("false")
  32.     print("Fatto!")
  33.     sleep(2)
  34.     os.reboot()
  35.     elseif _ == "timer" then
  36.     os.reboot()
  37.     end
  38.   else
  39.     term.clear()
  40.     term.setCursorPos(1,1)
  41.     print("Autenticazione fallita!")
  42.     os.reboot()
  43.   end
  44. end
  45.  
  46. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement