Advertisement
xXm0dzXx

Untitled

May 26th, 2012
1,440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. local status = "Please login first."
  2. local user = "Login";
  3. local x,y = term.getSize()
  4. local page = "Home";
  5.  
  6. local lPrint = function(text)
  7. local x2,y2 = term.getCursorPos()
  8. term.setCursorPos(math.ceil(x - text:len()), y2)
  9.  
  10. write(text)
  11. end
  12.  
  13. function connect()
  14. while true do
  15. term.clear()
  16. term.setCursorPos(1,1)
  17. print(status.. "\n")
  18. print("Minecraft Username: ")
  19. write("Minecraft Password: ")
  20. test = string.len("Minecraft Password: *")
  21.  
  22. term.setCursorPos(test, 3)
  23. user = read()
  24. term.setCursorPos(test, 4)
  25. pass = read("*")
  26. http.request("http://login.minecraft.net/?user=" ..user.. "&password=" ..pass.. "&version=12")
  27. local event, url, response = os.pullEvent()
  28. if event == "http_success" then
  29. _sResponse = { response.readAll() }
  30. if string.find(tostring(_sResponse[1]), "deprecated") then
  31. term.setCursorPos(1, y-1)
  32. textutils.slowPrint("Logging in...")
  33. sleep(0.5)
  34. break
  35. else
  36. status = tostring(_sResponse[1])
  37. end
  38. else
  39. status = ("Unable to connect to minecraft.net")
  40. end
  41.  
  42. response.close()
  43. end
  44.  
  45. --parallel.waitForAny(tabs, load)
  46. tabs()
  47. end
  48.  
  49. function homepage()
  50. term.clear()
  51. term.setCursorPos(1,1)
  52. write("Minebook")
  53. lPrint("1; Login")
  54. for i = 1,x-1 do
  55. term.setCursorPos(i, 2)
  56. write("-")
  57. end
  58. print("Please login first.")
  59. term.setCursorPos(1,y)
  60. write("NeXuS | Logged out")
  61. repeat
  62. local event, a = os.pullEvent("key")
  63. until a == 2
  64.  
  65. connect()
  66. end
  67.  
  68. function tabs()
  69. term.clear()
  70. load()
  71. term.setCursorPos(1,1)
  72. write("Minebook")
  73. lPrint("1; Home | 2; Test | v; Logout")
  74. for i = 1,x-1 do
  75. term.setCursorPos(i, 2)
  76. write("-")
  77. end
  78.  
  79.  
  80.  
  81. term.setCursorPos(1,y)
  82. write("NeXuS | " ..user)
  83.  
  84. local event, a = os.pullEvent("char")
  85. if tonumber(a) == 1 then
  86. page = "Home"
  87. elseif tonumber(a) == 2 then
  88. page = "Secret"
  89. elseif a == "v" or a == "V" then
  90. homepage()
  91. end
  92.  
  93. tabs()
  94. end
  95.  
  96. function load()
  97. term.setCursorPos(1,3)
  98. if page == "Home" then
  99. print("Under construction.")
  100. else
  101. print("Hi :3")
  102. end
  103. end
  104.  
  105. homepage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement