Change CPanel/MySQL password for user at the same time

monks

Registered
Dec 30, 2005
2
0
151
This is my first post.

I´ve done som searching and couldn´t find what i was looking for.
Currently I´v got at php page in my customers cpanel that let them change their cpanel password. The php page does that with this function:

PHP:
function changepass ($host,$user,$accesshash,$usessl,$acctpass,$acctuser) {
    $result = whmreq("/scripts/passwd?remote=1&nohtml=1&password=${acctpass}&domain=${acctuser}&user=${acctuser}&submit-domain=Change%0D%0A++++++Password",$host,$user,$accesshash,$usessl);
    if ($cpanelaccterr != "") { return; }
    return $result;
}
The reaseon I don´t want them to change their password via the original cpanel password page is that I want to update another DB thats located on another server with some information whenever a user change the password.

I don´t want the user to be able to create or delete their databases och db-user so before I give a user their login/pass i set this up.

eg.
cpanel username: tester
cpanel password: whatever

mysql db: tester_tester
mysql user: tester_tester
mysql password: whatever

so here comes my question.
Is it possible to change the password for the mysqluser with a script like the one to change the cpanel password, so whenever a user change their cpanel password the mysql password also changes to the new password.