~DarkRacer~ Posted April 4, 2014 Posted April 4, 2014 Can someone explain to me how can i create a protected xml file to use it to store player's username and password, i know how to create an xml file its obvious, but i want to make it hidden so no one can see its content on the client's pc.
tosfera Posted April 4, 2014 Posted April 4, 2014 Why do you want to create an XML file to store userdata? If someone manages to get the xml file your entire account system would be ehh... wide open. I'd suggest to use a database. It can be a local database or a bigger one that's extern.
~DarkRacer~ Posted April 4, 2014 Author Posted April 4, 2014 I tried it on my mysql database and it works but what if the player have more than one account? my method was to get userdata from user's serial, so i decided to make it as a local xml file in this format: <userdata> <acc></acc> <pass></pass> </userdata> with the possibility of no one to see this file, how would i do that?
Moderators IIYAMA Posted April 4, 2014 Moderators Posted April 4, 2014 You can use sha256, but you only can use it if you are going to compare passwords: local myPassword = sha256 ("myPassword") -- save this. if myPassword == sha256 (.....) then Else you have to create your own password decoder. local myConvertTable = {["A"]="C",["Y"]="*",["4"]=")" ... etc, local myPassword= "WTF!" myPassword = string.upper(myPassword) myPassword = string.reverse(myPassword) local stringLen= string.len (myPassword)--4 local newString = "" for i=1,stringLen do local character = string.sub(myPassword, i,i) newString .. (myConvertTable[character] or character) end And set this decoder at serverside to prevent people can use the decoder at home. I bet you can find a creative way to do this. http://lua-users.org/wiki/StringLibraryTutorial
~DarkRacer~ Posted April 4, 2014 Author Posted April 4, 2014 You can use sha256, but you only can use it if you are going to compare passwords: local myPassword = sha256 ("myPassword") -- save this. if myPassword == sha256 (.....) then Else you have to create your own password decoder. local myConvertTable = {["A"]="C",["Y"]="*",["4"]=")" ... etc, local myPassword= "WTF!" myPassword = string.upper(myPassword) myPassword = string.reverse(myPassword) local stringLen= string.len (myPassword)--4 local newString = "" for i=1,stringLen do local character = string.sub(myPassword, i,i) newString .. (myConvertTable[character] or character) end And set this decoder at serverside to prevent people can use the decoder at home. I bet you can find a creative way to do this. http://lua-users.org/wiki/StringLibraryTutorial unfortunately i will not going to compare the data i will actually retrieve them but yes the decoder idea is great.. i will work on my own one. and as for the xml file that i was talking about.. i found a way to do it, here is my code: if not fileExists("@userdata.xml") then local file = fileCreate("@userdata.xml") fileWrite(file, '') fileClose(file) end local xml = xmlLoadFile("@userdata.xml") local rememberData = {} for i,node in pairs(xmlNodeGetChildren(xml))do rememberData[xmlNodeGetName(node)] = xmlNodeGetValue(node) end xmlUnloadFile(xml) local acc = rememberData.acc or '' local pass = rememberData.pass or '' guiSetText(usernameEdit, acc) guiSetText(passwordEdit, pass) Thank you all
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now