Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --settings
- Username = "User1"
- Compid = os.computerID()
- Label = os.getComputerLabel()
- LoginServ = 1337
- rednet.open("right")
- rednet.open("left")
- rednet.open("front")
- rednet.open("back")
- rednet.open("top")
- rednet.open("bottom")
- ready = 0
- --functions
- local function Login()
- shell.run("clear")
- term.setCursorPos(15,9)
- write ("Username: ")
- UserIn = read()
- term.clear()
- term.setCursorPos(15,9)
- write ("Password: ")
- PassIn = read()
- ping = rednet.send(LoginServ, "Ping")
- if ping == True then
- elseif ping == False then
- term.setCursorPos(15,9)
- write ("Error 32: Login Servers Can Not Be Reached")
- term.setCursorPos(15,10)
- write ("Please Report this error to your local Administrator")
- sleep(2)
- i = 0
- while ready == 0 do
- i = i + 1
- if i = 5 then
- print("Login Servers Busy, Try Again")
- sleep(3)
- os.reboot()
- rednet.send(LoginServ, "Waiting")
- id, msg = rednet.recieve(0.1)
- if msg == "ready" then
- ready = 1
- end
- end
- rednet.send(LoginServ, UserIn) -- Sends username to Login Server
- rednet.send(LoginServ, PassIn) -- Sends Password to login server to compare
- id, msg = rednet.receive(2)
- if msg == "Invalid" then
- term.clear()
- term.setCursorPos(15,9)
- write ("Access Denied")
- term.setCursorPos(15,10)
- write ("Username and Password do not match")
- sleep(3)
- os.shutdown()
- elseif msg == "Correct" then
- rednet.send(LoginServ, Label) -- Sends the Comp label to login server to check if user has clearance
- id, msg = rednet.receive(2)
- elseif msg == "Denied" then
- term.clear()
- term.setCursorPos(15,9)
- write ("You do not have access to this terminal")
- sleep(3)
- os.shutdown()
- elseif msg == "Granted" then
- rednet.send(LoginServ, "IsFirst")
- id, msg = rednet.receive(2)
- if msg == "yes" then
- term.setCursorPos(15,9)
- write ("This is your first time logining in.")
- term.setCursorPos(15,10)
- write ("Please Enter Your New Password")
- term.setCursorPos(15,11)
- write ("Password: ")
- NewPass = read()
- rednet.send(LoginServ, NewPass)
- shell.run("clear")
- term.setCursorPos(15,9)
- write ("Your Password has been changed to: ", NewPass)
- sleep(1)
- rednet.send(LoginServ, "EndLogin")
- Desktop()
- elseif msg == "no" then
- rednet.send(LoginServ, "EndLogin")
- Desktop()
- end
- end
- end
- end
- end
- local function Desktop()
- while true do
- local time = os.time()
- time = textutils.formatTime(time, false)
- term.clear()
- shell.run("clear")
- print("Logged In As: ", Username, " ComputerID: ", Compid)
- term.setCursorPos(1,5)
- print(" _____ __ ")
- print(" /\ | ____/_ | ")
- print(" / \ _ __ ___ __ _ | |__ | | ")
- print(" / /\ \ | '__/ _ \/ _` | |___ \ | | ")
- print(" / ____ \| | | __/ (_| | ___) || | ")
- print(" /_/ \_\_| \___|\__,_| |____/ |_| ")
- term.setCursorPos(1,17)
- term.write("|=====|------------------------------------------|")
- print("|SHIFT| |", time ,"|")
- term.setCursorPos(1,19)
- term.write("|=====|------------------------------------------|")
- event, id = os.pullEvent()
- if event == "key" and id == "25" then
- Menu()
- end
- if event == "key" and id == "42" then
- event, id = os.pullEvent()
- if event == "char" and id == "l" then
- Logout()
- else end
- end
- end
- end
- local function Logout()
- shell.run("clear")
- print("Logout")
- sleep(2)
- end
- local function Menu()
- shell.run("clear")
- print("menu function")
- sleep(2)
- end
- --program
- while true do
- Login()
- end
Add Comment
Please, Sign In to add comment