I have tried everything but nothing works!
My Cpanel URL : https://box971.bluehost.com:2083/cpsess266199684/frontend/bluehost/index.html?post_login=95687211713545
I'am using the new cpanel.php driver <?php
/**
* cPanel Password Driver
*
* Driver that adds functionality to change the users cPanel password.
* The cPanel PHP API code has been taken from: http://www.phpclasses.org/browse/package/3534.html
*
* This driver has been tested with Hostmonster hosting and seems to work fine.
*
* @version 1.0
* @author Fulvio Venturelli <fulvio@venturelli.org>
*/
class HTTP
{
function HTTP($host, $username, $password, $port, $ssl, $theme)
{
$this->ssl = $ssl ? 'ssl://' : '';
$this->username = $username;
$this->password = $password;
$this->theme = $theme;
$this->auth = base64_encode($username . ':' . $password);
$this->port = $port;
$this->host = $host;
$this->path = '/webmail/' . $theme . '/';
}
function getData($url, $data = '')
{
$url = $this->path . $url;
if(is_array($data))
{
$url = $url . '?';
foreach($data as $key=>$value)
{
$dataurl .= urlencode($key) . '=' . urlencode($value) . '&';
}
$dataurl = substr($dataurl, 0, -1);
}
$response = '';
$fp = fsockopen($this->ssl . $this->host, $this->port);
if(!$fp)
{
return false;
}
$out = "POST " . $url . " HTTP/1.1\r\n";
$out .= 'Authorization: Basic ' . $this->auth . "\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Content-Length: ".strlen($dataurl)."\r\n";
$out .= "Connection: close\r\n\r\n";
$out .= $dataurl;
fwrite($fp, $out);
while (!feof($fp))
{
$response .= @fgets($fp);
}
fclose($fp);
return $response;
}
}
class emailAccount
{
function emailAccount($host, $port, $ssl, $theme, $address, $curpass)
{
if(strpos($address, '@'))
{
list($this->email, $this->domain) = explode('@', $address);
}
else
{
list($this->email, $this->domain) = array($address, '');
}
$this->HTTP = new HTTP($host, $address, $curpass, $port, $ssl, $theme);
}
/*
* Change email account password
*
* Returns true on success or false on failure.
* @param string $password email account password
* @return bool
*/
function setPassword($password)
{
$data['email'] = $this->email;
$data['domain'] = $this->domain;
$data['password'] = $password;
$data['password2'] = $password;
$response = $this->HTTP->getData('mail/dopasswdpop.html', $data);
if(strpos($response, 'success') && !strpos($response, 'failure'))
{
return true;
}
return false;
}
}
function password_save($curpas, $newpass)
{
$rcmail = rcmail::get_instance();
// Create a cPanel email object
$cPanel = new emailAccount($rcmail->config->get('password_cpanel_host'),
$rcmail->config->get('password_cpanel_port'),
$rcmail->config->get('password_cpanel_ssl'),
$rcmail->config->get('password_cpanel_theme'),
$_SESSION['username'],
$rcmail->decrypt($_SESSION['password']));
if ($cPanel->setPassword($newpass)){
return PASSWORD_SUCCESS;
}
else
{
return PASSWORD_ERROR;
}
}
?>
My Config.inc.php settings : // Password Plugin options
// -----------------------
// A driver to use for password change. Default: "sql".
// See README file for list of supported driver names.
$rcmail_config['password_driver'] = 'cpanel';
// Determine whether current password is required to change password.
// Default: false.
$rcmail_config['password_confirm_current'] = false;
// Require the new password to be a certain length.
// set to blank to allow passwords of any length
$rcmail_config['password_minimum_length'] = 0;
// Require the new password to contain a letter and punctuation character
// Change to false to remove this check.
$rcmail_config['password_require_nonalpha'] = false;
// Enables logging of password changes into logs/password
$rcmail_config['password_log'] = false;
// Comma-separated list of login exceptions for which password change
// will be not available (no Password tab in Settings)
$rcmail_config['password_login_exceptions'] = null;
// Array of hosts that support password changing. Default is NULL.
// Listed hosts will feature a Password option in Settings; others will not.
// Example:
//$rcmail_config['password_hosts'] = array('mail.example.com', 'mail2.example.org');
$rcmail_config['password_hosts'] = null;
// cPanel Driver options
// --------------------------
// The cPanel Host name
$rcmail_config['password_cpanel_host'] = 'box971.bluehost.com';
// The cPanel admin username
$rcmail_config['password_cpanel_username'] = 'mywebsite.com.br';
// The cPanel admin password
$rcmail_config['password_cpanel_password'] = 'mypassword';
// The cPanel port to use
$rcmail_config['password_cpanel_port'] = 2083;
// Using ssl for cPanel connections?
$rcmail_config['password_cpanel_ssl'] = true;
// The cPanel theme in use
$rcmail_config['password_cpanel_theme'] = 'bluehost';