Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Suspender conta

Discussion in 'cPanel Developers' started by Breno Ribeiro, Dec 21, 2016.

Tags:
  1. Breno Ribeiro

    Breno Ribeiro Registered

    Joined:
    Jul 7, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Brasil
    cPanel Access Level:
    Root Administrator
    Bom dia,

    Estou tendo dificuldade para criar as funções de suspender e reativar as contas da minha revenda através da XMLAPI PHP. Criei a seguinte função

    Code:
    
    
    include "../xmlapi.php";
    
    $ip = "MEU IP";
    
    # The access has can be found on your server under WHM's "Setup remote access hash" section or at /root/.accesshash
    $root_hash = "HASH DA REVENDA";
    
    $xmlapi = new xmlapi($ip);
    $xmlapi->hash_auth("LOGIN DA REVENDA",$root_hash);
    $xmlapi->return_xml(1);
    $xmlapi->set_debug(1);
    
    $acct = array( username => "CONTA PARA SER SUSPENSA", reason => "NoPag", disallowun =>"1");
    print $xmlapi->suspendacct($acct);
    
    
    
    Porém estou recebendo como retorno:
    0 Permission Denied

    Este é o meu log:

    Code:
    [21-Dec-2016 11:18:49 Etc/GMT] PHP Notice:  Use of undefined constant user - assumed 'user' in /home/MEU LOGIN/public_html/cpanel/Examples/hashauth_example1.php on line 66
    [21-Dec-2016 11:18:49 Etc/GMT] URL: https://MEU HOST:2087/xml-api/suspendacct
    [21-Dec-2016 11:18:49 Etc/GMT] DATA: user%5Buser%5D=LOGIN PARA SUSPENDER
    
    Preciso de ajuda para que eu possa configurar uma opção de suspender uma conta através do painel que estou desenvolvendo. Obrigado!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You will need to modify your script to include the user, reason, and disallowun parameters:

    Code:
    user
    reason
    disallowun
    Instead of:

    Code:
    username
    reason
    disallowun
    Notice the difference with "user" and "username". Note that documentation on this WHM API 1 function is available at:

    WHM API 1 Functions - suspendacct - Software Development Kit - cPanel Documentation

    Thank you.

    Translation:

    Olá,

    Você precisará modificar seu script para incluir os parâmetros user, reason e disallowun:

    Code:
    user
    reason
    disallowun
    Ao invés de:

    Code:
    username
    reason
    disallowun
    Observe a diferença com "usuário" e "nome de usuário". Observe que a documentação sobre esta função WHM API 1 está disponível em:

    WHM API 1 Functions - suspendacct - Software Development Kit - cPanel Documentation

    Obrigado.

    Mod Note: Edited for clarification
     
  3. Breno Ribeiro

    Breno Ribeiro Registered

    Joined:
    Jul 7, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Brasil
    cPanel Access Level:
    Root Administrator
    Então a função passaria a ser CODE ?

    PHP:
    $acct = array( user="demousx"reason="NoPag"disallowun="1");
    Porém me retorna ERRO 500
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you let us know the output to /usr/local/cpanel/logs/error_log when you encounter the 500 error code?

    Also, here's an example to follow for creating a new account:

    xmlapi-php/createacct_example.php at master · CpanelInc/xmlapi-php · GitHub

    You may want to try this out first, and see if it works as expected for a known working example.

    Thank you.

    Translation:

    Olá,

    Você poderia nos informar a saída para /usr/local/cpanel/logs/error_log quando encontrar o código de erro 500?

    Além disso, aqui está um exemplo a seguir para criar uma nova conta:

    xmlapi-php/createacct_example.php at master · CpanelInc/xmlapi-php · GitHub

    Você pode querer tentar isso primeiro e ver se ele funciona como esperado para um exemplo de trabalho conhecido.

    Obrigado.
     
  5. Breno Ribeiro

    Breno Ribeiro Registered

    Joined:
    Jul 7, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Brasil
    cPanel Access Level:
    Root Administrator
    Informações do LOG

    Code:
    [21-Dec-2016 19:13:16 Etc/GMT] PHP Notice:  Use of undefined constant user - assumed 'user' in /home/brenorne/public_html/cpanel/Examples/hashauth_example1.php on line 66
    [21-Dec-2016 19:13:16 Etc/GMT] PHP Notice:  Use of undefined constant reason - assumed 'reason' in /home/brenorne/public_html/cpanel/Examples/hashauth_example1.php on line 66
    [21-Dec-2016 19:13:16 Etc/GMT] PHP Notice:  Use of undefined constant disallowun - assumed 'disallowun' in /home/brenorne/public_html/cpanel/Examples/hashauth_example1.php on line 66
    [21-Dec-2016 19:13:16 Etc/GMT] URL: https://208.91.199.159:2087/xml-api/suspendacct
    [21-Dec-2016 19:13:16 Etc/GMT] DATA: user%5Buser%5D=demousx&user%5Breason%5D=NoPag&user%5Bdisallowun%5D=1
    [21-Dec-2016 19:13:16 Etc/GMT] Authentication Header: Authorization: WHM LOGIN:HASH
    
    [21-Dec-2016 19:13:16 Etc/GMT] RESPONSE:
     <suspendacct>
      <status>0</status>
      <statusmsg>Permission Denied</statusmsg>
    </suspendacct>
    
    <!-- Web Host Manager 11.54.0.28 (c) cPanel, Inc. 2015 http://cpanel.net/  Unauthorized copying is prohibited. -->
    
    
    Quanto a questão de criar a conta, consegui normalmente. Já estou utilizando para criar as contas.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Feel free to open a support ticket using the link in my signature if you'd like us to take a closer look. You can post the ticket number here and we will update this thread with the outcome.

    Thank you.

    Translation:

    Sinta-se livre para abrir um ticket de suporte usando o link em minha assinatura, se você gostaria que olhássemos de perto. Você pode postar o número do ticket aqui e nós atualizaremos este tópico com o resultado.

    Obrigado.
     
Loading...

Share This Page