lego11

Allarme con notifica mail

Jul 13th, 2018
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2. prox = sensor.wrap("back")
  3. lato = "right"
  4. ritardo = 0
  5.  
  6. api1 = "148d6933a3bb46985080ad58c66790e4"
  7. emailMandata = 0
  8. function mandaEmail()
  9. if emailMandata == 0 then
  10. emailMandata = 1
  11. http.get("http://172.16.20.220/luanet/servlets/notifier.php?api="..api1.."&var1="..giocatore)
  12. print("Email mandata")
  13. end
  14. end
  15. while true do
  16. term.clear()
  17. term.setCursorPos(1, 1)
  18. giocatore = string.match(textutils.serialize(prox.getTargets()), '%w+')
  19. if giocatore == nil then
  20. print("Nessun giocatore rilevato")
  21. rs.setOutput(lato, false)
  22. elseif giocatore == "lego11" or giocatore == "CrackMaster04" then
  23. print("Giocatore autorizzato rilevato: "..giocatore)
  24. rs.setOutput(lato, false)
  25. else
  26. print("Rilevato giocatore non autorizzato: "..giocatore)
  27. mandaEmail()
  28. rs.setOutput(lato, true)
  29. end
  30.  
  31. if emailMandata == 1 then
  32. ritardo = ritardo + 1
  33. end
  34.  
  35. if ritardo == 120 then
  36. ritardo = 0
  37. emailMandata = 0
  38. end
  39.  
  40. sleep(1)
  41. end
Add Comment
Please, Sign In to add comment