Advertisement
Guest User

Security Program

a guest
Oct 10th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. Proximity = rs.getAnalogInput("left")
  2.  
  3. os.pullEvent = os.pullEventRaw
  4.  
  5. function Security()
  6.   if Proximity == 5 then
  7.     sleep(1)
  8.   else
  9.     os.reboot()
  10.   end
  11.   term.setTextColor(colors.cyan)
  12.   print("Please Provide Security Key")
  13.   print(" ")
  14.   print("Password:")
  15.   password = io.read()
  16.   if password == "TestPass" and Proximity == 5 then
  17.     term.clear()
  18.     term.setCursorPos(1,1)
  19.     term.setTextColor(colors.green)
  20.     print("Security Key Accepted")
  21.     print(" ")
  22.     print("Access Granted")
  23.     redstone.setOutput("right", true)
  24.     sleep(10)
  25.     redstone.setOutput("right", false)
  26.   else
  27.     term.setTextColor(colors.red)
  28.     print("User or Security Key is Invalid.")
  29.     Security()
  30.   end
  31. end --# this was missing
  32.  
  33. function Authentication()
  34.   if Proximity == 5 then
  35.     sleep(1)
  36.   else
  37.     os.reboot()
  38.   end
  39.   term.clear()
  40.   term.setCursorPos(1,1)
  41.   term.setTextColor(colors.cyan)
  42.   print("Welcome. Please input User Identification Key")
  43.   print(" ")
  44.   print("User ID:")
  45.   username = io.read()
  46.   if username == "TestName" and Proximity == 5 then
  47.     term.clear()
  48.     term.setCursorPos(1,1)
  49.     term.setTextColor(colors.green)
  50.     print("User Identification Key Accepted")
  51.     print(" ")
  52.     sleep(1)
  53.     term.setTextColor(colors.purple)
  54.     print("Welcome.")
  55.     Security()
  56.   else
  57.     term.setTextColor(colors.red)
  58.     print("Invalid User. Session Terminated.")
  59.     sleep(1)
  60.     os.reboot()
  61.   end
  62. end --# this was missing
  63.  
  64. function Start()
  65.   term.clear()
  66.   term.setCursorPos(1,1)
  67.   term.setTextColor(colors.cyan)
  68.   sleep(1)
  69.   if Proximity == 5 then
  70.     sleep (1)
  71.     Security()
  72.   end
  73. end
  74.  
  75. Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement