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

[1.2.4] Login screen Please help

Started by nitebomber51, 02 April 2012 - 10:07 AM
nitebomber51 #1
Posted 02 April 2012 - 12:07 PM
Hey guys its me again on the redworks custom OS it has a login with a username and password and i would like to know how to do that. i want to use something like that with my custom OS
thanks
-Nitebomber51
Advert #2
Posted 02 April 2012 - 01:44 PM
You should try to code it yourself first. There are already examples out there (i.e you can look at redworks source).
Mads #3
Posted 02 April 2012 - 07:27 PM
You can try my API. It is pretty useful for storing data for a long time. You can see it here :)/>/>
Hope you enjoy.
Advert #4
Posted 02 April 2012 - 07:55 PM
You can try my API. It is pretty useful for storing data for a long time. You can see it here :)/>/>
Hope you enjoy.
The Ask a Pro forum isn't really for advertising your APIs, especially when they didn't ask for something like it.
Noodle #5
Posted 03 April 2012 - 03:31 AM
You could just replace the startup of the computer with a simple login code.
To make it allocate the given password just have it read the input and make it a permanent thing.
nitebomber51 #6
Posted 03 April 2012 - 10:37 AM
edvert i'm thankful for your input but i already looked at the sorce of redworks and cant find anything which is why i posted here i would like the code to analyze and see how it works so if anyone can do that thanks
Luanub #7
Posted 03 April 2012 - 11:11 AM
Something simple to start with… Granted keep in mind the more users you have the more cluttered the script is going to be. So….you will really need to use some files to store the usernames/passwords in and check against that instead of what I'm going to do here. This is just something very basic to get you thinking….


user = ("bob")
password = ("abc123")
write ("Enter Username: ")
local uname = read()
write ("Enter Password: ")
local passwd = read("*")
if uname == user and passwd == password then
do some stuff
else
print ("incorrect username or password entered try again")
end

This is in no way secure, ctrl + t will terminate it and give the user access to the system. Like I said just an example to get you started. Read the tutorials and check out some of the existing programs. Come back when you're having issues with your code..
Edited on 03 April 2012 - 09:12 AM
nitebomber51 #8
Posted 03 April 2012 - 11:18 AM
thanks i'll throw something in there which stops the ctrl+T thing ill find something thanks luanub
nitebomber51 #9
Posted 03 April 2012 - 11:44 AM
Something simple to start with… Granted keep in mind the more users you have the more cluttered the script is going to be. So….you will really need to use some files to store the usernames/passwords in and check against that instead of what I'm going to do here. This is just something very basic to get you thinking….


user = ("bob")
password = ("abc123")
write ("Enter Username: ")
local uname = read()
write ("Enter Password: ")
local passwd = read("*")
if uname == user and passwd == password then
do some stuff
else
print ("incorrect username or password entered try again")
end

This is in no way secure, ctrl + t will terminate it and give the user access to the system. Like I said just an example to get you started. Read the tutorials and check out some of the existing programs. Come back when you're having issues with your code..
thanks man so to add more users to that i would type in

user = ("bob")
user2 = ("bill")
password = ("abc123")
pass2= ("def456")
write ("Enter Username: ")
local uname = read()
write ("Enter Password: ")
local passwd = read("*")
if uname == user or user2 and passwd == password or pass2 then
do some stuff
else
print ("incorrect username or password entered try again")
end
or if not what would i type in?

-nitebomber51
Luanub #10
Posted 03 April 2012 - 11:50 AM
Close, you would probably what to do an if/elseif for it


if uname == user and passwd == password then
do some stuff
elseif uname == user2 and passwd == pass2 then
do the same stuff
else
print ("incorrect username or password entered try again")
end

You can see why this is probably far from efficient and why you would want to make the code more advanced if you expect a large number of users. Gives you an idea on the logic of it all though.
Hidden Monarch #11
Posted 03 April 2012 - 10:14 PM
Something simple to start with… Granted keep in mind the more users you have the more cluttered the script is going to be. So….you will really need to use some files to store the usernames/passwords in and check against that instead of what I'm going to do here. This is just something very basic to get you thinking….


user = ("bob")
password = ("abc123")
write ("Enter Username: ")
local uname = read()
write ("Enter Password: ")
local passwd = read("*")
if uname == user and passwd == password then
do some stuff
else
print ("incorrect username or password entered try again")
end

This is in no way secure, ctrl + t will terminate it and give the user access to the system. Like I said just an example to get you started. Read the tutorials and check out some of the existing programs. Come back when you're having issues with your code..
thanks man so to add more users to that i would type in

user = ("bob")
user2 = ("bill")
password = ("abc123")
pass2= ("def456")
write ("Enter Username: ")
local uname = read()
write ("Enter Password: ")
local passwd = read("*")
if uname == user or user2 and passwd == password or pass2 then
do some stuff
else
print ("incorrect username or password entered try again")
end
or if not what would i type in?

-nitebomber51
The problem with that is if there was a user bob and another user joe and Bob's pass was water and Joe's was dollar I could enter bob for user and dollar as pass even though that isn't a valid combination.
nitebomber51 #12
Posted 04 April 2012 - 01:29 AM
Something simple to start with… Granted keep in mind the more users you have the more cluttered the script is going to be. So….you will really need to use some files to store the usernames/passwords in and check against that instead of what I'm going to do here. This is just something very basic to get you thinking….


user = ("bob")
password = ("abc123")
write ("Enter Username: ")
local uname = read()
write ("Enter Password: ")
local passwd = read("*")
if uname == user and passwd == password then
do some stuff
else
print ("incorrect username or password entered try again")
end

This is in no way secure, ctrl + t will terminate it and give the user access to the system. Like I said just an example to get you started. Read the tutorials and check out some of the existing programs. Come back when you're having issues with your code..
thanks man so to add more users to that i would type in

user = ("bob")
user2 = ("bill")
password = ("abc123")
pass2= ("def456")
write ("Enter Username: ")
local uname = read()
write ("Enter Password: ")
local passwd = read("*")
if uname == user or user2 and passwd == password or pass2 then
do some stuff
else
print ("incorrect username or password entered try again")
end
or if not what would i type in?

-nitebomber51
The problem with that is if there was a user bob and another user joe and Bob's pass was water and Joe's was dollar I could enter bob for user and dollar as pass even though that isn't a valid combination.
Hmmm this is more complex than i thought. this is going to need more of my time…
Heres what im going to do
1. Copywrite some stuff
2. hire Korean person to do it all for me
3. ?????
4. Profit
FuzzyPurp #13
Posted 04 April 2012 - 04:51 AM
edvert i'm thankful for your input but i already looked at the sorce of redworks and cant find anything which is why i posted here i would like the code to analyze and see how it works so if anyone can do that thanks

Pretty sure you looked in the wrong place :)/>/> I moved the login script into the API in version 0.6