This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
markmine323's profile picture

[Question][Error]CC Wiki Roaming Profiles Program not working on my server

Started by markmine323, 05 November 2012 - 06:35 AM
markmine323 #1
Posted 05 November 2012 - 07:35 AM
I copy the server and client codes from the ComputerCraft Wiki at:

http://computercraft.info/wiki/index.php?title=Login_with_Roaming_Profiles

and edited them so that the server was 20 and the Clients 19 and 22, changed the modem sides and tried to login in on computer 19 and in came back with Invalid Password, same with computer 22.

Here's the two edited codes:

Server:
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("This is a password server. There is no user interaction here.")
print("Please find a computer and login there.")
local firstCycle = true
local validSender = false
local modemSide = "right" – change to the side of the computer your modem is on
local valid = false
users = { "username1", "username2" } –make sure users and passwords line up
passwords = { "password1", "password2" }
senders = { 19, 22 } – computer ID's of the computers you want to accept requests from
function bootUp()
rednet.open(modemSide)
end
while true do
validSender = false
if firstCycle then
bootUp()
firstCycle = false
end
senderId, message, distance = rednet.receive()
for i,v in ipairs(senders) do
if v == senderId then
validSender = true
break
end
end
if validSender then
for i,v in ipairs(users) do
if message == v then
valid = true
password = passwords
break
else
valid = false
end
end
if valid then
rednet.send(senderId, password, true)
else
rednet.send(senderId, "Not Valid", true)
end
end
end


Client:
os.pullEvent = os.pullEventRaw
local locker = true
local failed = true
local attempted_login = true
local password_server = 20 – change to the ID of your password server computer
rednet.open("left") – change to the side your rednet modem is on
while locker do
attempted_login = false
term.clear()
term.setCursorPos(1,1)
print("Welcome to a USERS PC : Roaming Profile Enabled")
print("What would you like to do?")
print("[1] Login (*)")
print("[2] Shutdown")
write("> ")
local input = read()
if input == "2" then
os.shutdown()
elseif input == "1" then
attempted_login = true
print("Please login…")
write("Username: ")
local username = read()
write("Password: ")
local password = read("*")
rednet.send(password_server, username, true)
senderId, message, distance = rednet.receive(5)
if password == message then
failed = false
locker = false
term.clear()
term.setCursorPos(1,1)
print("Welcome ", username)
else
print("Invalid Username or Password.")
sleep(3)
end
else
print("Command not recognised…")
sleep(2)
end
end
markmine323 #2
Posted 05 November 2012 - 07:42 AM
IGNORE THIS IT NOW WORKS. SERVER WAS JUST DODGY