Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- To prevent people from using Ctrl + T on this program, uncomment the next two commented lines AND the very last line. Don't do it until both programs actually work together.
- --local oldPullEvent = os.pullEvent
- --os.pullEvent = os.pullEventRaw
- while true do -- Repeat the login loop until a user logs in successfully
- print(" Login ")
- print("=========")
- sleep(1)
- print(" ")
- sleep(1)
- print("Username: ")
- sleep(1)
- login = read() --you enter your username
- sleep(1)
- rednet.open("right") --open connection to the modem
- rednet.send(3, login) --send the username to pc3(DB PC)
- sleep(2)
- x,y,z = rednet.receive() --waiting for the answer with the pw or wpw message
- if y == "wpw" then --if wpw then restart the login process
- print("Wrong username!")
- sleep(1)
- else
- sleep(1)
- print("Password: ")
- sleep(1)
- -- It can be simplified to just this, since you don't ever reference to the pw variable again
- if read("*") == y then --if the entered password is equal to the pw sent back by the DB then access is granted
- print("Access Granted!")
- sleep(1)
- print("Main menu following...")
- sleep(2)
- break -- Exit the while loop and the program
- else --if it's not equal start the program again
- print("Wrong password!")
- sleep(1)
- end
- end
- --os.pullEvent = oldPullEvent
Advertisement
Add Comment
Please, Sign In to add comment