logged = 0 function checklogin(username,password) if username == nil or password == nil then shell.run("RedTechServer") else local file = fs.open(username, "r") if password == file.readLine() then logged = 1 else logged = -1 end end end while true do id,msg = rednet.receive() print("User " .. id .. " has sent out the message: " .. msg) if msg == ("login") then local idlat = id logged = 0 print("Received Login request") id,msg = rednet.receive() if msg ~= "" then print("Received Username") local user = msg id,msg = rednet.receive() if msg ~= "" then print("Received Password") local pass = msg checklogin(user,pass) if logged == 1 then print("confirmed") rednet.send(idlat,"confirmed") else if logged == -1 then print("wrong combination") rednet.send(idlat, "wrong") else end end else rednet.send(idlat,"wrong") end else rednet.send(idlat,"wrong") end else end end