Advertisement
Guest User

login.bin

a guest
Aug 30th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. function main()
  2. print("Login System v1")
  3. print("Username: ")
  4. local username_entered = io.read()
  5. print("Password: ")
  6. local password_entered = io.read()
  7.  
  8. if fs.exists("/usr/pwd/"..username_entered) then
  9.   local pwdf = fs.open("/usr/pwd/"..username_entered, "r")
  10.   pwdif = pwdf.readAll()
  11.   if pwdif == password_entered then
  12.     print("Password Correct!")
  13.   else print("Password incorrect. Please enter again.")
  14.     shell.run("/bin/boot/login.bin")
  15.   end
  16. else print("This user doesn't exist!")
  17.   shell.run("/bin/boot/login.bin")
  18. end
  19. end
  20.  
  21. local ok, err = pcall(main)
  22. if not ok then print("Error occured: "..err)
  23. print("Press any key to continue..")
  24. os.pullEvent("key")
  25. shell.run("/bin/boot/login.bin")
  26. end
  27.  
  28. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement