Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- users = {"Deklungel" , "Blaze" , "Anubis" , "adi" , "bob"}
- pass = {"aap" , "3804" , "2971", "jammin" , "101" }
- accesslevels = {5, 6 , 5 , 5 , 2 }
- requiredaccess = 5
- monitoringstation = 1694
- modemside = "back"
- repeat
- correctuser = false
- correctpassword = false
- canaccess = false
- accessed = false
- term.clear()
- term.setCursorPos(16,7)
- write("Username: ")
- user = read()
- for i,v in ipairs(users) do
- if user == v
- then
- correctuser = true
- password = pass[i]
- accesslevel = accesslevels[i]
- term.setCursorPos(16,8)
- write("Password: ")
- if read("*") == password
- then
- correctpassword = true
- if accesslevel >= requiredaccess
- then
- canaccess = true
- end
- end
- end
- end
- if correctuser == true and correctpassword == true and
- canaccess == true
- then term.setCursorPos(1,7)
- term.clear()
- print(" Access Allowed")
- print("")
- print(" Welcome Back "..user)
- accessed = true
- elseif correctuser == true and correctpassword == true and canaccess == false
- then
- n = tonumber(accesslevel)
- s = ""
- for i = 1, n do
- s = s.."*"
- end
- m = tonumber(requiredaccess)
- d = ""
- for i = 1, m do
- d = d.."*"
- end
- term.setCursorPos(1,6)
- term.clear()
- print(" Access Denied")
- print(" Failed Access check")
- print("")
- print("")
- print("")
- print(" Your Access is "..s)
- print(" This process requires "..d)
- sleep(3)
- elseif
- correctuser == false
- then
- term.setCursorPos(1,7)
- print(" Access Denied")
- print(" "..user.." is not a registered user")
- sleep(1)
- rednet.open(modemside)
- rednet.send(monitoringstation, user.." attempted access")
- rednet.close(modemside)
- fs.makeDir("Logins")
- local file = fs.open("Logins/Fails", "a")
- file.writeLine(tostring("User: "..user.." attempted access"))
- file.close()
- elseif
- correctuser == true and correctpassword == false
- then
- term.clear()
- term.setCursorPos(1,8)
- print(" Incorrect Password")
- sleep(1)
- rednet.open(modemside)
- rednet.send(monitoringstation, "Username "..user.." failed password check")
- rednet.close(modemside)
- local file = fs.open("Logins/Accessed","a")
- file.writeLine(user.." Accessed this terminal")
- file.close()
- else
- print("Access Denied")
- end
- until
- accessed == true
- sleep(1)
- rs.setOutput("top", true)
- shell.run("menu")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement