Advertisement
Guest User

Untitled

a guest
May 25th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. local tRX, tRY = term.getSize() -- termminal rows X & Y
  2. local tmpCX, tmpCY, tmpCXE, tmpCYE = 1, 1-- temp cursor X & Y
  3. local menuX = 35
  4. term.setCursorPos(1,1)
  5.  
  6. term.setBackgroundColor(colors.white)
  7. term.setTextColor(colors.black)
  8. term.clear()
  9. function cWrite (text, posY)
  10. tmpCX, tmpCY = math.floor(tRX - #text) / 2 + 1, posY
  11. term.setCursorPos(tmpCX, posY)
  12. term.write(text)
  13. tmpCXE, tmpCYE = term.getCursorPos()
  14. end
  15. function fill (posX, posY, posXE, posYE, color)
  16. term.setBackgroundColor(color)
  17. for x=posX, posXE do
  18. for y=posY, posYE do
  19. term.setCursorPos(x,y)
  20. term.write(' ')
  21. end
  22. end
  23. end
  24.  
  25. function auth ()
  26. term.setBackgroundColor(colors.lightGray)
  27. cWrite(' Login ', 7)
  28.  
  29. term.setTextColor(colors.lime)
  30. cWrite(' username: ', 9)
  31. term.setTextColor(colors.gray)
  32. term.setCursorPos(tmpCX +10, tmpCY)
  33. local user = read()
  34.  
  35. term.setTextColor(colors.lime)
  36. cWrite(' password: ', 10)
  37. term.setTextColor(colors.gray)
  38. term.setCursorPos(tmpCX +10, tmpCY)
  39. local pass = read("*")
  40.  
  41. local response = http.post("http://bobtank.comxa.com/login.php","username="..user.."&password="..pass)
  42.  
  43. if response.readLine()=="Success!" then
  44. term.setTextColor(colors.lime)
  45. term.setBackgroundColor(colors.white)
  46. cWrite('Welcome', 11)
  47. cWrite('<Name>', 12)
  48. sleep(1.5)
  49.  
  50. menu()
  51. else
  52. deny()
  53. end
  54. end
  55. function deny () -- flash screen borders red
  56. term.setBackgroundColor(colors.white)
  57. term.setTextColor(colors.red)
  58. cWrite('Incorrect Password', 10)
  59. cWrite('Shutting Down', 18)
  60.  
  61. term.setBackgroundColor(colors.red)
  62.  
  63. for x=1, tRX do
  64. term.setCursorPos(x,1)
  65. term.write(' ')
  66. term.setCursorPos(x, tRY)
  67. term.write(' ')
  68. end
  69. for y=1, tRY do
  70. term.setCursorPos(1, y)
  71. term.write(' ')
  72. term.setCursorPos(tRX, y)
  73. term.write(' ')
  74. end
  75. term.setCursorPos(tmpCXE, tmpCYE)
  76. term.setBackgroundColor(colors.white)
  77. sleep(1)
  78. write('.')
  79. sleep(1)
  80. write('.')
  81. sleep(1)
  82. write('.')
  83. sleep(1)
  84. os.shutdown()
  85. end
  86. function menu()
  87. print("lmao")
  88. end
  89.  
  90. auth()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement