Jump to content




[help] need help with login program


  • You cannot reply to this topic
1 reply to this topic

#1 rex41043

  • Members
  • 88 posts

Posted 10 April 2012 - 10:52 PM

i need help to make a login program that will read the username and password form a file!
file eg.

user = user
password = password

like that and the login program will read it form a file can eny 1 help?

#2 cant_delete_account

  • Members
  • 484 posts

Posted 10 April 2012 - 11:15 PM

Here:
function correct()
--CODE THAT HAPPENS WHEN PASSWORD IS CORRECT
end
if not fs.exists("//.pass")
write("New Password: ")
input = read("*")
local pass = fs.open("//.pass","w")
pass.write(input)
pass.close()
end
local hFile = fs.open("//.pass","r")
local password = hFile.readAll()
hFile.close()
term.clear()
term.setCursorPos(1,1)
write("Password: ")
local ijkl = read("*")
if ijkl == (password) then
term.clear()
term.setCursorPos(1,1)
print("Password correct!")
correct()
sleep(1)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Password incorrect!")
print("Shutting down...")
sleep(1)
os.reboot()
end







1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users