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.

Remote password change script problem... need help!

Discussion in 'General Discussion' started by sllik, Sep 16, 2005.

  1. sllik

    sllik Member

    Joined:
    May 9, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Ok here is my script...

    PHP:
    require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
    $host "localhost";
    $user "myuser";
    $accesshash 'myaccesshash';

    echo 
    change_password($host,$user,$accesshash,1,$this_user,$new_pass);

    last line:
    $host,$user,$accesshash,1,$this_user,$new_pass
    not:
    $host,$user,$accesshash,1,$this_us er,$new_pass
    (vbulletin bug?)


    and here is my chage_password function that I've added to Accounting.php.inc

    PHP:
    function change_password ($host,$user,$accesshash,$usessl,$this_user,$new_pass) {
        
    $result whmreq("/scripts/passwd?password=${new_pass}&user=${this_user}",$host,$user,$accesshash,$usessl);
        if (
    $cpanelaccterr != "") { return $cpanelaccterr; }
        return 
    $result;
    }
    it's
    $new_pass
    not
    $new_p ass

    When I run the script from a cpanel theme directory (/usr/local/cpanel/base/frontend/x/change_pass.php), I don't get anything returned. But when I run the script from one of the accounts (/home/account/public_html/change_pass.php), everything works!

    I need to run this script from a theme directory... any idea on what the problem is?
     
    #1 sllik, Sep 16, 2005
    Last edited: Sep 16, 2005
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    A bit of a stab in the dark, but you wouldn't go far wrong checking that the executed script has the correct ownership and permissions to work from the theme directory.
     
  3. sllik

    sllik Member

    Joined:
    May 9, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    I triple checked that

    and the funny thing is, that if I do:

    PHP:
    $accts listaccts($host,$user,$accesshash,0);
    print_r($accts);
    it prints the accounts as it should...
     
  4. sllik

    sllik Member

    Joined:
    May 9, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    argh!

    I've changed it to
    PHP:
    echo change_password($host,$user,$accesshash,0,$this_user,$new_pass);
    and it works....

    any idea why it doesnt like going through ssl?
     
  5. ymfm

    ymfm Active Member

    Joined:
    Feb 21, 2003
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Brazil
    I changed the Accounting.php.inc with 'function change_password' Sllik described but I receive the following error:

    --------------------
    Warning: socket_connect() Host lookup failed [-10004]: No address associated with name in /usr/local/cpanel/Cpanel/Accounting.php.inc on line 111

    Warning: socket_write() unable to write to socket [32]: Broken pipe in /usr/local/cpanel/Cpanel/Accounting.php.inc on line 117

    Warning: socket_write() unable to write to socket [32]: Broken pipe in /usr/local/cpanel/Cpanel/Accounting.php.inc on line 119

    Warning: socket_write() unable to write to socket [32]: Broken pipe in /usr/local/cpanel/Cpanel/Accounting.php.inc on line 121

    Warning: socket_read() unable to read from socket [107]: Transport endpoint is not connected in /usr/local/cpanel/Cpanel/Accounting.php.inc on line 124

    ---------------------


    My script
    require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
    $host = $linha_server[2];
    $user = $linha_server[3];
    $accesshash = $linha_server[4];
    $usessl = 0;
    $this_user = $usuario;
    $new_pass = $senha;
    $sen = change_password($host,$user,$accesshash,$usessl,$dominio,$this_user,$new_pass);
    echo "<pre>";
    print_r($sen);
    echo "</pre>";

    ----------------------

    Thanks for any help
     
Loading...

Share This Page