DraGoNeTi Posted March 17, 2018 Share Posted March 17, 2018 Hello, i am trying to figure how to add a product and the server in whmcs. i added the server as i know and working great, but i have an issue with the products. how can i configure them to work properly for internal accounts? what should i set to the module/product so that it can work properly ? it makes the radio account but with no name... (i 've added the custom field) and i don't want to use external radio accounts Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 17, 2018 Author Share Posted March 17, 2018 Ah don't mind this topic... ! I even don't understand what i have asked, lol ! Well let's get things straight.... As i searched in this community and on the internet, i found that the WHMCS module for whmsonic is outdated. So i found from whmsonic a module for v1.9 and tested it on php5.6 and working great. the thing is that i want to switch with php-fpm to php7.0 and the module crashes because it was encoded for php5.6 . can someone help me or point me somewhere that i can fix this ? whmcs_whmsonicv1.9.zip Link to comment Share on other sites More sharing options...
brian! Posted March 18, 2018 Share Posted March 18, 2018 have you tried asking WHMSonic ? there's an unencoded version of v1.9 for download on their site, perhaps that will work. http://help.sonicpanel.com/index.php/article/whmcs-module-v1 1 Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 18, 2018 Author Share Posted March 18, 2018 Yes I tried it. It's the file I attached. The point is that I want to use php7.0 and the file is for php5.6 I will try to ask whmsonic for info... thanks for pointing it out Link to comment Share on other sites More sharing options...
brian! Posted March 18, 2018 Share Posted March 18, 2018 11 hours ago, DraGoNeTi said: Yes I tried it. It's the file I attached. The point is that I want to use php7.0 and the file is for php5.6 I couldn't tell - I can't download your attachment. I assume the full v7.5 release will have an encoded version for PHP7+ because there is one in the RC1 beta. Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 19, 2018 Author Share Posted March 19, 2018 well, the file i attached is the one i found in the whmsonic site, v1.9 but "it is encoded for php5.6".... i want the module v1.9 to use with php7.0. i already have started a ticket with whmsonic and still waiting an answer. i assume there is someone who checks the tickets and will respond .. ! until then, as you say, the bet version whmcs 7.5, does it have the module i want or the v2.2 ? Link to comment Share on other sites More sharing options...
brian! Posted March 19, 2018 Share Posted March 19, 2018 10 hours ago, DraGoNeTi said: does it have the module i want or the v2.2 ? I don't know - it's encoded. 1 Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 19, 2018 Author Share Posted March 19, 2018 well, i downloaded the beta version and the module is the same... i just wanted the whmsonic module version1.9 encoded for use in php7.0 Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted March 20, 2018 Share Posted March 20, 2018 @DraGoNeTi Thats something you'll need to reach out to WHMSonIc Module developer about. 1 Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 20, 2018 Author Share Posted March 20, 2018 ok they responded at whmsonic with a module attached to my ticket. i am going to test it and see if it fits my criteria ! Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted March 24, 2018 Share Posted March 24, 2018 @DraGoNeTi Did they provide you with a working module? Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 24, 2018 Author Share Posted March 24, 2018 Yes they did. I will upload it here later in the day. Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 25, 2018 Author Share Posted March 25, 2018 This is the file that WHMSonic suport gave me for my needs... ! whmsonic.zip 1 Link to comment Share on other sites More sharing options...
brian! Posted March 26, 2018 Share Posted March 26, 2018 15 hours ago, DraGoNeTi said: This is the file that WHMSonic suport gave me for my needs... ! I don't seem able to download that attachment... Quote Sorry, there is a problem The page you are trying to access is not available for your account. Error code: 2C171/1 Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 26, 2018 Author Share Posted March 26, 2018 <?php function whmsonic_ConfigOptions($params) { // Since params are not assigned to ConfigOptions from WHMCS this is a temporary solution until params are assigned. $sqlsonic = "SELECT * FROM tblservers WHERE type='whmsonic'"; $resultsonic = mysql_query($sqlsonic); while($row=mysql_fetch_array($resultsonic)){ $server_ip = $row[ipaddress]; $server_p = $row[password]; $serveruser = $row[username]; } $server_p = decrypt($server_p); $auth = "$serveruser:$server_p"; // Since params are not assigned to ConfigOptions from WHMCS this is a temporary solution until params are assigned. $url = "https://$server_ip:2087/whmsonic/modules/api2.php?"; $data = "cmd=packs&owner=$serveruser"; $ch = curl_init(); curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, $auth); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 59); curl_setopt($ch, CURLOPT_URL, $url); $retval = curl_exec($ch); curl_close($ch); if (strpos($retval,"Login Attempt Failed!") == true) {$result = "Unable to connect to the server. Check your root password in WHMCS server settings."; } else { $result = "$retval"; } $configarraysonic = array( "Client Type" => array( "Type" => "dropdown", "Options" => "External,internal","Description" => "If Internal, create a custom field with 'cpanel username' field name without ' '"), "" => array( "Type" => ""), // To make the options appear better. "Radio Account Packages" => array( "Type" => "dropdown", "Options" => "$result","Description" => "Create packages in WHMSonic root to use here."), ); return $configarraysonic; } function whmsonic_CreateAccount($params) { // Get The Package Information $stype = $params["configoption1"]; $radioip = $params["serverip"]; $package = $params["configoption3"]; // Get The General Information $serverp = $params["serverpassword"]; // Target Server root password $serveruser = $params["serverusername"]; $auth = "$serveruser:$serverp"; $orderid = $params["serviceid"]; // Get The Client Information $client_email = $params["clientsdetails"]["email"]; $client_name = $params["clientsdetails"]["firstname"]; if ($params["configoption1"]=="internal") { $radiousername = $params["customfields"]["cpanel username"]; } else { // External user, create a custom WHMSonic username & password. $chars = "abcdefghijkmnpqrstuvwxyz123456789"; srand((double)microtime()*1000000); $i = 0; $exu = '' ; while ($i <= 4) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $exu = $exu . $tmp; $i++;} $radiousername = "sc_$exu";} $chars2 = "ABCDEFGHJKMNPQRSTUVWXYZ23456789"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 20) { $num = rand() % 45; $tmp = substr($chars2, $num, 1); $pass = $pass . $tmp; $i++; } $url = "https://$radioip:2087/whmsonic/modules/api2.php?"; $data = "cmd=setup&stype=$stype&ip=$radioip&cemail=$client_email&rad_username=$radiousername&c_pass=$pass&owner=$serveruser&package=$package&esend=yes"; $ch = curl_init(); curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, $auth); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 59); curl_setopt($ch, CURLOPT_URL, $url); $retval = curl_exec($ch); if (curl_errno($ch)) { $retval = "CURL Error: ".curl_errno($ch)." - ".curl_error($ch)." - Unable to connect, check serverIP in WHMCS servers setting of WHMSonic."; } curl_close($ch); if ($retval=="Complete") { // Update WHMCS db for the username, required for other actions. $hostpass = encrypt($pass); mysql_query("UPDATE tblhosting SET username='$radiousername', password='$hostpass' WHERE id='".$params["accountid"]."'"); // Update WHMCS db for the username, required for other actions. $result = "success"; } else { if (strpos($retval,"Login Attempt Failed!") == true) {$result = "WHMSonic server($radioip) WHM login failed! The username or password is incorrect. Please check your WHMSonic server/connection settings in WHMCS servers settings of WHMSonic."; } else { $result = "$retval"; }} return $result; } function whmsonic_TerminateAccount($params) { // Details $radioip = $params["serverip"]; $rad_username= $params["username"]; $serverp = $params["serverpassword"]; $serveruser = $params["serverusername"]; $auth = "$serveruser:$serverp"; $url = "https://$radioip:2087/whmsonic/modules/api2.php?"; $data = "cmd=terminate&rad_username=$rad_username"; $ch = curl_init(); curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, $auth); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 59); curl_setopt($ch, CURLOPT_URL, $url); $retval = curl_exec($ch); if (curl_errno($ch)) { $retval = "CURL Error: ".curl_errno($ch)." - ".curl_error($ch); } curl_close($ch); if ($retval=="Complete") { $result = "success"; } else { $result = "<br>$retval"; } return $result; } function whmsonic_SuspendAccount($params) { // Details $radioip = $params["serverip"]; $rad_username= $params["username"]; $serverp = $params["serverpassword"]; $serveruser = $params["serverusername"]; $auth = "$serveruser:$serverp"; $url = "https://$radioip:2087/whmsonic/modules/api2.php?"; $data = "cmd=suspend&rad_username=$rad_username"; $ch = curl_init(); curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, $auth); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 59); curl_setopt($ch, CURLOPT_URL, $url); $retval = curl_exec($ch); if (curl_errno($ch)) { $retval = "CURL Error: ".curl_errno($ch)." - ".curl_error($ch); } curl_close($ch); if ($retval=="Complete") { $result = "success"; } else { $result = "<br>$retval"; } return $result; } function whmsonic_UnsuspendAccount($params) { // Details $radioip = $params["serverip"]; $rad_username= $params["username"]; $serverp = $params["serverpassword"]; // Target Server root password $serveruser = $params["serverusername"]; $auth = "$serveruser:$serverp"; $url = "https://$radioip:2087/whmsonic/modules/api2.php?"; $data = "cmd=unsuspend&rad_username=$rad_username"; $ch = curl_init(); curl_setopt($ch, CURLAUTH_BASIC, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, $auth); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 59); curl_setopt($ch, CURLOPT_URL, $url); $retval = curl_exec($ch); if (curl_errno($ch)) { $retval = "CURL Error: ".curl_errno($ch)." - ".curl_error($ch); } curl_close($ch); if ($retval=="Complete") { $result = "success"; } else { $result = "<br>$retval"; } return $result; } function whmsonic_ClientArea($params) { $connection = $params["serverip"]; $code = "<form action=http://$connection/cpanel/ method=post target=_blank><input type=hidden name=ip value=$licenseip><input type=submit value=\"WHMSonic Login\"></form>"; return $code; } function whmsonic_AdminLink($params) { $connection = $params["serverip"]; $code = "<form action=https://$connection:2087/whmsonic/main.php method=post target=_blank><input type=hidden name=username value=\"".$params["serverusername"]."\"><input type=hidden name=password value=\"".$params["serverpassword"]."\"><input type=submit value=\"WHMSonic Root\"></form>"; return $code; } ?> Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted March 26, 2018 Share Posted March 26, 2018 @brian! Can you try now? Link to comment Share on other sites More sharing options...
DraGoNeTi Posted March 26, 2018 Author Share Posted March 26, 2018 (edited) For me the module works. Edited March 26, 2018 by DraGoNeTi Link to comment Share on other sites More sharing options...
brian! Posted March 27, 2018 Share Posted March 27, 2018 13 hours ago, WHMCS ChrisD said: @brian! Can you try now? all fixed. Link to comment Share on other sites More sharing options...
Recommended Posts