Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php脚本更改ejabberd中的密码_Php_Ejabberd - Fatal编程技术网

使用php脚本更改ejabberd中的密码

使用php脚本更改ejabberd中的密码,php,ejabberd,Php,Ejabberd,这是更改ejabberd中用户密码的任何可能方法吗 我尝试过使用下面的xml,但它对我不起作用 尝试: <iq type='set' id='fabiang_xmpp_57e51e6c39d4d' from='admin@192.168.1.73'> <query xmlns='jabber:iq:register'> <username>test</username> <password>newpass</p

这是更改ejabberd中用户密码的任何可能方法吗 我尝试过使用下面的xml,但它对我不起作用

尝试:

<iq type='set' id='fabiang_xmpp_57e51e6c39d4d' from='admin@192.168.1.73'>
  <query xmlns='jabber:iq:register'>
    <username>test</username>
    <password>newpass</password>
</query>
</iq>

测试
纽帕斯
结果:

{xmlcdata,<<"User already exists">>}
{xmlcata,}
尝试:

<iq type='set' id='fabiang_xmpp_57e51e6c39d4d'>
      <query xmlns='jabber:iq:register:changepassword'>
       <old_password>test</old_password>
       <username>87906</username>
       <password>google</password>
      </query>
</iq>

测试
87906
谷歌
结果:

{xmlcdata,<<"No module is handling this query">>}
{xmlcata,}
仅供参考:我从ejabberd.log捕获的错误/结果

有什么想法,有什么帮助吗


提前感谢

您的第一节很好,只是您试图更改其他用户的密码(您以管理员身份登录并更改测试密码)。我没想到会这样

这应该很好:

<iq type='set' id='fabiang_xmpp_57e51e6c39d4d' from='admin@192.168.1.73'>
  <query xmlns='jabber:iq:register'>
    <username>admin</username>
    <password>newpass</password>
</query>
</iq>

管理
纽帕斯

您的第一节很好,只是您试图更改其他用户的密码(您以管理员身份登录并更改测试密码)。我没想到会这样

这应该很好:

<iq type='set' id='fabiang_xmpp_57e51e6c39d4d' from='admin@192.168.1.73'>
  <query xmlns='jabber:iq:register'>
    <username>admin</username>
    <password>newpass</password>
</query>
</iq>

管理
纽帕斯

对于PHP,您可以尝试以下方法

public function changePassword($user, $host, $new_password) 
{
    @exec('sudo ejabberdctl change-password '.$user.' '.$host.' '.$new_password.' 2>&1', $output, $status);
    return $output;       
}

对于PHP,您可以尝试以下方法

public function changePassword($user, $host, $new_password) 
{
    @exec('sudo ejabberdctl change-password '.$user.' '.$host.' '.$new_password.' 2>&1', $output, $status);
    return $output;       
}

感谢您的回复,您的解决方案无法运行其抛出错误,如:get_entity_affiliationsThanks for reply,你的解决方案没有运行它的抛出错误,比如:获取实体,感谢回复,但我不是在寻找命令,我需要的解决方案,我可以通过其他方式,感谢回复,但我不是在寻找命令,我需要的解决方案,我可以通过其他方式