Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local usePrinter = true
- -- If you put this to true, put a Printer to the
- -- right of the Server Computer.
- local printer = nil
- if usePrinter == true then
- printer = peripheral.wrap("right")
- end
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.purple)
- print("Starting Login Server...")
- local accounts = {
- {"DataIsLoading", "bxe9w123"}
- }
- print("Loaded Accounts.")
- rednet.open("top")
- print("Started RedNet.")
- while true do
- id, username, password = rednet.receive()
- if username == "RequestStatus" then
- rednet.send(id, mode, true)
- else
- for _, Account in ipairs(accounts) do
- if username == Account[1] then
- if password == Account[2] then
- rednet.send(id, true)
- print("["..username.."] Connection accepted.")
- if usePrinter == true then
- local page = printer.newPage()
- printer.write("New Connection Access")
- printer.setCursorPos(1, 3)
- printer.write("Access Granted.")
- printer.setPageTitle("Access Request: "..username)
- printer.endPage()
- end
- else
- rednet.send(id, false)
- end
- else
- rednet.send(id, false)
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment