How to change user data via Lua?

You can share your Lua Scripts with everybody here.

How to change user data via Lua?

Postby Zager » Wed Feb 22, 2012 6:13 am

I want to change the settings programmatically:

    strNoteAddress,
    strNoteZip,
    strNotePhone,
    strNoteFax,
    strNoteEmail,
    strNoteMemo
how to do it with language Lua?
Zager
 
posts 8
 
joined Wed Feb 22, 2012 6:04 am

Re: How to change user data via Lua?

Postby FTP » Wed Feb 22, 2012 1:43 pm

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)
FTP
Site Admin
 
posts 1225
 
joined Tue Sep 29, 2009 6:09 am

Re: How to change user data via Lua?

Postby Zager » Wed Feb 22, 2012 5:05 pm

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?
Zager
 
posts 8
 
joined Wed Feb 22, 2012 6:04 am

Re: How to change user data via Lua?

Postby FTP » Thu Feb 23, 2012 11:14 am

The previous script has been modified, please check it again.
FTP
Site Admin
 
posts 1225
 
joined Tue Sep 29, 2009 6:09 am

Re: How to change user data via Lua?

Postby Zager » Fri Feb 24, 2012 6:18 am

Image
Image

What to do?
Zager
 
posts 8
 
joined Wed Feb 22, 2012 6:04 am

Re: How to change user data via Lua?

Postby Zager » Tue Feb 28, 2012 5:50 am

Any ideas how to remove this error?
Zager
 
posts 8
 
joined Wed Feb 22, 2012 6:04 am

Re: How to change user data via Lua?

Postby FTP » Mon Mar 05, 2012 11:58 am

It means you can't get that user.
FTP
Site Admin
 
posts 1225
 
joined Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron