Posted 03 January 2013 - 07:21 AM
Hello,
i just make a cool code for a login system.
i know the basics of computercraft but i dont know whats wrong to my code.
what i did wanted to make:
a login system that can have more login accounts.
what i want to add later:
that there are premissions for the accounts that when there is a admin logged in he can do everything. a vip or something can make programs but can not edit the standard programs. and default people can only login and run the programs but can not edit them. is this possible?
and that people can registrate as new user with default premissions.
now whats wrong with my code:
the first login is working (admin) but when i try my account ( jumpingjoran ) it says:
Username and Password do not match
and the loading thing is not working…
please can anybody help me? i just want my login system done.
i post my code on pastebin:
http://pastebin.com/RkZrJDef
and i post my code here too but i dont know if its working:
[Added code tags. -L]
i just make a cool code for a login system.
i know the basics of computercraft but i dont know whats wrong to my code.
what i did wanted to make:
a login system that can have more login accounts.
what i want to add later:
that there are premissions for the accounts that when there is a admin logged in he can do everything. a vip or something can make programs but can not edit the standard programs. and default people can only login and run the programs but can not edit them. is this possible?
and that people can registrate as new user with default premissions.
now whats wrong with my code:
the first login is working (admin) but when i try my account ( jumpingjoran ) it says:
Username and Password do not match
and the loading thing is not working…
please can anybody help me? i just want my login system done.
i post my code on pastebin:
http://pastebin.com/RkZrJDef
and i post my code here too but i dont know if its working:
Spoiler
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print (" __ | __ | Login System ")
print (" || || _ \\ (_-< ")
print (" __// __// .\\___/ ___/ ")
print ("------------------(Version: 2.1)------------------")
print ("")
print ("Login: ")
print ("")
-- admin account
write ("Username: ")
username = read()
if username == "admin" then
sleep(0.5)
write ("Password: ")
password = read ("*")
if password == "admin" then
sleep(1)
function line()
term.setCursorPos(17,11)
term.clearLine()
end
line()
print ("[ Loading ]")
sleep(0,5)
line()
print ("[ Loading 16% ]")
line()
sleep(0,5)
print ("[ Loading 31% ]")
line()
sleep(0,5)
print ("[ Loading 46% ]")
line()
sleep(0,5)
print ("[ Loading 62% ]")
line()
sleep(0,5)
print ("[ Loading 78% ]")
line()
sleep(0,5)
print ("[ Loading 93% ]")
line()
sleep(0,5)
print ("[ Loading Done ]")
line()
sleep(0,5)
print ("Account Accepted.")
sleep(3)
term.clear()
term.setCursorPos(1,1)
print (" __ | __ | Welcome, "..username.."")
print (" || || _ \\ (_-< ")
print (" __// __// .\\___/ ___/ ")
print ("-----------------(Version: 2.1)-------------------")
print ("")
sleep(0.5)
else
line()
print ("[ Loading ]")
sleep(0,5)
line()
print ("[ Loading 16% ]")
line()
sleep(0,5)
print ("[ Loading 31% ]")
line()
sleep(0,5)
print ("[ Loading 46% ]")
line()
sleep(0,5)
print ("[ Loading 62% ]")
line()
sleep(0,5)
print ("[ Loading 78% ]")
line()
sleep(0,5)
print ("[ Loading 93% ]")
line()
sleep(0,5)
print ("[ Loading Done ]")
line()
sleep(0,5)
term.setCursorPos(11,11)
textutils.slowPrint ("Username or Password is not Registered")
sleep(3)
os.reboot()
end
-- jumpingjoran account
elseif username == "jumpingjoran" then
sleep(0.5)
if password == "jumpingjoran" then
sleep(1)
function line()
term.setCursorPos(17,11)
term.clearLine()
end
line()
print ("[ Loading ]")
sleep(0,5)
line()
print ("[ Loading 16% ]")
line()
sleep(0,5)
print ("[ Loading 31% ]")
line()
sleep(0,5)
print ("[ Loading 46% ]")
line()
sleep(0,5)
print ("[ Loading 62% ]")
line()
sleep(0,5)
print ("[ Loading 78% ]")
line()
sleep(0,5)
print ("[ Loading 93% ]")
line()
sleep(0,5)
print ("[ Loading Done ]")
line()
sleep(1)
print ("Account Accepted.")
sleep(3)
term.clear()
term.setCursorPos(1,1)
print (" __ | __ | Welcome, "..username.."")
print (" || || _ \\ (_-< ")
print (" __// __// .\\___/ ___/ ")
print ("-----------------(Version: 2.1)-------------------")
print ("")
sleep(0.5)
else
line()
print ("[ Loading ]")
sleep(0,5)
line()
print ("[ Loading 16% ]")
line()
sleep(0,5)
print ("[ Loading 31% ]")
line()
sleep(0,5)
print ("[ Loading 46% ]")
line()
sleep(0,5)
print ("[ Loading 62% ]")
line()
sleep(0,5)
print ("[ Loading 78% ]")
line()
sleep(0,5)
print ("[ Loading 93% ]")
line()
sleep(0,5)
print ("[ Loading Done ]")
line()
sleep(0,5)
term.setCursorPos(11,11)
textutils.slowPrint ("Username and Password do not match.")
sleep(3)
os.reboot()
end
-- mastermy2 account
elseif username == "mastermy2" then
sleep(0.5)
if password == "mastermy2" then
sleep(1)
function line()
term.setCursorPos(17,11)
term.clearLine()
end
line()
print ("[ Loading ]")
sleep(0,5)
line()
print ("[ Loading 16% ]")
line()
sleep(0,5)
print ("[ Loading 31% ]")
line()
sleep(0,5)
print ("[ Loading 46% ]")
line()
sleep(0,5)
print ("[ Loading 62% ]")
line()
sleep(0,5)
print ("[ Loading 78% ]")
line()
sleep(0,5)
print ("[ Loading 93% ]")
line()
sleep(0,5)
print ("[ Loading Done ]")
line()
sleep(1)
print ("Account Accepted.")
sleep(3)
term.clear()
term.setCursorPos(1,1)
print (" __ | __ | Welcome, "..username.."")
print (" || || _ \\ (_-< ")
print (" __// __// .\\___/ ___/ ")
print ("-----------------(Version: 2.1)-------------------")
print ("")
sleep(0.5)
else
line()
print ("[ Loading ]")
sleep(0,5)
line()
print ("[ Loading 16% ]")
line()
sleep(0,5)
print ("[ Loading 31% ]")
line()
sleep(0,5)
print ("[ Loading 46% ]")
line()
sleep(0,5)
print ("[ Loading 62% ]")
line()
sleep(0,5)
print ("[ Loading 78% ]")
line()
sleep(0,5)
print ("[ Loading 93% ]")
line()
sleep(0,5)
print ("[ Loading Done ]")
line()
sleep(0,5)
term.setCursorPos(11,11)
textutils.slowPrint ("Username and Password do not match.")
sleep(3)
os.reboot()
end
else
sleep(1)
print ("Username not found.")
sleep(3)
os.reboot()
end
[Added code tags. -L]