Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetName()
- local rootNode = xmlLoadFile("details.xml")
- if rootNode then
- local UserName = xmlFindChild(rootNode, "Username", 0)
- local succes = xmlNodeGetValue (UserName)
- if succes then
- return tostring(succes)
- end
- end
- end
- function GetPassword()
- local rootNode = xmlLoadFile("details.xml")
- if rootNode then
- local UserName = xmlFindChild(rootNode, "Password", 0)
- local succes = xmlNodeGetValue (UserName)
- if succes then
- return tostring(succes)
- end
- end
- end
- function saveDetails(username, password)
- local rootNode = xmlLoadFile("details.xml")
- if rootNode then
- local UserName = xmlFindChild (rootNode, "Username", 0)
- local Password = xmlFindChild (rootNode, "Password", 0)
- local succes = xmlNodeSetValue(UserName, username)
- local succes2 = xmlNodeSetValue(Password, password)
- if succes and succes2 then
- xmlSaveFile(rootNode)
- end
- else
- local RootNode = xmlCreateFile("details.xml","Details")
- local NameNode = xmlCreateChild(RootNode, "Username")
- local PasswordNode = xmlCreateChild(RootNode, "Password")
- local succes3 = xmlNodeSetValue(NameNode, username)
- local succes4 = xmlNodeSetValue(PasswordNode, password)
- if succes3 and succes4 then
- xmlSaveFile(RootNode)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement