Control Web Panel
WebPanel => CentOS 7 Problems => Topic started by: nkolet 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){
}
-
Something like this should work
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);
}
-
Also this part should be changed:
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;
}
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]
}