CryptekCoding

CCLS;Client

Apr 2nd, 2014
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local failed = true
  3. busr = "root" -- If you ever happen to be unable to log in for some reason, you can use this username as a backup.
  4. bpass = "1955330244" -- If you ever happen to be unable to log in for some reason, you can use this password as a backup.
  5.  
  6. password_server = 11 -- change to the ID of your password server computer
  7. rednet.open("back") -- change to the side your rednet modem is on
  8. while true do
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. print("Welcome to Aerial Computing.")
  12. print("Please select an option.")
  13. print("[1] Login")
  14. print("[2] Shutdown")
  15. write("> ")
  16. input = read()
  17. if input == "2" then
  18.  os.shutdown()
  19. elseif input == "1" then
  20.  print("Please login.")
  21.  write("Username: ")
  22.  username = read()
  23.  write("Password: ")
  24.  password = read("*")
  25.  if username == busr then
  26.  if password == bpass then
  27. print("Access granted")
  28. break
  29.  end
  30.  end
  31.  rednet.send(password_server, username, true)
  32.  senderId, message, distance = rednet.receive(5)
  33.  if message == "300" then
  34.  print("Invalid Username or Password.")
  35.  sleep(3)
  36.  elseif password == message then
  37.  failed = false
  38.  term.clear()
  39.  term.setCursorPos(1,1)
  40.  print("Welcome ", username)
  41.  break;
  42.  else
  43.  print("Invalid Username or Password.")
  44.  sleep(3)
  45.  end
  46. else
  47.  print("Invalid Command.")
  48.  sleep(2)
  49. end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment