1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
<?php
function drawAdminTools_VPS($admin,$vps){
global $vps_name;
global $vps_node;
global $adm_login;
global $adm_pass;
global $rub;
global $addrlink;
global $vps_soap_err;
global $pro_mysql_product_table;
global $secpayconf_use_products_for_renewal;
global $pro_mysql_vps_ip_table;
global $pro_mysql_vps_server_table;
global $pro_mysql_vps_stats_table;
global $secpayconf_currency_letters;
global $conf_post_or_get;
global $panel_type;
$reinstall_os = 1;
get_secpay_conf();
$out = "";
$checker = checkVPSAdmin($adm_login,$adm_pass,$vps_node,$vps_name);
if($checker != true){
return _("Credential not correct: can't display in file ") .__FILE__." line ".__LINE__;
}
$vps_out = "";
$vps_out_net_stats = "";
$vps_out_hdd_stats = "";
$vps_out_swap_stats = "";
$vps_out_cpu_stats = "";
// Calculate last month dates
$cur_year = date("Y");
$cur_month = date("m");
$last_month = $cur_month - 1;
if($last_month == 0){
$last_month_year = $cur_year - 1;
$last_month = 12;
}else{
$last_month_year = $cur_year;
}
$tow_month_ago = $last_month - 1;
if($tow_month_ago == 0){
$tow_month_ago = 12;
$tow_month_ago_year = $last_month_year - 1;
}else{
$tow_month_ago_year = $last_month_year;
}
// Display the current contract
$q = "SELECT * FROM $pro_mysql_product_table WHERE id='".$vps["product_id"]."';";
$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
$n = mysql_num_rows($r);
if($n == 1){
$vps_prod = mysql_fetch_array($r);
$contract = $vps_prod["name"];
}else{
$contract = "not found!";
}
$out .= "<br><h3>". _("Description: ") ."</h3><br>". _("Current contract: ") ."$contract<br>";
$q = "SELECT location FROM $pro_mysql_vps_server_table WHERE hostname='$vps_node';";
$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
$n = mysql_num_rows($r);
if($n != 1){
$location = "Cannot find VPS server $vps_node<br>";
}else{
$vps_server = mysql_fetch_array($r);
$location = $vps_server["location"];
}
$out .= _("Server location:")." ".$location."<br><br>";
// Expiration management !
$ar = explode("-",$vps["expire_date"]);
$out .= "<h3>". _("Expiry date:") ."</h3><br>";
$out .= _("Your VPS was first registered on the: ") .$vps["start_date"]."<br>";
if(date("Y") > $ar[0] ||
(date("Y") == $ar[0] && date("m") > $ar[1]) ||
(date("Y") == $ar[0] && date("m") == $ar[1] && date("d") > $ar[2])){
$out .= "<font color=\"red\">". _("Your VPS has expired on the: ") .$vps["expire_date"]."</font>"
."<br>". _("Please renew with one of the following options: ") ."<br>";
}else{
$out .= _("Your VPS will expire on the: ") .$vps["expire_date"];
}
// Renewal buttons
if ($secpayconf_use_products_for_renewal == 'yes'){
$q = "SELECT name, price_dollar FROM $pro_mysql_product_table WHERE id='".$vps["product_id"]."';";
$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
$n = mysql_num_rows($r);
if($n == 1){
$a = mysql_fetch_array($r);
$out .= "<br><br><form method=\"$conf_post_or_get\" action=\"/dtc/new_account.php\">
<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">
<input type=\"hidden\" name=\"renew_type\" value=\"vps\">
<input type=\"hidden\" name=\"product_id\" value=\"".$vps["product_id"]."\">
<input type=\"hidden\" name=\"vps_id\" value=\"".$vps["id"]."\">
<input type=\"hidden\" name=\"adm_login\" value=\"$adm_login\">
".submitButtonStart().$a["name"]." (".$a["price_dollar"]." $secpayconf_currency_letters)".submitButtonEnd()."
</form>";
}
}
$q = "SELECT * FROM $pro_mysql_product_table WHERE renew_prod_id='".$vps["product_id"]."';";
$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
$n = mysql_num_rows($r);
for($i=0;$i<$n;$i++){
$a = mysql_fetch_array($r);
$out .= "<br><br><form method=\"$conf_post_or_get\" action=\"/dtc/new_account.php\">
<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">
<input type=\"hidden\" name=\"renew_type\" value=\"vps\">
<input type=\"hidden\" name=\"product_id\" value=\"".$a["id"]."\">
<input type=\"hidden\" name=\"vps_id\" value=\"".$vps["id"]."\">
<input type=\"hidden\" name=\"adm_login\" value=\"$adm_login\">
".submitButtonStart().$a["name"]." (".$a["price_dollar"]." $secpayconf_currency_letters)".submitButtonEnd()."
</form>";
}
return $out;
}
?>
|