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
- ----------------------
- -- Use --
- -- User: ADMIN --
- -- Password: ADMIN --
- -- --
- -- To exit program --
- ----------------------
- -- To Create A User --
- -- Create a file in --
- -- Directory acc/ --
- -- And the filename --
- -- Is the Username --
- -- The First Line --
- -- Is The Password --
- -- And The Second --
- -- Line Is The # of --
- -- Tries Left. --
- ----------------------
- if not fs.exists("config.cfg") then
- po = fs.open("config.cfg", "w")
- po.write("false")
- po.close()
- else
- ip = fs.open("config.cfg", "r")
- if ip.readLine() == "true" then
- ip.close()
- checkTries(MaxTries)
- else
- login()
- end
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- 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" then
- checkUser(User, input)
- else
- error()
- 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 checkTries(Ch) then
- login()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement