smigger22

Untitled

Mar 28th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. function login(username, password)
  4. request = http.post("http://www.retroservices.16mb.com/verify.php", "username="..textutils.urlEncode(tostring(username)).."&password="..textutils.urlEncode(tostring(password)))
  5. if request.readAll() == "true" then
  6. return true
  7. else
  8. return false
  9. end
  10. end
  11.  
  12. function centered(str, height)
  13. term.setCursorPos(51 / 2 - #str / 2, height)
  14. term.write(str)
  15. end
  16.  
  17. function indented(str, indent, height)
  18. term.setCursorPos(indent, height)
  19. term.write(str)
  20. end
  21.  
  22.  
  23. function layout()
  24. while true do
  25. term.setBackgroundColour(colours.cyan)
  26. term.clear()
  27. term.setTextColour(colours.blue)
  28. centered("smiggerLock", 1)
  29. indented("Username: ", 2, 6)
  30. indented("Password: ", 2, 8)
  31. term.setCursorPos(13, 6)
  32. username = read()
  33. if username:len() > 0 then
  34. term.setCursorPos(13, 8)
  35. password = read("*")
  36. if password:len() > 0 then
  37. if login(username, password) == true then
  38. rs.setOutput("bottom", true)
  39. sleep(2)
  40. rs.setOutput("bottom", false)
  41. end
  42. end
  43. end
  44. end
  45. end
  46.  
  47. layout()
Advertisement
Add Comment
Please, Sign In to add comment