and i also want to know how to allow guest account only read only access
PLEASE HELP ME FIX THIS PROBLEM
Rougeminner
Edited by Rougeminner, 09 June 2014 - 07:41 AM.
Posted 09 June 2014 - 07:39 AM
Edited by Rougeminner, 09 June 2014 - 07:41 AM.
Posted 09 June 2014 - 08:50 AM
local pass="1234"
local user="4321"
local input_user = read()
local input_pass = read("*") -- the star, so the password isnt visible
-- now to the comparrison
---------------------------Remember this "and"
if input_user == user and input_pass == pass then
--- your code if everything was entered correctly
else
-- show invalid login
end
Posted 09 June 2014 - 12:09 PM
local users = {}
users["Rougeminer"] = "myPassword"
local input = read()
if users[input] == "myPassword" then
--A login
elseif users[input] then
--An invalid password
else
--An invalid username
end
local oldfs = {} --#this bit creates a "backup" of the fs functions, so you can be free to overwrite the originals. Don't forget this
for k, v in pairs( fs ) do
oldfs[k] = v
end
function fs.move( fPath, tPath )
if fPath:sub( 1, 1 ) == ":" --#change this if you like, I'm using a colon ( : ) to name locked files. ei :login or :term Additionally, I'm using the string.sub( str, startnum, endnum ) in it's colen notation form on the variable fPath
--#this file is locked
else
--#this file isn't locked so...
oldfs.move( fPath, tPath )
end
end
Of course, you will want to overwrite much more than just one function, but I'm not going to do this all for you xD.
Posted 09 June 2014 - 12:22 PM
Posted 10 June 2014 - 03:57 AM
Edited by Rougeminner, 10 June 2014 - 03:59 AM.
Posted 10 June 2014 - 04:07 AM
-- All Variable defintions here
local password = 'admin'
local hint = 'access level'
local try = 0
-- All functions here
function tries()
if try >= 3 and try <=5 then
term.setCursorPos(3,1)
print(hint)
elseif try == 6 then
print("incorrect reseting")
sleep(.5)
for i = 1 ,121 do
term.setBackgroundColor(colors.black)
local time = 121
time = time-1
print("The computer is locked for ",tostring(time),' seconds left')
os.reboot()
end
end
end
function initial()
term.setCursorPos(1,1)
print("Password")
term.setCursorPos(2,1)
input1 = read()
if input1 == password then
paintuitls.drawLine(2,1,2,8,colors.blue)
sleep(.2)
paintutils.drawLine(2,1,2,8,colors.white)
sleep(.2)
paintutils.drawLine(2,1,2,8,colors.blue)
sleep(3.4)
term.clear()
print("logged in")
elseif not(input1 == password) then
try = try+1
tries()
end
end
i feel really stupid right now for having to ask about a COMPUTER LOCK!Edited by Rougeminner, 10 June 2014 - 04:08 AM.
0 members, 2 guests, 0 anonymous users