Jump to content

help xml


Recommended Posts

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? :D

Link to comment
  • Moderators

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

Link to comment
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

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...