this code doesn't work its for better understanding of my question
website = http://www.example.com/cc
if website == "true" then
print("It works!")
local webHandle = http.get( "http://www.example.com/cc" )
if webHandle then
print( webHandle.readAll() )
else
print( "Couldn't connect to website :(/>" )
end
local h, version = http.get( "http://pastebin.com/raw.php?i=9nXEnf7x" )
if h then
version = h.readAll()
print( version )
if version ~= "1.0.0" then
print( "Update Found!" )
else
print( "No Update Found!" )
end
else
print( "Couldn't connect to pastebin!" )
end
--[[ Login screen ]]--
username = "Admin"
Access = "Login"
password = "password"
currentVersion = "1.3.2"
updateAvailable = "false"
autoUpdate = "true"
os.pullEvent = os.pullEventRaw
--[[ functions ]]--
function startscreen(print)
term.clear()
term.setCursorPos(1,1)
print("+========+")
print("|Craft OS|")
print("+========+")
print("")
print("+=======================+")
print("|Username: |")
print("+=======================+")
print("")
print("+=======================+")
print("|Password: |")
print("+=======================+")
print("")
print("Access: "..Access.."")
end
function login()
term.setCursorPos(12,6)
unbox = read()
if unbox == "update" then
autoupdate()
elseif unbox ~= username then
term.setCursorPos(9,13)
print("Incorrect username!")
sleep(2)
shell.run("startup")
else
term.setCursorPos(1,13)
term.setCursorPos(1,13)
term.setCursorPos(12,10)
pwbox = read("*")
if pwbox == password then
term.setCursorPos(1,13)
print("")
term.setCursorPos(1,13)
Access = "Granted!"
print("Access: "..Access.."")
sleep(3)
term.clear()
term.setCursorPos(1,1)
else
os.reboot()
end
end
end
function updateCheck()
term.clear()
term.setCursorPos(1,1)
print("+--------------------------+")
print("|Checking for updates... |")
print("+--------------------------+")
print("+--------------------------+")
print("| |")
print("+--------------------------+")
term.setCursorPos(2,5)
textutils.slowPrint("//////////////////////////", 8)
term.clear()
term.setCursorPos(1,1)
h, version = http.get( "http://pastebin.com/raw.php?i=9nXEnf7x" )
if h then
version = h.readAll()
if version ~= currentVersion then
print("+--------------------------+")
print("|Update found! |")
print("+--------------------------+")
print("+--------------------------+")
print("|Version: |")
print("+--------------------------+")
print("+--------------------------+")
print("|Downloading... |")
print("+--------------------------+")
term.setCursorPos(11,5)
print(version)
sleep(3)
shell.run("pastebin run JuYtAwrk")
else
print("+--------------------------+")
print("|Current update owned! |")
print("+--------------------------+")
end
else
print( "Couldn't connect to pastebin!" )
end
end
updateCheck()
startscreen(print)
login()
A quick shot-in-the-dark guess, but what happens if you switch to h.readLine() instead of h.readAll()? I suspect you're pulling in a linebreak you don't want.
It'd also be a good idea to call h.close() after your read.
--[[ Login screen ]]--
username = "Admin"
Access = "Login"
password = "password"
currentVersion = "1.3.2"
updateAvailable = "false"
autoUpdate = "true"
os.pullEvent = os.pullEventRaw
--[[ functions ]]--
function startscreen(print)
term.clear()
term.setCursorPos(1,1)
print("+========+")
print("|Craft OS|")
print("+========+")
print("")
print("+=======================+")
print("|Username: |")
print("+=======================+")
print("")
print("+=======================+")
print("|Password: |")
print("+=======================+")
print("")
print("Access: "..Access.."")
end
function login()
term.setCursorPos(12,6)
unbox = read()
if unbox == "update" then
autoupdate()
elseif unbox ~= username then
term.setCursorPos(9,13)
print("Incorrect username!")
sleep(2)
shell.run("startup")
else
term.setCursorPos(1,13)
term.setCursorPos(1,13)
term.setCursorPos(12,10)
pwbox = read("*")
if pwbox == password then
term.setCursorPos(1,13)
print("")
term.setCursorPos(1,13)
Access = "Granted!"
print("Access: "..Access.."")
sleep(3)
term.clear()
term.setCursorPos(1,1)
else
os.reboot()
end
end
end
function updateCheck()
term.clear()
term.setCursorPos(1,1)
print("+--------------------------+")
print("|Checking for updates... |")
print("+--------------------------+")
print("+--------------------------+")
print("| |")
print("+--------------------------+")
term.setCursorPos(2,5)
textutils.slowPrint("//////////////////////////", 8)
term.clear()
term.setCursorPos(1,1)
h, version = http.get( "http://pastebin.com/raw.php?i=9nXEnf7x" )
if h then
version = h.readLine()
h.close()
if version ~= currentVersion then
print("+--------------------------+")
print("|Update found! |")
print("+--------------------------+")
print("+--------------------------+")
print("|Version: |")
print("+--------------------------+")
print("+--------------------------+")
print("|Downloading... |")
print("+--------------------------+")
term.setCursorPos(11,5)
print(version)
sleep(3)
shell.run("pastebin run JuYtAwrk")
else
print("+--------------------------+")
print("|Current update owned! |")
print("+--------------------------+")
end
else
print( "Couldn't connect to pastebin!" )
end
end
updateCheck()
startscreen(print)
login()