2 posts
Posted 23 December 2013 - 03:02 AM
Hi, I have been searching everywhere trying to find how to set up a program where you can register and when you do it adds there username they registered with to the usernames table on the server and their password to the password table. This is what I have got already for the Client:
http://pastebin.com/U7ghDu6Y and the Server:
http://pastebin.com/7mBY6npB Can you please help me find out how to do this. Also I want to setup a option where you can change your password but I also don't know how to do that. Thank you. I will put your name in the credits when I make them!
Edited on 23 December 2013 - 09:03 AM
1114 posts
Location
UK
Posted 23 December 2013 - 11:26 AM
A basic way to do this would be adding a user and password to a table, then serializing it and saving it to a file. Your code is fine, except that if the user's password is 300, they would not be able to log in. Also, multiple requests would not get through. And the pointless sleeps.
-- Create the table
local userTable = {}
-- Save user
userTable["username"] = "password"
-- Save file
local userHandle = fs.open("/users", "w")
userHandle.writeLine(textutils.serialize(userTable))
userHandle.close()
-- Load file
local userLoadHandle = fs.open("/users", "r")
local userTable = userLoadHandle.readLine()
userLoadHandle.close()
-- Read passwords
local user = "ZudoHackz"
print("The password for " .. user .. " is " .. userTable[user])
2 posts
Posted 23 December 2013 - 06:22 PM
What happens when another user registers, will it add another thing in the table userTable?
Also, (I'm a bit of a noob doing advanced things :P/>/>) when the user enters there username, I'm going to use the example "Minecraft" and that's all the way at the end of the table, how go I get the program to find the right password, (but there doing it on the client so it would need to be sent though rednet to the server to check it, then the server has to read it and get it then send the password back so that computer could check to see if it's the right password) thank you
Edited on 24 December 2013 - 09:18 AM