Posted 24 August 2012 - 10:15 PM
Im trying to fix my program for my terminal.
Here is wahts going on, the program startsup, shows login screem, and if i input my username, then password it lets me in, if i input anything in, ANYTHING, it doesnt show an error, but it just goes to the regular line on the terminal, with the arrow '> ' <—-that line
and i have to reboot to get the login back.
I am also adding that if i type the correct username but the incorrect password it works fine, and i get the message saying access denied.
its only when i hit enter on the username entry.
here's my code
Here is wahts going on, the program startsup, shows login screem, and if i input my username, then password it lets me in, if i input anything in, ANYTHING, it doesnt show an error, but it just goes to the regular line on the terminal, with the arrow '> ' <—-that line
and i have to reboot to get the login back.
I am also adding that if i type the correct username but the incorrect password it works fine, and i get the message saying access denied.
its only when i hit enter on the username entry.
here's my code
local sPath = ":/rom/programs"
term.clear()
term.setCursorPos(1,1)
print("---------------------------------------------------")
term.setCursorPos(1,2)
local function centerText(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
centerText("| R.S. Reactor Station Terminal |")
term.setCursorPos(1,3)
print("-------------------------------------------------------")
term.setCursorPos(1,4)
print("User Database: C:/Reactor/Terminal/Users")
term.setCursorPos(1,6)
print("Users:")
term.setCursorPos(1,7)
print("- predatorxil - coolwater97")
term.setCursorPos(1,8)
print("-------------------------------------------------------")
term.setCursorPos(1,9)
textutils.slowPrint("Message: Input UserName")
term.setCursorPos(1,17)
textutils.slowPrint("OS Version 2.5")
user1 = "predatorxil"
user2 = "coolwater97"
password1 = "elite13034"
password2 = "sarah1157"
term.setCursorPos(1,10)
write("UserName: ")
input = read()
if input == user1 then
term.setCursorPos(10,9)
textutils.slowPrint("Input Password")
term.setCursorPos(1,11)
write("Password: ")
input = read("*")
if input == password1 then
term.setCursorPos(10,9)
textutils.slowPrint("Access Approved")
sleep(.5)
rs.setOutput("back", true)
sleep(5)
rs.setOutput("back", false)
sleep(1)
os.reboot()
else
term.setCursorPos(10,9)
textutils.slowPrint("Access Denied; Reactor Lockdown Initiated")
sleep(10)
os.shutdown()
end
end
end