Update sPhone.lua

This commit is contained in:
Ale2610 2015-08-29 15:57:40 +02:00
parent 5d55ba5945
commit 5b9e85caaf

View file

@ -447,6 +447,22 @@ local function kernel()
end end
end end
term.setBackgroundColor(colors.white)
term.clear()
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")
local isDown = http.get("http://sertex.esy.es/status.php").readAll()
if isDown ~= "true" then
sertextext.center(5, " The server is down")
sertextext.center(6, " Run sID on the home")
name = "Run sID"
sleep(2)
else
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.setBackgroundColor(colors.white)
@ -478,8 +494,7 @@ local function kernel()
end end
local rServer = http.post("http://sertex.esy.es/register.php", "user="..name.."&password="..pw).readAll() local rServer = http.post("http://sertex.esy.es/register.php", "user="..name.."&password="..pw).readAll()
if rServer ~= "Success!" then if rServer ~= "Success!" then
print("The server is down") print("Username already exists")
print("Or Username already exists")
print("Retry later in the app sID") print("Retry later in the app sID")
sleep(1) sleep(1)
end end
@ -487,10 +502,9 @@ local function kernel()
f.write(name) f.write(name)
f.close() f.close()
local pwf = fs.open("/.sPhone/config/.sIDPw", "w") local pwf = fs.open("/.sPhone/config/.sIDPw", "w")
pwf.write(pw) pwf.write(base64.encode(pw))
pwf.close() pwf.close()
else else
while true do
term.setBackgroundColor(colors.white) term.setBackgroundColor(colors.white)
term.clear() term.clear()
term.setCursorPos(1,1) term.setCursorPos(1,1)
@ -510,6 +524,7 @@ local function kernel()
rServer = http.post("http://sertex.esy.es/login.php", "user="..name.."&password="..pw).readAll() rServer = http.post("http://sertex.esy.es/login.php", "user="..name.."&password="..pw).readAll()
if rServer ~= "true" then if rServer ~= "true" then
print(" Wrong Username/Password") print(" Wrong Username/Password")
print(" Run sID")
sleep(2) sleep(2)
else else
f = fs.open("/.sPhone/config/username", "w") f = fs.open("/.sPhone/config/username", "w")
@ -524,7 +539,7 @@ local function kernel()
end end
sertextext.center(13," All Set!") sertextext.center(13," All Set!")
sertextext.center(14,"Have fun with sPhone") sertextext.center(14," Have fun with sPhone")
sPhone.user = name sPhone.user = name
sleep(2) sleep(2)
home() home()