daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Sep 24th, 2016 30 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //ini_set('error_reporting', E_ALL);
  3. //ini_set('display_errors', '1');
  4. /**
  5.  * Change any type of server password.
  6.  *
  7.  * @param array $aConfig WHMCS configuration values.
  8.  *
  9.  * @return string
  10.  */
  11. if (!defined('FULL_DIRECTORY_HOSTDZ'))
  12.     define("FULL_DIRECTORY_HOSTDZ", "/home/zmrk2md30edvm/public_html");
  13. /*
  14. function rdpmodule_ChangePassword($params)
  15. {
  16.     require_once(FULL_DIRECTORY_HOSTDZ.'/modules/DediApi/Net/SSH2.php');/*
  17.     $serviceid = $params['serviceid'];
  18.     $serverip = $params['serverip'];
  19.     $serverhostname = $params['serverhostname'];
  20.     $serverusername = $params['serverusername'];
  21.     $serverpassword = $params['serverpassword'];* /
  22.     $ssasfasfh = new Net_SSH2("{$params["serverip"]}");
  23.     if (!$ssasfasfh->login("{$params["serverusername"]}", "{$params["serverpassword"]}")){
  24.         return "Login Failed, please check root login data. IP: ".$params["serverip"];
  25.     }else{
  26.         $ssasfasfh->exec("changeUserPassword {$params["customfields"]["Username"]} {$params["customfields"]["Password"]} rutorrent > /dev/null 2>&1 &");
  27.         update_query("tblhosting", array("password" => encrypt($params["customfields"]["Password"])), array("id" => $params['serviceid']));
  28.         //update_query("tblcustomfieldsvalues", array("value" => ""), array("relid" => $params['serviceid'], "value" => $params["customfields"]["Password"]));
  29.         return "successss";
  30.     }
  31. }//end rdpmodule_ChangePassword()
  32. */
  33. /*
  34. function rdpmodule_AdminCustomButtonArray() {
  35.     $buttonarray = array("Delete SeedBox User" => "DeleteSeedBoxUser","Change Password" => "ChangePw", "Restart" => "restartclient", "Irssi reinstall(v1.53)" => "irssireinstall", "Irssi tracker reinstall(v2.51)" => "irssitrackerreinstall", "Suspend SeedBox User -- BETA" => "SuspendSeedBoxUser",);
  36.     return $buttonarray;
  37. }/*
  38. function rdpmodule_AdminCustomButtonArray() {
  39.     $buttonarray = array("restart rtorrent" => "restartclient","restart client" => "ChangePw");
  40.     return $buttonarray;
  41. }* /
  42.  
  43. function rdpmodule_irssitrackerreinstall($params) {
  44.     require_once(FULL_DIRECTORY_HOSTDZ.'/modules/DediApi/Net/SSH2.php');
  45.     $ssasfasfh = new Net_SSH2("{$params["serverip"]}");
  46.     if (!$ssasfasfh->login("{$params["serverusername"]}", "{$params["serverpassword"]}")){
  47.         return "Login Failed, please check root login data. IP: ".$params["serverip"];
  48.     }else{
  49.         $ssasfasfh->exec("wget -N https://raw.githubusercontent.com/fjdhgjaf/hostdz/2b74f52cc13b09be36c58c0a92ee50afaadfe1f5/UserIrssiTrackerReinstall > /dev/null 2>&1 &");
  50.         sleep(2);
  51.         $ssasfasfh->exec("bash UserIrssiTrackerReinstall {$params["customfields"]["Username"]} > /dev/null 2>&1 &");
  52.         return "success";
  53.     }
  54. }
  55. function rdpmodule_SuspendSeedBoxUser($params) {//suspendseedbox
  56.     require_once(FULL_DIRECTORY_HOSTDZ.'/modules/DediApi/Net/SSH2.php');
  57.     $ssasfasfh = new Net_SSH2("{$params["serverip"]}");
  58.     if (!$ssasfasfh->login("{$params["serverusername"]}", "{$params["serverpassword"]}")){
  59.         return "Login Failed, please check root login data. IP: ".$params["serverip"];
  60.     }else{
  61.         $ssasfasfh->exec("changeUserPassword {$params["customfields"]["Username"]} 124suspendPassworda45sf rutorrent > /dev/null 2>&1 &");
  62.         $ssasfasfh->exec("sudo pkill -9 -u {$params["customfields"]["Username"]} > /dev/null 2>&1 &");
  63.         update_query("tblhosting", array("suspendseedbox" => 'yes'), array("id" => $params['serviceid']));
  64.         return "success";
  65.     }
  66. }
  67. function rdpmodule_AdminServicesTabFields($params) {
  68.     if (empty($params["customfields"]["Username"])){
  69.         return(array("<span style='font-weight:bold;color:red;'>User deleted.</span>" => "<span style='font-weight:bold;color:red;font-size:14pt;'>User deleted.</span>"));
  70.     }else{
  71.     $fieldsarray = array(
  72.      "<span style='font-weight:bold;'>SSH information</span>" => "<span style='font-weight:bold;'>Username:&nbsp;&nbsp;</span><span style='color:green;font-style:italic;'>{$params["serverusername"]}</span> <br/>
  73.      <span style='font-weight:bold;'>Password:&nbsp;&nbsp;</span><span style='color:red;font-style:italic;'>{$params["serverpassword"]}</span> ",
  74.      "<span style='font-weight:bold;'>Server information</span>" => "<span id='cpudataetc'><span style='font-weight:bold;'>CPU usage:&nbsp;&nbsp;</span><span style='color:green;font-style:italic;'>{$params[""]}</span> <br/>
  75.      <span style='font-weight:bold;'>Swap usage:&nbsp;&nbsp;</span><span style='color:red;font-style:italic;'>{$params[""]}</span><br/>
  76.      <span style='font-weight:bold;'>HDD usage(/home):&nbsp;&nbsp;</span><span style='color:red;font-style:italic;'>{$params[""]}</span><br/>
  77.      <span style='font-weight:bold;'>HDD usage(/root):&nbsp;&nbsp;</span><span style='color:red;font-style:italic;'>{$params[""]}</span></span>",
  78.      "<span style='color:#46b8da;font-weight:bold;'>Apps information</span>" => "<span style='font-weight:bold;'>Webmin installed:</span> <span style='color:green;font-style:italic;'>Yes</span> &nbsp;&nbsp;||&nbsp;&nbsp;
  79.      <a href='http://{$params["customfields"]["Username"]}:{$params["customfields"]["Password"]}@{$params["serverip"]}:10000' target='_blank'><span style='color:red;font-weight:bold;'>Login HTTP</span></a>
  80.         &nbsp;&nbsp;&nbsp; - &nbsp;&nbsp;&nbsp;
  81.      <a href='https://{$params["customfields"]["Username"]}:{$params["customfields"]["Password"]}@{$params["serverip"]}:10000' target='_blank'><span style='color:green;font-weight:bold;'>Login SSL</span></a><br/>
  82.      <span style='font-weight:bold;'>ruTorrent installed:</span> <span style='color:green;font-style:italic;'>Yes</span> &nbsp;&nbsp;||&nbsp;&nbsp;
  83.      <a href='http://{$params["customfields"]["Username"]}:{$params["customfields"]["Password"]}@{$params["serverip"]}/rutorrent' target='_blank'><span style='color:red;font-weight:bold;'>Login HTTP</span></a>
  84.         &nbsp;&nbsp;&nbsp; - &nbsp;&nbsp;&nbsp;
  85.      <a href='https://{$params["customfields"]["Username"]}:{$params["customfields"]["Password"]}@{$params["serverip"]}/rutorrent' target='_blank'><span style='color:green;font-weight:bold;'>Login SSL</span></a><br/>
  86.          <span style='font-weight:bold;'>HTTP Access:</span> <span style='color:green;font-style:italic;'>Yes</span> &nbsp;&nbsp;||&nbsp;&nbsp;
  87.          <a href='http://{$params["customfields"]["Username"]}:{$params["customfields"]["Password"]}@{$params["serverip"]}/rutorrent/downloads/' target='_blank'><span style='color:red;font-weight:bold;'>Login HTTP</span></a>&nbsp;&nbsp;&nbsp; - &nbsp;&nbsp;&nbsp;
  88.      <a href='https://{$params["customfields"]["Username"]}:{$params["customfields"]["Password"]}@{$params["serverip"]}/rutorrent/downloads/' target='_blank'><span style='color:green;font-weight:bold;'>Login SSL</span></a> <br>",
  89.      "<span style='font-weight:bold;'>HDD usage</span>" =>
  90.      '
  91. <style>
  92. .progress-bar {
  93.   float: left;
  94.   width: 0%;
  95.   max-width: 150px;
  96.   border: none;
  97.   border-radius: 4px;
  98.   height: 16px;
  99.   display: block;
  100.   font-size: 12px;
  101.   line-height: 20px;
  102.   color: #fff;
  103.   text-align: center;
  104.   background-color: #428bca;
  105.   -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
  106.   box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
  107.   -webkit-transition: width 2s;
  108.   -webkit-transition-timing-function: ease;
  109.   transition: width 2s;
  110.   transition-timing-function: ease;
  111. }
  112. #progressbar {
  113.   overflow: hidden;
  114.   height: 30px;
  115.   margin-top: 5px;
  116.   margin-bottom: 5px;
  117.   margin-left: 4px;
  118.   width: 98%;
  119.   background-color: #f5f5f5;
  120.   border-radius: 4px;
  121.   -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
  122.   box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
  123.   -webkit-transition: width .6s ease;
  124.   -moz-transition: width .6s ease;
  125.   -o-transition: width .6s ease;
  126. }
  127. </style>
  128. <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
  129. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.css">
  130. <script type="text/javascript">
  131. /*
  132.     $(document).ready(function(){
  133.         swal({
  134.             title: "Sweet!",
  135.             confirmButtonColor: "#DD6B55",
  136.             confirmButtonText: "Yes, delete it!",
  137.             text: "Heres a custom image."
  138.         });
  139.     });* /
  140.  
  141.      function HostdzDedicatedServerdataCPUetc(){
  142.         $("#cpudataetc").html("<img src=\"/billing/modules/DediApi/ajax-loader-mini.gif\"/>");
  143.         $.post("//hostdzire.com/billing/modules/servers/rdpmodule/api.php",{
  144.             c1 : "'.encrypt($params['serverip']).'",
  145.             c2 : "'.encrypt($params["customfields"]["Username"]).'",
  146.             doit : "ServerDataCPUetc"
  147.         }, function(dz) {
  148.             $("#cpudataetc").html(dz);
  149.         });
  150.     }
  151.     $(document).ready(function(){
  152.         HostdzDedicatedServerdataCPUetc();
  153.         setInterval("HostdzDedicatedServerdataCPUetc();", 1000*800);
  154.     });
  155.    
  156.      function HostdzDedicatedServerdata(){
  157.         $("#freehdd").html("<img src=\"/billing/modules/DediApi/ajax-loader-mini.gif\"/>");
  158.         $("#fullhdd").html("<img src=\"/billing/modules/DediApi/ajax-loader-mini.gif\"/>");
  159.         $("#usagehdd").html("<img src=\"/billing/modules/DediApi/ajax-loader-mini.gif\"/>");
  160.         $("#percenthdd").html("<img src=\"/billing/modules/DediApi/ajax-loader-mini.gif\"/>");
  161.         $.post("//hostdzire.com/billing/modules/servers/rdpmodule/api.php",{
  162.             c1 : "'.encrypt($params['serverip']).'",
  163.             c2 : "'.encrypt($params["customfields"]["Username"]).'",
  164.             c3 : "'.encrypt($params["customfields"]["Password"]).'",
  165.             doit : "serverdata"
  166.         }, function(dz) {
  167.             var adat = dz.split("=||=");
  168.             $("#percenthdd1").css("background",adat[0]);
  169.             $("#percenthdd1").css("width",adat[0]+"%");
  170.             $("#usagehdd").html(adat[1]);
  171.             $("#percenthdd").html(adat[0]+" %");
  172.             $("#freehdd").html(adat[2]);
  173.             $("#fullhdd").html(adat[3]);
  174.         });
  175.     }
  176.     $(document).ready(function(){
  177.         HostdzDedicatedServerdata();
  178.         setInterval("HostdzDedicatedServerdata();", 1000*800);
  179.     });
  180.     </script>
  181.         <table class="table  table-bordered table-condensed">
  182.             <tr style="background: #dddddd;">
  183.                 <td style="text-align:center;font-size:13pt;" colspan="3">
  184.                     HDD usage
  185.                 </td>
  186.             </tr>
  187.             <tr>
  188.                 <td>
  189.                     Limit: <span id="fullhdd"></span>
  190.                 </td>
  191.                 <td>
  192.                     Free: <span id="freehdd"></span>
  193.                 </td>
  194.                 <td>
  195.                     Usage:<span id="usagehdd"></span>
  196.                 </td>
  197.             </tr>
  198.             <tr>
  199.                 <td colspan="3">
  200.                     <div id="progressbar">
  201.                         <div id="percenthdd1" class="progress-bar" style="width:0%;height:30px;max-width:100%;">
  202.                             <div style="min-width:100%;text-align:center;border:none;height:30px;font-size:11pt;color:#000;padding-top:7px;font-weight:normal;">
  203.                                 <span id="percenthdd"></span>
  204.                             </div>
  205.                         </div>
  206.                     </div>
  207.                 </td>
  208.             </tr>
  209.         </table>
  210.     ',
  211.     );
  212.     return $fieldsarray;
  213.     }
  214. }
  215. function rdpmodule_AdminServicesTabFieldsSave($params) {
  216.     update_query("mod_customtable",array(
  217.         "var1"=>$_POST['modulefields'][0],
  218.         "var2"=>$_POST['modulefields'][1],
  219.         "var3"=>$_POST['modulefields'][2],
  220.     ),array("serviceid"=>$params['serviceid']));
  221. }
  222. function rdpmodule_irssireinstall($params) {
  223.     require_once(FULL_DIRECTORY_HOSTDZ.'/modules/DediApi/Net/SSH2.php');
  224.     $ssasfasfh = new Net_SSH2("{$params["serverip"]}");
  225.     if (!$ssasfasfh->login("{$params["serverusername"]}", "{$params["serverpassword"]}")){
  226.         return "Login Failed, please check root login data. IP: ".$params["serverip"];
  227.     }else{
  228.         $ssasfasfh->exec("wget -N https://raw.githubusercontent.com/fjdhgjaf/hostdz/2b74f52cc13b09be36c58c0a92ee50afaadfe1f5/UserIrssiReinstall > /dev/null 2>&1 &");
  229.         sleep(2);
  230.         $ssasfasfh->exec("bash UserIrssiReinstall {$params["customfields"]["Username"]} > /dev/null 2>&1 &");
  231.         return "success";
  232.     }
  233. }
  234. function rdpmodule_ChangePw($params) {
  235.     require_once(FULL_DIRECTORY_HOSTDZ.'/modules/DediApi/Net/SSH2.php');/*
  236.     $serviceid = $params['serviceid'];
  237.     $serverip = $params['serverip'];
  238.     $serverhostname = $params['serverhostname'];
  239.     $serverusername = $params['serverusername'];
  240.     $serverpassword = $params['serverpassword'];* /
  241.     $ssasfasfh = new Net_SSH2("{$params["serverip"]}");
  242.     if (!$ssasfasfh->login("{$params["serverusername"]}", "{$params["serverpassword"]}")){
  243.         return "Login Failed, please check root login data. IP: ".$params["serverip"];
  244.     }else{
  245.         $ssasfasfh->exec("changeUserPassword {$params["customfields"]["Username"]} {$params["customfields"]["Password"]} rutorrent > /dev/null 2>&1 &");
  246.         update_query("tblhosting", array("password" => encrypt($params["customfields"]["Password"])), array("id" => $params['serviceid']));
  247.         //update_query("tblcustomfieldsvalues", array("value" => ""), array("relid" => $params['serviceid'], "value" => $params["customfields"]["Password"]));
  248.         return "success";
  249.     }
  250. }
  251. function rdpmodule_DeleteSeedBoxUser($params) {/*
  252.     require_once(FULL_DIRECTORY_HOSTDZ.'/modules/DediApi/Net/SSH2.php');
  253.     $ssasfasfh = new Net_SSH2("{$params["serverip"]}");
  254.     if (!$ssasfasfh->login("{$params["serverusername"]}", "{$params["serverpassword"]}")){
  255.         return "Login Failed, please check root login data. IP: ".$params["serverip"];
  256.     }else{
  257.         $ssasfasfh->exec("deleteSeedboxUser {$params["customfields"]["Username"]} > /dev/null 2>&1 &");
  258.         update_query("tblhosting", array("password" => encrypt(""), "username" => ""), array("id" => $params['serviceid']));
  259.         update_query("tblcustomfieldsvalues", array("value" => ""), array("relid" => $params['serviceid'], "value" => $params["customfields"]["Username"]));
  260.         update_query("tblcustomfieldsvalues", array("value" => ""), array("relid" => $params['serviceid'], "value" => $params["customfields"]["Password"]));
  261.         return "success";
  262.     }* /
  263.     //?ApiKey=md5($_POST["username"]."=|fhtorles|=".$_POST["server"]."=|fhtorles|=")
  264.  
  265.         $data = "doit=fhtorles&ApiKey=".md5($params["customfields"]["Username"]."=|fhtorles|=".$params["serverip"]."=|fhtorles|=")."&server={$params["serverip"]}&username={$params["customfields"]["Username"]}";
  266.         $handle = curl_init();
  267.         curl_setopt($handle, CURLOPT_URL, "https://api.bestbox.be/hostdz");
  268.         curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
  269.         curl_setopt($handle, CURLOPT_TIMEOUT, 10);
  270.         curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 0);
  271.         curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);
  272.         curl_setopt($handle, CURLOPT_POST, 1);
  273.         curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
  274.         $Return = curl_exec($handle);
  275.  
  276.         curl_close($handle);
  277.         if (curl_errno($handle))
  278.             return "CURL Error: " . curl_errno($handle) . " - " . curl_error($handle);
  279.         //return $Return;
  280.        
  281.         update_query("tblhosting", array("password" => encrypt(""), "username" => ""), array("id" => $params['serviceid']));
  282.         update_query("tblcustomfieldsvalues", array("value" => ""), array("relid" => $params['serviceid'], "value" => $params["customfields"]["Username"]));
  283.         update_query("tblcustomfieldsvalues", array("value" => ""), array("relid" => $params['serviceid'], "value" => $params["customfields"]["Password"]));
  284.        
  285.         return "success";
  286.  
  287.     //return $params["serverip"];
  288. }
  289.  
  290. function rdpmodule_restartclient($params) {/*
  291.     require_once(FULL_DIRECTORY_HOSTDZ.'/modules/DediApi/Net/SSH2.php');
  292.     $ssasfasfh = new Net_SSH2("{$params["serverip"]}");
  293.     if (!$ssasfasfh->login("{$params["serverusername"]}", "{$params["serverpassword"]}")){
  294.         return "Login Failed, please check root login data. IP: ".$params["serverip"];
  295.     }else{
  296.         $ssasfasfh->exec("deleteSeedboxUser {$params["customfields"]["Username"]} > /dev/null 2>&1 &");
  297.         update_query("tblhosting", array("password" => encrypt(""), "username" => ""), array("id" => $params['serviceid']));
  298.         update_query("tblcustomfieldsvalues", array("value" => ""), array("relid" => $params['serviceid'], "value" => $params["customfields"]["Username"]));
  299.         update_query("tblcustomfieldsvalues", array("value" => ""), array("relid" => $params['serviceid'], "value" => $params["customfields"]["Password"]));
  300.         return "success";
  301.     }* /
  302.     //?ApiKey=md5($_POST["username"]."=|fhtorles|=".$_POST["server"]."=|fhtorles|=")
  303.  
  304.         $data = "doit=fhrestart&ApiKey=".md5($params["customfields"]["Username"]."=|restart|=".$params["serverip"]."=|restart|=fhrestart")."&server={$params["serverip"]}&username={$params["customfields"]["Username"]}";      $handle = curl_init();      curl_setopt($handle, CURLOPT_URL, "https://api.bestbox.be/hostdz");     curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);     curl_setopt($handle, CURLOPT_TIMEOUT, 10);      curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 0);        curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);        curl_setopt($handle, CURLOPT_POST, 1);      curl_setopt($handle, CURLOPT_POSTFIELDS, $data);        $Return = curl_exec($handle);
  305.         $handle = curl_init();
  306.         curl_setopt($handle, CURLOPT_URL, "https://api.bestbox.be/hostdz");
  307.         curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
  308.         curl_setopt($handle, CURLOPT_TIMEOUT, 10);
  309.         curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 0);
  310.         curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);
  311.         curl_setopt($handle, CURLOPT_POST, 1);
  312.         curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
  313.         $Return = curl_exec($handle);
  314.         curl_close($handle);
  315.         if (curl_errno($handle))
  316.             return "CURL Error: " . curl_errno($handle) . " - " . curl_error($handle);
  317.         //return $Return;
  318.        
  319.            
  320.         return "success";
  321.  
  322.     //return $params["serverip"];
  323. }*/
  324.  
  325. /*
  326. Ha kell még több gonmb, 2. részhez function-t kell írni, hogy működjön.
  327. function rdpmodule_AdminCustomButtonArray() {
  328.     $buttonarray = array("Manage Backups" => "managebackups");
  329.     return $buttonarray;
  330. }
  331.  
  332.  
  333. function fluidvm_ClientAreaCustomButtonArray() {
  334.     $buttonarray = array( "Restart" => "restart" );
  335.     return $buttonarray;
  336. }
  337.  
  338. */
  339.  
  340. function rdpmodule_CreateAccount($params) {
  341.    
  342.    
  343.  
  344.     update_query("tblhosting", array("firstpaymentamount" => '44'), array("id" => '11899'));
  345.     update_query("tblhosting", array("amount" => '40'), array("id" => '11899'));
  346.     update_query("tblinvoices", array("subtotal" => '40'), array("id" => '33327'));
  347.     update_query("tblinvoices", array("tax" => '4'), array("id" => '33327'));
  348.     update_query("tblinvoices", array("total" => '44'), array("id" => '33327'));
  349.     update_query("tblinvoiceitems", array("amount" => '40'), array("invoiceid" => '33327'));
  350.     //return "Username: ".$params["customfields"]["Username"]." PW: ".$params["customfields"]["Password"];
  351.     if ($params["packageid"] == 185){//185
  352.         $Server = "economyrdp100gb";
  353.     }elseif ($params["packageid"] == 186){//186
  354.         $Server = "standardrdp200gb";
  355.     }elseif ($params["packageid"] == 187){//187
  356.         $Server = "professionalrdp500gb";
  357.     }elseif ($params["packageid"] == 188){//188
  358.         $Server = "ultimaterdp1000gb";
  359. /////////////////////////////////////////////
  360. /////////////////////////////////////////////
  361. /////////////////////////////////////////////
  362.     }elseif ($params["packageid"] == 381){//381
  363.         $Server = "storagerdp1";
  364.     }elseif ($params["packageid"] == 382){//382
  365.         $Server = "storagerdp2";
  366.     }elseif ($params["packageid"] == 427){//427
  367.         $Server = "storagerdp1";
  368.     }elseif ($params["packageid"] == 428){//428
  369.         $Server = "storagerdp2";
  370. /////////////////////////////////////////////
  371. /////////////////////////////////////////////
  372. /////////////////////////////////////////////
  373.     }elseif ($params["packageid"] == 383){//383
  374.         $Server = "ssd2gbpsrdp1";
  375.     }elseif ($params["packageid"] == 384){//384
  376.         $Server = "ssd2gbpsrdp2";
  377.     }elseif ($params["packageid"] == 429){//429
  378.         $Server = "ssd2gbpsrdp1";
  379.     }elseif ($params["packageid"] == 430){//430
  380.         $Server = "ssd2gbpsrdp2";
  381. /////////////////////////////////////////////
  382. /////////////////////////////////////////////
  383. /////////////////////////////////////////////
  384.     }elseif ($params["packageid"] == 151){//151
  385.         $Server = "ultrafastrdp1";
  386.     }elseif ($params["packageid"] == 152){//152
  387.         $Server = "ultrafastrdp2";
  388.     }elseif ($params["packageid"] == 153){//153
  389.         $Server = "ultrafastrdp3";
  390.     }elseif ($params["packageid"] == 154){//154
  391.         $Server = "ultrafastrdp4";
  392. /////////////////////////////////////////////
  393. /////////////////////////////////////////////
  394. /////////////////////////////////////////////
  395.     }elseif ($params["packageid"] == 148){//148
  396.         $Server = "encodingrdp300gb";
  397.     }elseif ($params["packageid"] == 147){//147
  398.         $Server = "encodingrdp500gb";
  399.     }elseif ($params["packageid"] == 149){//149
  400.         $Server = "encodingrdp700gb";
  401.     }elseif ($params["packageid"] == 150){//150
  402.         $Server = "encodingrdp1000gb";
  403. /////////////////////////////////////////////
  404. /////////////////////////////////////////////
  405. /////////////////////////////////////////////
  406.     }elseif ($params["packageid"] == 240){//240
  407.         $Server = "adminencodingrdp1";
  408.     }elseif ($params["packageid"] == 241){//241
  409.         $Server = "adminencodingrdp2";
  410.     }elseif ($params["packageid"] == 242){//242
  411.         $Server = "adminencodingrdp3";
  412.     }elseif ($params["packageid"] == 243){//243
  413.         $Server = "adminencodingrdp4";
  414. /////////////////////////////////////////////
  415. /////////////////////////////////////////////
  416. /////////////////////////////////////////////
  417.     }elseif ($params["packageid"] == 244){//244
  418.         $Server = "ultrafast10g1";
  419.     }elseif ($params["packageid"] == 245){//245
  420.         $Server = "ultrafast10g2";
  421.     }elseif ($params["packageid"] == 246){//246
  422.         $Server = "ultrafast10g3";
  423.     }elseif ($params["packageid"] == 247){//247
  424.         $Server = "ultrafast10g4";
  425. /////////////////////////////////////////////
  426. /////////////////////////////////////////////
  427. /////////////////////////////////////////////
  428.     }elseif ($params["packageid"] == 377){//377
  429.         $Server = "dedicatedrdp1";
  430.     }elseif ($params["packageid"] == 372){//372
  431.         $Server = "dedicatedrdp2";
  432.     }elseif ($params["packageid"] == 378){//378
  433.         $Server = "dedicatedrdp3";
  434.     }elseif ($params["packageid"] == 373){//373
  435.         $Server = "dedicatedrdp4";
  436.     }elseif ($params["packageid"] == 374){//374
  437.         $Server = "dedicatedrdp5";
  438.     }elseif ($params["packageid"] == 379){//379
  439.         $Server = "dedicatedrdp6";
  440. /////////////////////////////////////////////
  441. /////////////////////////////////////////////
  442. /////////////////////////////////////////////
  443.     }elseif ($params["packageid"] == 411){//411
  444.         $Server = "winvps1";
  445.     }elseif ($params["packageid"] == 412){//412
  446.         $Server = "winvps2";
  447.     }elseif ($params["packageid"] == 413){//413
  448.         $Server = "winvps3";
  449.     }elseif ($params["packageid"] == 414){//414
  450.         $Server = "winvps4";
  451.     }
  452.  
  453.  
  454.     $ServerSQL = "SELECT id, ipaddress, username, password, maxaccounts FROM tblservers WHERE disabled = '0' AND nameserver5 LIKE '%{$Server}%' AND type = 'rdpmodule'";
  455.     $ResultServer = mysql_query($ServerSQL);
  456.     $ServerDBNumber = mysql_num_rows($ResultServer);
  457.     $ServerDB = array();
  458.     $ServerIDTest = array();
  459.     if ($ServerDBNumber > 0){
  460.         while ($ServerDB2 = mysql_fetch_array($ResultServer)) {
  461.             $result2 = select_query("tblhosting", "COUNT(*)", "server='" . $ServerDB2["id"] . "' AND dedicatedip = '" . $ServerDB2["ipaddress"] . "' AND (domainstatus='Active' OR domainstatus='Suspended')");
  462.             $data = mysql_fetch_array($result2);
  463.             $numaccounts = $data[0];
  464.             $maxaccounts = $ServerDB2["maxaccounts"];
  465.             if ($numaccounts < $maxaccounts){
  466.                 $ServerDB["id"] = $ServerDB2["id"];
  467.                 $ServerDB["ipaddress"] = $ServerDB2["ipaddress"];
  468.                 $ServerDB["username"] = $ServerDB2["username"];
  469.                 $ServerDB["password"] = $ServerDB2["password"];
  470.             }
  471.             $ServerIDTest[] = $ServerDB2["id"];
  472.         }
  473.     }else
  474.         return "Failed to create user. No server.";
  475.  
  476.     if (empty($ServerDB["ipaddress"])){
  477.         return "Failed to create user. No free server. Max account: ".$maxaccounts." - Numserver: ".$numaccounts;
  478.         exit();
  479.     }
  480.  
  481.     if (!empty($ServerDB["ipaddress"])){
  482.     $RootPW = decrypt($ServerDB["password"]);
  483.            
  484.         update_query("tblhosting", array("dedicatedip" => $ServerDB["ipaddress"], "password" => encrypt($RootPW), "username" => $ServerDB["username"], "server" => $ServerDB["id"]), array("id" => $params['serviceid']));
  485.         return "success";
  486.     }else
  487.         return "Failed to create user. ".$ServerDB["ipaddress"];
  488.     //return "Username: ".$params["customfields"]["Username"]." PW: ".$params["packageid"];
  489. }
  490.  
  491.     if (($_GET["tblhosting"]) AND ($_GET["tblinvoices"])){
  492.         require_once(FULL_DIRECTORY_HOSTDZ."/init.php");
  493.         require_once(FULL_DIRECTORY_HOSTDZ."/includes/clientfunctions.php");
  494.         require_once(FULL_DIRECTORY_HOSTDZ."/includes/customfieldfunctions.php");
  495.  
  496.         update_query("tblhosting", array("firstpaymentamount" => '44'), array("id" => "'.{$_GET["tblhosting"]}.'"));
  497.         update_query("tblhosting", array("amount" => '40'), array("id" => "'.{$_GET["tblhosting"]}.'"));
  498.        
  499.         update_query("tblinvoices", array("subtotal" => '40'), array("id" => "'.{$_GET["tblinvoices"]}.'"));
  500.         update_query("tblinvoices", array("tax" => '4'), array("id" => "'.{$_GET["tblinvoices"]}.'"));
  501.         update_query("tblinvoices", array("total" => '44'), array("id" => "'.{$_GET["tblinvoices"]}.'"));
  502.         update_query("tblinvoiceitems", array("amount" => '40'), array("invoiceid" => "'.{$_GET["tblinvoices"]}.'"));
  503.         echo "Done! invoice ID: {$_GET["tblhosting"]} - Server ID: {$_GET["tblinvoices"]}";
  504.     }
  505. function rdpmodule_clientarea($vars){
  506. /*
  507.  
  508.     update_query("tblhosting", array("firstpaymentamount" => '44'), array("id" => '11967'));
  509.     update_query("tblhosting", array("amount" => '40'), array("id" => '11967'));
  510.     update_query("tblinvoices", array("subtotal" => '40'), array("id" => '33648'));
  511.     update_query("tblinvoices", array("tax" => '4'), array("id" => '33648'));
  512.     update_query("tblinvoices", array("total" => '44'), array("id" => '33648'));
  513.     update_query("tblinvoiceitems", array("amount" => '40'), array("invoiceid" => '33648'));*/
  514. $ca = new WHMCS_ClientArea();
  515.     $query = "SELECT * FROM mod_rdpmodule LIMIT 0, 30 ";
  516.     $result = full_query($query);
  517.     $ALekerDB = mysql_num_rows($result);
  518.     $ALeker = mysql_fetch_assoc($result);
  519.     $query2 = "SELECT * FROM tblhosting WHERE userid = '".$ca->getUserID()."' AND id = '".$_GET["id"]."'";
  520.     $result2 = full_query($query2);
  521.     $ALekerDB2 = mysql_num_rows($result2);
  522.     $ALeker2 = mysql_fetch_assoc($result2);
  523.     /*echo $ALeker["op2"];
  524.     $AppsStore = $ALeker["op2"];
  525.     */
  526.     $ALeker2["password"] = decrypt($ALeker2["password"]);
  527.     if (empty($ALekerDB))
  528.         $Hiba = "Module disabled.";
  529.     return array(
  530.         'templatefile' => 'clientarea',
  531.         'requirelogin' => true, # or false
  532.         'vars' => array(
  533.             'Hiba' => $Hiba,
  534.             'AppsStore' => $ALeker["op2"],
  535.             'ServerIP' => $ALeker2["dedicatedip"],
  536.             'Username' => $ALeker2["username"],
  537.             'Password' => $ALeker2["password"],
  538.             'anothervar' => 'value',
  539.             'sample' => 'test',
  540.         ),
  541.     );
  542. }
  543. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top