How to change user data via Lua?

You can share your Lua Scripts with everybody here.
Post Reply
Zager
Posts: 8
Joined: Wed Feb 22, 2012 6:04 am

How to change user data via Lua?

Post by Zager »

I want to change the settings programmatically:
  • strNoteAddress,
    strNoteZip,
    strNotePhone,
    strNoteFax,
    strNoteEmail,
    strNoteMemo
how to do it with language Lua?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: How to change user data via Lua?

Post by FTP »

Code: Select all

   local strDomain = "mydomain"
   local strUsername = "myuser"
   local tableUser = c_GetUser(strDomain,strUsername)

   --change all the boolean values into integer values
   for k,v in pairs(tableUser) do
      if type(v) == "boolean" then
         if v == true then
            tableUser[k] = 1
         else
            tableUser[k] = 0
         end
      end
   end

   tableUser.note_address = ""
   tableUser.note_zip = ""
   tableUser.note_phone = ""
   tableUser.note_fax = ""
   tableUser.note_email = ""
   tableUser.note_memo = ""

   tableUser.oldpassword = tableUser.password

   AddUser(strDomain,tableUser)
Zager
Posts: 8
Joined: Wed Feb 22, 2012 6:04 am

Re: How to change user data via Lua?

Post by Zager »

Thank you.
To run this code I need to change the script: c:\Program Files\Wing FTP Server\webclient\changepass.html
Why then he did not call the function c_GetUser???
What to do?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: How to change user data via Lua?

Post by FTP »

The previous script has been modified, please check it again.
Zager
Posts: 8
Joined: Wed Feb 22, 2012 6:04 am

Re: How to change user data via Lua?

Post by Zager »

Image
Image

What to do?
Zager
Posts: 8
Joined: Wed Feb 22, 2012 6:04 am

Re: How to change user data via Lua?

Post by Zager »

Any ideas how to remove this error?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: How to change user data via Lua?

Post by FTP »

It means you can't get that user.
Post Reply