I tried to post this earlier and I don't believe it's available. When I tried to search for it by the exact name it wouldn't show any contents so I am reposting in the hope it will finally show up. If it somehow posts twice, I apolgize in advance.
–Previous Message–
Morning everyone! I am still very new to ComputerCraft but am diving into it's depths pretty quick, trying to learn about as many of the API's as I can. I have watched hundreds of tutorials related to password coded door locks using CC 1.3 and CC 1.4. The basic password locks are kind of nice, but every once in a while I get a bit nervous about the security of my doors. Yesterday I build a completely automated Nuclear Reactor Facility (took me two weeks to plan it out and make it work right) xD, I placed a double Reinforced Stone Door with a computer coded lock. The lock is a multi variable lock that requires both a Username AND Password to match before the door will unlock. As previously noted… I'm kind of nervous about my doors, this facility required 60+ DIFFERENT parts to create and I would really hate to see somoeone break something expensive in there.
Here is what I would like to do:
Create a central server for storing/validating the username(s), password(s) entered through the client terminal connected to the door of the facility.
Allow 3 failed login attempts before completely disabling the terminal for 1 hour (86400 seconds).
I would like to maintin the current structure of the system in that, it still requires a match of BOTH variables to proceed through the the hall into the facility. Below is a copy of the current code running on that door. Please feel free to comment / corrent / suggest changes in the current design. ANY help with this project is MUCH appreciated. Thanks in advance.
--Disable Manual Termination
os.pullEvent = os.pullEventRaw
--Declare Variables
local username;
local password;
id = "Crysys";
key = "thewhiterabbit";
override= "6552180573395";
alarmSide = "back";
alarmTimeout = "3";
doorSide = "bottom";
doorTimeout = "5";
errorTimeout = "1";
delay = "1";
--Display Data Requests, Get Inputs
term.clear();
term.setCursorPos(1,1);
print("Nuclear Facility - Access Verification Required");
print("");
print("Username:");
term.setCursorPos(11,3);
username = read();
print("Password:");
term.setCursorPos(11,4);
password = read("*");
--Handle Inputs
if username == id and password == key then
term.clear();
term.setCursorPos(1,1);
print("Access Granted");
rs.setOutput(alarmSide, true);
sleep(alarmTimeout);
rs.setOutput(alarmSide, false);
sleep(delay);
rs.setOutput(doorSide, true);
sleep(doorTimeout);
rs.setOutput(doorSide, false);
os.reboot();
elseif username == id and password == override then
term.clear();
term.setCursorPos(1,1);
print("Maintanence Mode ENABLED");
print("");
else
print("Login FAILED");
sleep(errorTimeout);
os.reboot();
end