Change user password through webservice

You can share your Lua Scripts with everybody here.

Change user password through webservice

Postby FTP » Wed Mar 10, 2010 4:28 pm

-- Description: Change user password through webservice
-- Here is an PHP example for calling Lua webservice
-- Author: Luke
-- Date: 2010-03-10


Code: Select all
<?php

$strUrl = "http://127.0.0.1:5466/admin_webservice.html";
$strUrlParam = "?admin=demo&pass=demo123&cmd=";
$strLuaScript = <<<EOT
   local strDomain = "mydomain"
   local strUsername = "myuser"
   local strNewPass = "12345"
   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.password = strNewPass
   AddUser(strDomain,tableUser)
EOT;

$strResult = file_get_contents($strUrl.$strUrlParam.rawurlencode($strLuaScript));
print($strResult);

?>
FTP
Site Admin
 
posts 1220
 
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