z3ntu

Password Client

Mar 5th, 2013
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. --Password Client; Server can be found at: http://pastebin.com/iwQ8ZFB8
  2.  
  3. os.pullEvent = os.pullEventRaw
  4. local locker = true
  5. local failed = true
  6. local attempted_login = true
  7. local password_server = 0 -- change to the ID of your password server computer
  8. rednet.open("left") -- change to the side your rednet modem is on
  9. while locker do
  10.  attempted_login = false
  11.  term.clear()
  12.  term.setCursorPos(1,1)
  13.  print("Welcome to a USERS PC : Roaming Profile Enabled")
  14.  print("What would you like to do?")
  15.  print("[1] Login (*)")
  16.  print("[2] Shutdown")
  17.  write("> ")
  18.  local input = read()
  19.  if input == "2" then
  20.   os.shutdown()
  21.  elseif input == "1" then
  22.   attempted_login = true
  23.   print("Please login...")
  24.   write("Username: ")
  25.   local username = read()
  26.   write("Password: ")
  27.   local password = read("*")
  28.   rednet.send(password_server, username, true)
  29.   senderId, message, distance = rednet.receive(5)
  30.   if password == message then
  31.    failed = false
  32.    locker = false
  33.    term.clear()
  34.    term.setCursorPos(1,1)
  35.    print("Welcome ", username)
  36.   else
  37.    print("Invalid Username or Password.")
  38.    sleep(3)
  39.   end
  40.  else
  41.   print("Command not recognised...")
  42.   sleep(2)
  43.  end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment