Import user accounts from domain A to domain B

You can share your Lua Scripts with everybody here.

Import user accounts from domain A to domain B

Postby FTP » Wed Jun 09, 2010 5:03 am

-- Description: Import user accounts from domain1 to domain2, support XML, ODBC, Mysql
-- Author: Luke
-- Date: 2010-06-08

Code: Select all
local pages = c_GetUserPageCount("domain1")
if pages == 0 then pages = 1 end

for i=1,pages do
   local userlist = Split(c_GetUserListPage("domain1",i), "\n")

   for _,username in pairs(userlist) do
      local myuser = c_GetUser("domain1",username)

      if myuser ~= nil then
         myuser.oldpassword = myuser.password

         for k,v in pairs(myuser) do
           if type(v) == "boolean" then
             if v == true then
               myuser[k] = 1
             else
               myuser[k] = 0
             end
           end
         end

         AddUser("domain2",myuser)
      end
   end
end
FTP
Site Admin
 
364
 
Tue Sep 29, 2009 6:09 am

Return to Lua scripts

Who is online

Registered users: Majestic-12 [Bot]