Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw -- This Does Not Allow You to CTRL+T
- --[[
- This Program Was Made By Superzorik Please Don't
- Try To Steal This Program, Stealing This Program
- Or Not Giving Credit To The Creator Can Result
- In But Is Not Limited To: Legal Prosecution,
- Revoking Of Product, A Fine
- Note: I hope you enjoy this I spent an hour or
- two on it! Enjoy! Make sure to read the
- documentation for how to use the program below
- if you are interested otherwise everything is
- explained when you open the program on computercraft
- Be sure to set this as your startup file or else
- it will be insecure and anyone can open your door!
- --]]
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- Sides = {"left", "right", "top", "bottom", "front", "back"}
- for i = 1, #Sides do
- rs.setOutput(Sides[i], false)
- end
- ----------------------
- -- Program --
- -- Documentation --
- ----------------------
- -- Use --
- -- User: ADMIN --
- -- Password: ADMIN --
- -- --
- -- To exit program --
- ----------------------
- -- To Create A User --
- -- Go to Login --
- -- Screen and type --
- -- createaccount --
- -- for the username --
- -- and leave the --
- -- password blank --
- -- and it will open --
- -- a UI to create --
- -- a new account --
- ----------------------
- -- config.cfg setup --
- -- Locked? --
- -- MaxTries --
- -- Door Time --
- -- Door Side --
- ----------------------
- --if Ch == nil then
- --Ch = 0
- --end
- -- password = "super"
- -- Side = "left"
- -- Sec = 5
- -- MaxTries = 5
- function login()
- clear()
- -- print("You have used "..Ch.."/"..MaxTries.." tries")
- write("Username: ")
- User = read()
- -- print()
- write("Enter Password: ")
- input = read("*")
- if User ~= "ADMIN" and input ~= "ADMIN" and User ~= "createaccount" then
- checkUser(User, input)
- elseif User == "ADMIN" and input == "ADMIN" then
- error()
- elseif User == "createaccount" then
- clear()
- print("Welcome to the account creation interface")
- print("Please Fill out The Following Information")
- write("Username: ")
- User = read()
- write("Password: ")
- Pass = read("*")
- write("Confirm Password: ")
- CPass = read("*")
- if Pass ~= CPass then
- print("The Two Passwords Don't Match Resetting")
- login()
- else
- ca = fs.open("acc/"..User, "w")
- ca.write(Pass.."\n".."0")
- ca.close()
- end
- end
- login()
- if false then
- if input == password then
- rs.setOutput(Side, true)
- clear()
- print("Welcome User!")
- sleep(Sec)
- rs.setOutput(Side, false)
- Ch = 0
- else
- Ch = Ch + 1
- clear()
- textutils.slowPrint("Incorrect Password You Have "..Ch.."/"..MaxTries.." tries left")
- if not checkTries(Ch) then
- login()
- end
- end
- end
- end
- function checkTries(Tries)
- Tries = tonumber(Tries)
- if Tries >= MaxTries then
- clear()
- print("This Computer Is Locked Please Contact Your Admin")
- up = fs.open("config.cfg", "w")
- up.write("true")
- up.close()
- while true do
- ce = read()
- if string.lower(ce) == "reset md5 hash" then
- break
- end
- end
- Ch = 0
- login()
- else
- return false
- end
- end
- function checkUser(N, P)
- -- N = User Submitted Username
- -- P = User Submitted Password
- if fs.exists("acc/"..N) then
- OP = fs.open("acc/"..N, "r")
- -- Things = OP.readAll()
- -- OP.close()
- Pass = OP.readLine()
- Ch = OP.readLine()
- if P == Pass then
- Chs = 0
- OI = fs.open("acc/"..N,"w")
- OI.write(P.."\n"..Chs)
- OI.close()
- rs.setOutput(Side, true)
- print()
- print("Welcome "..N)
- sleep(Sec)
- rs.setOutput(Side, false)
- login()
- else
- clear()
- Ch = tonumber(Ch)
- Chs = Ch + 1
- ff = fs.open("acc/"..N, "w")
- ff.write(Pass.."\n"..Chs)
- ff.close()
- checkTries(Chs)
- print("Incorrect Password You Have "..Chs.."/"..MaxTries.." left")
- sleep(3)
- login()
- end
- else
- printError("Error: Account Does Not Exist")
- sleep(5)
- login()
- end
- end
- if not fs.exists("config.cfg") then
- clear()
- print("Hello Welcome To The Setup Guide")
- print("What would you like the max tries to be?")
- write("MaxTries: ")
- Max = read()
- print("How Long Should The Door Be Open")
- write("Seconds: ")
- Secs = read()
- while true do
- print("Which Side is the door on?")
- print("(right/left/top/bottom/front/back)")
- tSide = string.lower(read())
- for i = 1, #Sides do
- if tSide == Sides[i] then
- Conf = true
- end
- end
- if Conf then
- break
- else
- printError("Invalid Side")
- end
- end
- print()
- print("If you would like to create an account")
- print("On the account creation screen user username")
- print("\"createaccount\" and leave the password blank")
- print("To begin account creation")
- print("Press Any Key To Continute")
- sleep(1)
- os.pullEvent("key")
- po = fs.open("config.cfg", "w")
- po.writeLine("false")
- po.writeLine(Max)
- po.writeLine(Secs)
- po.writeLine(tSide)
- po.close()
- os.reboot()
- else
- ip = fs.open("config.cfg", "r")
- locked = ip.readLine()
- MaxTries = tonumber(ip.readLine())
- Sec = tonumber(ip.readLine())
- Side = ip .readLine()
- if locked == "true" then
- ip.close()
- checkTries(MaxTries)
- else
- login()
- end
- end
- --if not checkTries(Ch) then
- -- login()
- --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement