Author Topic: CWP7.php and WHMCS 7 Change Package not working  (Read 568 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
CWP7.php and WHMCS 7 Change Package not working
« on: March 21, 2018, 12:14:38 PM »
Is the ability to change the customers hosting package from within WHMCS supposed to work? I can add clients, suspend, delete and do almost everything other then change the clients package from WHMCS. Looking in the CWP7.PHP file I can see where change package is in there but I dont see any commands. Anyone else got this to work? I just get a command not found in the module que.

function cwp7_ChangePackage($params){

}

Offline
*
Re: CWP7.php and WHMCS 7 Change Package not working
« Reply #1 on: March 22, 2018, 07:05:01 AM »
Something like this should work

Code: [Select]
function cwp7_ChangePackage($params){
    $postvars = array('key' => $params["serveraccesshash"],'acction' => 'udp','user' => $params["username"], 'package' =>$params["configoption1"]);
    $postdata = http_build_query($postvars);
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, 'https://'. $params["serverhostname"] . ':2304/v1/account');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
    $answer = curl_exec($curl);
    logModuleCall('cwpwhmcs','cwp7_ChangePackage','https://' . $params["serverhostname"] . ':2304/v1/account'.$postdata,$answer);
}

Offline
*
Re: CWP7.php and WHMCS 7 Change Package not working
« Reply #2 on: April 19, 2018, 02:04:45 PM »
Also this part should be changed:
Code: [Select]
function cwp7_AdminLink($params) {
    // $code = '<form action="http://'.$params["serverhostname"].':2030/login.php" method="post" target="_blank">
$code = '<form action="http://'.$params["serverhostname"].':2030/login/index.php" method="post" target="_blank">
        <input type="hidden" name="user" value="'.$params["serverusername"].'" />
        <input type="hidden" name="password" value="'.$params["serverpassword"].'" />
        <input type="submit" value="Login to Control Panel" />
        </form>';
    return $code;
}
Code: [Select]
function cwp7_SuspendAccount($params) {
    if ($params["server"] == 1) {
        $postvars = array('key' => $params["serveraccesshash"],'action' => 'susp','user' => $params["username"]);
        $postdata = http_build_query($postvars);
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, 'https://' . $params["serverhostname"] . ':2304/v1/account');
        curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
        $answer = curl_exec($curl);
        [b]logModuleCall('cwpwhmcs','SuspendAccount','https://' . $params["serverhostname"] . ':2304/v1/account/'.$postdata,$answer);[/b]
    }
« Last Edit: April 19, 2018, 02:07:40 PM by xotabu4 »