Update sPhone.lua
This commit is contained in:
parent
5d55ba5945
commit
5b9e85caaf
1 changed files with 60 additions and 45 deletions
105
src/sPhone.lua
105
src/sPhone.lua
|
@ -446,51 +446,65 @@ local function kernel()
|
||||||
sPhone.wrongPassword = true
|
sPhone.wrongPassword = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local choose = sPhone.yesNo("Setup Sertex ID", "Do you have a Sertex ID?")
|
term.setBackgroundColor(colors.white)
|
||||||
if not choose then
|
term.clear()
|
||||||
term.setBackgroundColor(colors.white)
|
term.setCursorPos(1,1)
|
||||||
term.clear()
|
local w, h = term.getSize()
|
||||||
term.setCursorPos(1,1)
|
paintutils.drawLine(1,1,w,1,colors.gray)
|
||||||
local w, h = term.getSize()
|
term.setTextColor(colors.black)
|
||||||
paintutils.drawLine(1,1,w,1,colors.gray)
|
term.setBackgroundColor(colors.white)
|
||||||
term.setTextColor(colors.black)
|
sertextext.center(3," Setup Sertex ID")
|
||||||
term.setBackgroundColor(colors.white)
|
local isDown = http.get("http://sertex.esy.es/status.php").readAll()
|
||||||
sertextext.center(3," Setup Sertex ID")
|
if isDown ~= "true" then
|
||||||
sertextext.center(7," Your Username")
|
sertextext.center(5, " The server is down")
|
||||||
term.setCursorPos(3,8)
|
sertextext.center(6, " Run sID on the home")
|
||||||
name = read()
|
name = "Run sID"
|
||||||
while true do
|
sleep(2)
|
||||||
sertextext.center(9, " Your Password")
|
else
|
||||||
term.setCursorPos(3,10)
|
|
||||||
term.clearLine()
|
local choose = sPhone.yesNo("Setup Sertex ID", "Do you have a Sertex ID?")
|
||||||
pw = read("*")
|
if not choose then
|
||||||
sertextext.center(11, " Repeat")
|
term.setBackgroundColor(colors.white)
|
||||||
term.setCursorPos(3,12)
|
term.clear()
|
||||||
term.clearLine()
|
term.setCursorPos(1,1)
|
||||||
pwr = read("*")
|
local w, h = term.getSize()
|
||||||
if pw == pwr then
|
paintutils.drawLine(1,1,w,1,colors.gray)
|
||||||
break
|
term.setTextColor(colors.black)
|
||||||
else
|
term.setBackgroundColor(colors.white)
|
||||||
print(" Wrong Password")
|
sertextext.center(3," Setup Sertex ID")
|
||||||
|
sertextext.center(7," Your Username")
|
||||||
|
term.setCursorPos(3,8)
|
||||||
|
name = read()
|
||||||
|
while true do
|
||||||
|
sertextext.center(9, " Your Password")
|
||||||
|
term.setCursorPos(3,10)
|
||||||
|
term.clearLine()
|
||||||
|
pw = read("*")
|
||||||
|
sertextext.center(11, " Repeat")
|
||||||
|
term.setCursorPos(3,12)
|
||||||
|
term.clearLine()
|
||||||
|
pwr = read("*")
|
||||||
|
if pw == pwr then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
print(" Wrong Password")
|
||||||
|
sleep(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local rServer = http.post("http://sertex.esy.es/register.php", "user="..name.."&password="..pw).readAll()
|
||||||
|
if rServer ~= "Success!" then
|
||||||
|
print("Username already exists")
|
||||||
|
print("Retry later in the app sID")
|
||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
end
|
local f = fs.open("/.sPhone/config/username","w")
|
||||||
local rServer = http.post("http://sertex.esy.es/register.php", "user="..name.."&password="..pw).readAll()
|
f.write(name)
|
||||||
if rServer ~= "Success!" then
|
f.close()
|
||||||
print("The server is down")
|
local pwf = fs.open("/.sPhone/config/.sIDPw", "w")
|
||||||
print("Or Username already exists")
|
pwf.write(base64.encode(pw))
|
||||||
print("Retry later in the app sID")
|
pwf.close()
|
||||||
sleep(1)
|
else
|
||||||
end
|
|
||||||
local f = fs.open("/.sPhone/config/username","w")
|
|
||||||
f.write(name)
|
|
||||||
f.close()
|
|
||||||
local pwf = fs.open("/.sPhone/config/.sIDPw", "w")
|
|
||||||
pwf.write(pw)
|
|
||||||
pwf.close()
|
|
||||||
else
|
|
||||||
while true do
|
|
||||||
term.setBackgroundColor(colors.white)
|
term.setBackgroundColor(colors.white)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1,1)
|
term.setCursorPos(1,1)
|
||||||
|
@ -508,8 +522,9 @@ local function kernel()
|
||||||
pw = read("*")
|
pw = read("*")
|
||||||
sertextext.center(11, " Checking...")
|
sertextext.center(11, " Checking...")
|
||||||
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()
|
||||||
|
|
Loading…
Reference in a new issue