Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    May 2005
    Posts
    21

    Default Remote password change script problem... need help!

    Ok here is my script...

    PHP Code:
    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 Code:
    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?
    Last edited by sllik; 09-16-2005 at 10:27 AM.

  2. #2
    Member
    Join Date
    Jan 2005
    Posts
    1,880

    Default

    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. #3
    Member
    Join Date
    May 2005
    Posts
    21

    Default

    I triple checked that

    and the funny thing is, that if I do:

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

  4. #4
    Member
    Join Date
    May 2005
    Posts
    21

    Default

    argh!

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

    any idea why it doesnt like going through ssl?

  5. #5
    Member
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    38

    Default

    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

Similar Threads & Tags
Similar threads

  1. Change Password API from remote server?
    By jhyland87 in forum cPanel Developers
    Replies: 4
    Last Post: 06-07-2009, 07:10 AM
  2. Remote password change
    By angelodag in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 05-06-2009, 03:43 PM
  3. Password Change Script
    By bryzo in forum E-mail Discussions
    Replies: 4
    Last Post: 10-06-2008, 01:43 PM
  4. change email password via script
    By Lyttek in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 03-17-2006, 12:05 PM
  5. script to change password
    By mikerobinson in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 08-03-2004, 10:03 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube