Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tRX, tRY = term.getSize() -- termminal rows X & Y
- local tmpCX, tmpCY, tmpCXE, tmpCYE = 1, 1-- temp cursor X & Y
- local menuX = 35
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- function cWrite (text, posY)
- tmpCX, tmpCY = math.floor(tRX - #text) / 2 + 1, posY
- term.setCursorPos(tmpCX, posY)
- term.write(text)
- tmpCXE, tmpCYE = term.getCursorPos()
- end
- function fill (posX, posY, posXE, posYE, color)
- term.setBackgroundColor(color)
- for x=posX, posXE do
- for y=posY, posYE do
- term.setCursorPos(x,y)
- term.write(' ')
- end
- end
- end
- function auth ()
- term.setBackgroundColor(colors.lightGray)
- cWrite(' Login ', 7)
- term.setTextColor(colors.lime)
- cWrite(' username: ', 9)
- term.setTextColor(colors.gray)
- term.setCursorPos(tmpCX +10, tmpCY)
- local user = read()
- term.setTextColor(colors.lime)
- cWrite(' password: ', 10)
- term.setTextColor(colors.gray)
- term.setCursorPos(tmpCX +10, tmpCY)
- local pass = read("*")
- local response = http.post("http://bobtank.comxa.com/login.php","username="..user.."&password="..pass)
- if response.readLine()=="Success!" then
- term.setTextColor(colors.lime)
- term.setBackgroundColor(colors.white)
- cWrite('Welcome', 11)
- cWrite('<Name>', 12)
- sleep(1.5)
- menu()
- else
- deny()
- end
- end
- function deny () -- flash screen borders red
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- cWrite('Incorrect Password', 10)
- cWrite('Shutting Down', 18)
- term.setBackgroundColor(colors.red)
- for x=1, tRX do
- term.setCursorPos(x,1)
- term.write(' ')
- term.setCursorPos(x, tRY)
- term.write(' ')
- end
- for y=1, tRY do
- term.setCursorPos(1, y)
- term.write(' ')
- term.setCursorPos(tRX, y)
- term.write(' ')
- end
- term.setCursorPos(tmpCXE, tmpCYE)
- term.setBackgroundColor(colors.white)
- sleep(1)
- write('.')
- sleep(1)
- write('.')
- sleep(1)
- write('.')
- sleep(1)
- os.shutdown()
- end
- function menu()
- print("lmao")
- end
- auth()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement