Update sPhone.lua

This commit is contained in:
Ale2610 2015-08-25 17:56:00 +02:00
parent d70b06dd49
commit 02680b2e40

View file

@ -382,6 +382,7 @@ local function kernel()
local name local name
local pw local pw
local pwr local pwr
local rServer
while true do while true do
term.clear() term.clear()
term.setCursorPos(1,1) term.setCursorPos(1,1)
@ -448,6 +449,7 @@ local function kernel()
local choose = sPhone.yesNo("Setup Sertex ID", "Do you have a Sertex ID?") local choose = sPhone.yesNo("Setup Sertex ID", "Do you have a Sertex ID?")
if not choose then if not choose then
term.setBackgroundColor(colors.white)
term.clear() term.clear()
term.setCursorPos(1,1) term.setCursorPos(1,1)
local w, h = term.getSize() local w, h = term.getSize()
@ -486,12 +488,45 @@ local function kernel()
local pwf = fs.open("/.sPhone/config/.sIDPw", "w") local pwf = fs.open("/.sPhone/config/.sIDPw", "w")
pwf.write(pw) pwf.write(pw)
pwf.close() pwf.close()
sertextext.center(13," All Set!") else
sertextext.center(14,"Have fun with sPhone") while true do
sPhone.user = name term.setBackgroundColor(colors.white)
sleep(2) term.clear()
home() term.setCursorPos(1,1)
local w, h = term.getSize()
paintutils.drawLine(1,1,w,1,colors.gray)
term.setTextColor(colors.black)
term.setBackgroundColor(colors.white)
sertextext.center(3," Setup Sertex ID")
sertextext.center(7," Your Username")
term.setCursorPos(3,8)
name = read()
sertextext.center(9, " Your Password")
term.setCursorPos(3,10)
term.clearLine()
pw = read("*")
sertextext.center(11, " Checking...")
rServer = http.post("http://sertex.esy.es/login.php", "user="..name.."&password="..pw).readAll()
if rServer ~= "true" then
print(" Wrong Username/Password")
sleep(2)
else
f = fs.open("/.sPhone/config/username", "w")
f.write(name)
f.close()
f = fs.open("/.sPhone/config/.sIDpw", "w")
f.write(pw)
f.close()
break
end
end
end end
sertextext.center(13," All Set!")
sertextext.center(14,"Have fun with sPhone")
sPhone.user = name
sleep(2)
home()
end end
end end