xXm0dzXx

Untitled

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