Remote password change script problem... need help!

sllik

Member
May 9, 2005
21
0
151
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?
 
Last edited:

sllik

Member
May 9, 2005
21
0
151
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...
 

sllik

Member
May 9, 2005
21
0
151
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?
 

ymfm

Active Member
Feb 21, 2003
38
0
156
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