Advertisement
Guest User

startup

a guest
Oct 17th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.89 KB | None | 0 0
  1. -- IMPOSTAZIONI --
  2.  
  3. -- Utente 1 --
  4. Username = "LeHelary"
  5. Password = "Accesso"
  6. -- Utente 2 --
  7. Username2 = "lego11"
  8. Password2 = "Hey"
  9. -- Debug --
  10. Debug = "Debug"
  11. -- Pin --
  12. Pin = "4321"
  13.  
  14. -- INIZIO CODICE --
  15.  
  16. errori = 0
  17.  
  18. term.clear()
  19. term.setCursorPos(1,1)
  20. print("Benvenuto. Esegui l'autenticazione per proseguire.")
  21. term.setCursorPos(1,3)
  22. write("Username: ")
  23. user = read()
  24. term.setCursorPos(1,5)
  25. write("Password: ")
  26. pwd = read("*")
  27. programma = true
  28. while programma do
  29.   if Username == user and Password == pwd then
  30.     term.setCursorPos(1,7)
  31.     write("ACCESS GRANTED  |  ACCESSO CONSENTITO")
  32.     term.setCursorPos(1,9)
  33.     write("Utente: ")
  34.     write(user)
  35.     rs.setOutput("right", true)
  36.     os.sleep(4)
  37.     rs.setOutput("right", false)
  38.     os.reboot()
  39.   elseif Username2 == user and Password2 == pwd then
  40.    term.setCursorPos(1,7)
  41.    write("ACCESS GRANTED  |  ACCESSO CONSENTITO")
  42.    term.setCursorPos(1,9)
  43.    write("Utente: ")
  44.    write(user)
  45.    rs.setOutput("left", true)
  46.    os.sleep(4)
  47.    rs.setOutput("left", false)
  48.    os.reboot()
  49.   elseif Username == user and Debug == pwd then
  50.     term.setCursorPos(1,7)
  51.     write("DEBUG MODE  |  MODALITA' DI DEBUG")
  52.     term.setCursorPos(1,9)
  53.     write("Utente: ")
  54.     write(user)
  55.     os.sleep(3)
  56.     term.clear()
  57.     term.setCursorPos(1,1)
  58.     programma = false
  59.   elseif Username2 == user and Debug == pwd then
  60.     term.setCursorPos(1,7)
  61.     write("DEBUG MODE  |  MODALITA' DI DEBUG")
  62.     term.setCursorPos(1,9)
  63.     write("Utente: ")
  64.     write(user)
  65.     os.sleep(3)
  66.     term.clear()
  67.     term.setCursorPos(1,1)
  68.     programma = false
  69.   else
  70.     if errori == 0 then
  71.       errori = 1
  72.       term.setCursorPos(1,7)
  73.       write("ACCESS DENIED  |  ACCESSO NON CONSENTITO")
  74.       term.setCursorPos(1,9)
  75.       write("Username o Password errati, riprovare.")
  76.       term.setCursorPos(1,11)
  77.       write("TENTATIVO 1 SU 3 FALLITO")
  78.       os.sleep(4)
  79.       os.reboot()
  80.     elseif errori == 1 then
  81.       errori = 2
  82.       term.setCursorPos(1,7)
  83.       write("ACCESS DENIED  | ACCESSO NON CONSENTITO")
  84.       term.setCursorPos(1,9)
  85.       write("Username o Password errati, riprovare.")
  86.       term.setCursorPos(1,11)
  87.       write("TENTATIVO 2 SU 3 FALLITO")
  88.       os.sleep(4)
  89.       os.reboot()
  90.     elseif errori == 2 then
  91.       errori = 0
  92.       term.setCursorPos(1,7)
  93.       write("ACCESS DENIED  |  ACCESSO NON CONSENTITO")
  94.       term.setCursorPos(1,9)
  95.       write("Username o Password errati, riprovare")
  96.       term.setCursorPos(1,11)
  97.       write("TENTATIVO 3 SU 3 FALLITO! ALLARME ATTIVATA!")
  98.       rs.setOutput("up", true)
  99.       term.setCursorPos(1,13)
  100.       write("IMMETERE IL PIN PER SBLOCCARE: ")
  101.       codice = read("*")
  102.       blocco = true
  103.      
  104.   while blocco do
  105.       if Pin == codice then
  106.         os.sleep(1)
  107.         os.reboot()
  108.       else
  109.         term.clear()
  110.         term.setCursorPos(1,1)
  111.        
  112.   end
  113.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement