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

Guest LogIn

Started by UrASmurf, 08 August 2012 - 05:52 PM
UrASmurf #1
Posted 08 August 2012 - 07:52 PM
Hey, I was wondering if it was possible(and if it is, if anyone could kindly make it/show me code) to make a guestlogin on a login system?

This guest would log in with username and password as Guest and have restrictions to what programs they could use, so like they could use a program that says random sentences, but couldn't use the program to dispense food.
ImNutzForCoal #2
Posted 08 August 2012 - 08:18 PM
This should do, just edit startup and type it in. Comments can be removed if you wish.

-- Code is by ImNutzForCoal for UrASmurf
local gpw = "yourPasswordHere"
local admin = "administratorPasswordHere"
term.clear()
term.setCursorPos(1,1)
print("iNFC | guestLogonOS"
term.setCursorPos(2,1)
print("Welcome Guest!")
term.setCursorPos(2,1)
print("Please enter the password:")
pw = read("*")
if pw == gpw then
print("Welcome")
print("yourMessageHere")
--Add more code.
elseif pw == admin then
print("Administrator Password accepted.")
print("administratorOptions")
end

ofcourse, edit yourPasswordHere to the password you want the guests to use
and administratorPasswordHere to the admin override password.

EDIT: re-read your post, it might not be what you are looking for, I will see if I can make it so that Guest gets access to limited programs, and whatnot.
Pharap #3
Posted 09 August 2012 - 06:29 AM
Well, the key issue here is that to restrict the available programs, you'll either have to dump them somewhere else (eg a hidden computer behind the first one) or essentially write your own OperatingSystem/OSEmulator.
It can be done though, depends how much you are up to coding.
Personally I'd dump all the data onto a hidden computer.

In fact, you could make it so that when an admin logs in, an external computer downloads all the restricted programs to the PC and when a guest logs in, the program deletes all the restricted programs.

Is that enough for you to get started or would you like some sample code?
UrASmurf #4
Posted 09 August 2012 - 06:55 PM
Er. I really have no idea how I would do any of that.

Noob coder here. Only know how to use like print " and redstone.setOuput. D:
Pharap #5
Posted 10 August 2012 - 01:43 AM
Er. I really have no idea how I would do any of that.

Noob coder here. Only know how to use like print " and redstone.setOuput. D:

Ok, there are several ways to go about it, some are more complicated than others but the more complicated ones tend to be more accurate/better.
Also it depends on how serious/secure the program needs to be (eg are you using it on a public server or a private server)

The best way I can think of doing it that you'll understand is the turtle method.

You'll have to give me a day or two to get the code done (as well as juggling all the other stuff I have to do) and you will have your program, hopefully with comments.