예제 #1
0
function drawAdminTools_dm0RRDGraphs($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 $pro_mysql_vps_ip_table;
    global $pro_mysql_vps_stats_table;
    global $secpayconf_currency_letters;
    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__;
    }
    // RRD tools graphing
    // CPU rrd
    $out .= "<br><h3>" . _("Hourly Xen server usage statistics:") . "</h3>";
    $out .= "<table cellspacing=\"4\" cellpadding=\"0\" border=\"0\">\n<tr><td><img src=\"vm-cpu-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=hour\"></td></tr>\n<tr><td><img src=\"vm-net-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=hour\"></td></tr>\n<tr><td><img src=\"vm-io-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=hour\"></td></tr>\n</table>";
    $out .= "<br><h3>" . _("Daily Xen server usage statistics:") . "</h3>";
    $out .= "<table cellspacing=\"4\" cellpadding=\"0\" border=\"0\">\n<tr><td><img src=\"vm-cpu-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=day\"></td></tr>\n<tr><td><img src=\"vm-net-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=day\"></td></tr>\n<tr><td><img src=\"vm-io-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=day\"></td></tr>\n</table>";
    $out .= "<br><h3>" . _("Weekly Xen server usage statistics:") . "</h3>";
    $out .= "<table cellspacing=\"4\" cellpadding=\"0\" border=\"0\">\n<tr><td><img src=\"vm-cpu-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=week\"></td></tr>\n<tr><td><img src=\"vm-net-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=week\"></td></tr>\n<tr><td><img src=\"vm-io-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=week\"></td></tr>\n</table>";
    $out .= "<br><h3>" . _("Monthly Xen server usage statistics:") . "</h3>";
    $out .= "<table cellspacing=\"4\" cellpadding=\"0\" border=\"0\">\n<tr><td><img src=\"vm-cpu-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=month\"></td></tr>\n<tr><td><img src=\"vm-net-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=month\"></td></tr>\n<td><img src=\"vm-io-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=month\"></td></tr>\n</table>";
    $out .= "<br><h3>" . _("Yearly Xen server usage statistics:") . "</h3>";
    $out .= "<table cellspacing=\"4\" cellpadding=\"0\" border=\"0\">\n<tr><td><img src=\"vm-cpu-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=year\"></td><td></td></tr>\n<tr><td><img src=\"vm-net-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=year\"></td><td></td></tr>\n<tr><td><img src=\"vm-io-all.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_server_hostname={$vps_node}&vps_name={$vps_name}&graph=year\"></td><td></td></tr>\n</table>\n";
    return $out;
}
예제 #2
0
function productManager()
{
    global $pro_mysql_product_table;
    global $secpayconf_currency_symbol;
    if (!isset($secpayconf_currency_symbol)) {
        get_secpay_conf();
    }
    $dsc = array("table_name" => $pro_mysql_product_table, "title" => _("Product list editor") . _(" (shared)"), "action" => "hosting_product_list_shared", "forward" => array("rub"), "where_condition" => "heb_type='shared'", "cols" => array("id" => array("type" => "id", "display" => "yes", "legend" => "Id"), "name" => array("type" => "text", "legend" => _("Product name"), "size" => "30"), "period" => array("type" => "text", "help" => _("Period for the product with format YYYY-MM-DD. For example, if you want a product that will last 1 year, 2 months, and 3 days, write 0001-02-03. "), "legend" => _("Period"), "size" => "10"), "price_dollar" => array("type" => "text", "legend" => _("Price"), "size" => "4"), "setup_fee" => array("type" => "text", "legend" => _("Setup fee"), "size" => "4"), "affiliate_kickback" => array("type" => "text", "help" => _("This is the amount of money that you will give back to the affiliate account that made the sell possible."), "legend" => _("Commission") . " " . $secpayconf_currency_symbol, "size" => "4"), "quota_disk" => array("type" => "text", "help" => _("Hard drive space in MBytes."), "legend" => _("Disk"), "size" => "4"), "nbr_email" => array("type" => "text", "legend" => _("Max email"), "size" => "2"), "nbr_database" => array("type" => "text", "legend" => _("Max database"), "size" => "2"), "bandwidth" => array("type" => "text", "legend" => _("Traffic"), "size" => "5"), "allow_add_domain" => array("type" => "popup", "legend" => _("Add domain"), "help" => _("If set to yes, the the admin can add a domain, if set to check, then it will go through moderation, set to no, no domain addition to account is possible by the admin."), "values" => array("check", "no", "yes"), "display_replace" => array(_("check"), _("no"), _("yes"))), "max_domain" => array("type" => "text", "legend" => _("Max domain"), "help" => _("Maximum number of domain a customer can add by himself on his shared account. Setting a value of zero will mean no limit."), "size" => "3"), "allow_dns_and_mx_change" => array("type" => "checkbox", "legend" => _("DNS & MX"), "help" => _("If set to no, users wont be able to edit the DNS and MX pointer of their domains."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "no"), "ftp_login_flag" => array("type" => "checkbox", "legend" => _("FTP"), "help" => _("If set to no, users wont be able to add/remove/edit FTP accounts."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "yes"), "restricted_ftp_path" => array("type" => "checkbox", "legend" => _("Restricted FTP"), "help" => _("If set to no, users will only be able to create FTP accounts with a path in the html folder of each vhosts."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "no"), "allow_mailing_list_edit" => array("type" => "checkbox", "legend" => _("Lists"), "help" => _("If set to no, users wont be able to add/remove/edit mailing lists and mail alias groups."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "yes"), "allow_subdomain_edit" => array("type" => "checkbox", "legend" => _("Subdomains"), "help" => _("If set to no, users wont be able to add/remove/edit subdomains."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "yes"), "pkg_install_flag" => array("type" => "checkbox", "legend" => _("Subdomains"), "help" => _("If set to no, users wont be able to use the package installer."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "yes"), "private" => array("type" => "checkbox", "legend" => _("Private"), "help" => _("If the private flag is set, then this product wont appear in the registration form."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "no")));
    $out = dtcDatagrid($dsc);
    // Build the product ID popup
    $qp = "SELECT id,name FROM {$pro_mysql_product_table} WHERE renew_prod_id='0' AND heb_type='vps'";
    $rp = mysql_query($qp) or die("Cannot query \"{$qp}\" !!! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
    $np = mysql_num_rows($rp);
    $renew_id_popup = array();
    $renew_id_popup[] = 0;
    $renew_id_replace = array();
    $renew_id_replace[] = _("Not a renewal product");
    for ($j = 0; $j < $np; $j++) {
        $ap = mysql_fetch_array($rp);
        $renew_id_popup[] = $ap["id"];
        if (strlen($ap["name"]) > 20) {
            $renew_id_replace[] = $ap["id"] . ": " . substr($ap["name"], 0, 17) . "...";
        } else {
            $renew_id_replace[] = $ap["id"] . ": " . $ap["name"];
        }
    }
    $dsc = array("table_name" => $pro_mysql_product_table, "title" => _("Product list editor") . _(" (VPS)"), "action" => "hosting_product_list_vps", "forward" => array("rub"), "where_condition" => "heb_type='vps'", "cols" => array("id" => array("type" => "id", "display" => "yes", "legend" => "Id"), "renew_prod_id" => array("type" => "popup", "help" => _("If you set the renewal ID, then this entry will be considered as a renewal product for the matching ID."), "legend" => _("Renewal-ID"), "values" => $renew_id_popup, "display_replace" => $renew_id_replace), "name" => array("type" => "text", "legend" => _("Name"), "size" => "30"), "period" => array("type" => "text", "help" => _("Period for the product with format YYYY-MM-DD. For example, if you want a product that will last 1 year, 2 months, and 3 days, write 0001-02-03. "), "legend" => _("Period"), "size" => "10"), "price_dollar" => array("type" => "text", "legend" => _("Price"), "size" => "4"), "setup_fee" => array("type" => "text", "legend" => _("Setup fee"), "size" => "4"), "affiliate_kickback" => array("type" => "text", "help" => _("This is the amount of money that you will give back to the affiliate account that made the sell possible."), "legend" => _("Commission") . " " . $secpayconf_currency_symbol, "size" => "4"), "quota_disk" => array("type" => "text", "help" => _("Hard drive space in MBytes."), "legend" => _("Disk"), "size" => "4"), "memory_size" => array("type" => "text", "help" => _("Memory size in MBytes."), "legend" => _("RAM"), "size" => "4"), "bandwidth" => array("type" => "text", "help" => _("Bandwidth per month in MBytes."), "legend" => _("Traffic"), "size" => "5"), "private" => array("type" => "checkbox", "legend" => _("Private"), "help" => _("If the private flag is set, then this product wont appear in the registration form."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "no")));
    $out .= dtcDatagrid($dsc);
    // Build the product ID popup
    $qp = "SELECT id,name FROM {$pro_mysql_product_table} WHERE renew_prod_id='0' AND heb_type='server'";
    $rp = mysql_query($qp) or die("Cannot query \"{$qp}\" !!! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
    $np = mysql_num_rows($rp);
    $renew_id_popup = array();
    $renew_id_popup[] = 0;
    $renew_id_replace = array();
    $renew_id_replace[] = _("Not a renewal product");
    for ($j = 0; $j < $np; $j++) {
        $ap = mysql_fetch_array($rp);
        $renew_id_popup[] = $ap["id"];
        if (strlen($ap["name"]) > 20) {
            $renew_id_replace[] = $ap["id"] . ": " . substr($ap["name"], 0, 17) . "...";
        } else {
            $renew_id_replace[] = $ap["id"] . ": " . $ap["name"];
        }
    }
    $dsc = array("table_name" => $pro_mysql_product_table, "title" => _("Product list editor") . _(" (Dedicated servers)"), "action" => "hosting_product_list_dedicated", "forward" => array("rub"), "where_condition" => "heb_type='server'", "cols" => array("id" => array("type" => "id", "display" => "yes", "legend" => "Id"), "renew_prod_id" => array("type" => "popup", "help" => _("If you set the renewal ID, then this entry will be considered as a renewal product for the matching ID."), "legend" => _("Renewal-ID"), "values" => $renew_id_popup, "display_replace" => $renew_id_replace), "name" => array("type" => "text", "legend" => _("Name"), "size" => "30"), "period" => array("type" => "text", "help" => _("Period for the product with format YYYY-MM-DD. For example, if you want a product that will last 1 year, 2 months, and 3 days, write 0001-02-03. "), "legend" => _("Period"), "size" => "10"), "price_dollar" => array("type" => "text", "legend" => _("Price"), "size" => "4"), "setup_fee" => array("type" => "text", "legend" => _("Setup fee"), "size" => "4"), "affiliate_kickback" => array("type" => "text", "help" => _("This is the amount of money that you will give back to the affiliate account that made the sell possible."), "legend" => _("Commission") . " " . $secpayconf_currency_symbol, "size" => "4"), "quota_disk" => array("type" => "text", "help" => _("Hard drive space in MBytes."), "legend" => _("Disk"), "size" => "4"), "memory_size" => array("type" => "text", "help" => _("Memory size in MBytes."), "legend" => "RAM", "size" => "4"), "bandwidth" => array("type" => "text", "help" => _("Bandwidth per month in GBytes."), "legend" => _("Traffic"), "size" => "5"), "use_radius" => array("type" => "checkbox", "legend" => _("Use Radius"), "help" => _("If the Use Radius flag is set this service is used to check a radius user."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "no"), "private" => array("type" => "checkbox", "legend" => _("Private"), "help" => _("If the private flag is set, then this product wont appear in the registration form."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "no")));
    $out .= dtcDatagrid($dsc);
    $dsc = array("table_name" => $pro_mysql_product_table, "title" => _("Product list editor") . _(" (SSL IPs)"), "action" => "hosting_product_list_ssl", "forward" => array("rub"), "where_condition" => "heb_type='ssl'", "cols" => array("id" => array("type" => "id", "display" => "yes", "legend" => "Id"), "renew_prod_id" => array("type" => "popup", "legend" => _("Renewal-ID"), "help" => _("There must be ONLY ONE SSL product at any time, with only ONE renewal product."), "values" => $renew_id_popup, "display_replace" => array(_("No-renew"))), "name" => array("type" => "text", "legend" => _("Name"), "size" => "30"), "period" => array("type" => "text", "help" => _("Period for the product with format YYYY-MM-DD. For example, if you want a product that will last 1 year, 2 months, and 3 days, write 0001-02-03. "), "legend" => _("Period"), "size" => "10"), "price_dollar" => array("type" => "text", "legend" => _("Price"), "size" => "4"), "setup_fee" => array("type" => "text", "legend" => _("Setup fee"), "size" => "4"), "affiliate_kickback" => array("type" => "text", "help" => _("This is the amount of money that you will give back to the affiliate account that made the sell possible."), "legend" => _("Commission") . " " . $secpayconf_currency_symbol, "size" => "4"), "private" => array("type" => "checkbox", "legend" => _("Private"), "help" => _("If the private flag is set, then this product wont appear in the registration form."), "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "default" => "no")));
    $out .= dtcDatagrid($dsc);
    $out .= helpLink("PmWiki/HostingProductManager");
    return $out;
}
예제 #3
0
function draw_UpgradeAccount($admin)
{
    global $adm_pass;
    global $adm_login;
    global $addrlink;
    global $pro_mysql_admin_table;
    global $pro_mysql_client_table;
    global $pro_mysql_product_table;
    global $pro_mysql_companies_table;
    global $pro_mysql_pending_renewal_table;
    global $secpayconf_currency_letters;
    if (!isset($secpayconf_currency_letters)) {
        get_secpay_conf();
    }
    $out = "";
    $nowrap = 'style="white-space:nowrap"';
    $frm_start = "<form action=\"" . $_SERVER["PHP_SELF"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n<input type=\"hidden\" name=\"action\" value=\"upgrade_myaccount\">\n";
    $client = $admin["client"];
    $out .= "<b><u>" . _("Upgrade my account:") . "</u></b><br>";
    if ($admin["info"]["prod_id"] != 0) {
        $out .= "<i><u>" . _("Past account refundal") . "</u></i><br>";
        $out .= _("Your last command expire on the: ") . $admin["info"]["expire"] . ".<br>";
        $out .= _("Today is the: ") . date("Y-m-d") . "<br>";
        $today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
        $ar = explode("-", $admin["info"]["expire"]);
        $expire = mktime(0, 0, 0, $ar[1], 0, $ar[0]);
        $remaining_seconds = $expire - $today;
        $days_remaining = $remaining_seconds / (60 * 60 * 24);
        $days_outstanding = 0;
        // don't give credit if there are negative days remaining
        if ($days_remaining < 0) {
            $days_outstanding = $days_remaining;
            $days_remaining = 0;
        }
        $q = "SELECT * FROM {$pro_mysql_product_table} WHERE id='" . $admin["info"]["prod_id"] . "';";
        $r = mysql_query($q) or die("Cannot querry: \"{$q}\" !!!" . mysql_error() . " line " . __LINE__ . " in file " . __FILE__);
        $prod = mysql_fetch_array($r);
        $ar = explode("-", $prod["period"]);
        $prod_period = mktime(0, 0, 0, $ar[1] + 1, 1, 1970 + $ar[0]);
        $prod_days = $prod_period / (60 * 60 * 24);
        $price_per_days = $prod["price_dollar"] / $prod_days;
        $refundal = floor($days_remaining * $price_per_days);
        $owing = floor($days_outstanding * $price_per_days);
        $out .= _("Your past account was: ") . $prod["price_dollar"] . " " . $secpayconf_currency_letters . " " . _("for") . " " . smartDate($prod["period"]) . "<br>";
        $out .= _("Refund") . " (" . $days_remaining . _(" days) for upgrading will be: ") . "{$refundal} " . $secpayconf_currency_letters . "<br><br>";
        $out .= _("You have") . " (" . $days_outstanding . _(" days), with ") . "{$owing}" . " " . $secpayconf_currency_letters . _(" remaining to be paid") . "<br>";
    } else {
        $out .= _("You currently don't have a validated account. Please contact customer support.");
        return $out;
    }
    $out .= "<i><u>" . _("Step 1: choose your upgrade") . "</u></i><br>";
    if (!isset($_REQUEST["prod_id"]) || $_REQUEST["prod_id"] == "") {
        $out .= _("Your current account is ") . smartByte($admin["info"]["quota"] * 1024 * 1024) . _(" disk storage and ") . smartByte($admin["info"]["bandwidth_per_month_mb"] * 1024 * 1024) . _(" of data transfer each month.") . "<br><br>" . _("To what capacity would you like to upgrade to?") . "<br>";
        $q = "SELECT * FROM {$pro_mysql_product_table} WHERE (quota_disk > '" . $admin["info"]["quota"] . "' OR bandwidth > '" . $admin["info"]["bandwidth_per_month_mb"] . "' or max_domain>" . $admin["info"]["max_domain"] . ") and heb_type='shared';";
        $r = mysql_query($q) or die("Cannot query \"{$q}\" !" . mysql_error());
        $n = mysql_num_rows($r);
        $out .= "{$frm_start}";
        $out .= "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" height=\"1\">";
        $out .= "<tr><td></td><td>" . _("Product") . "</td><td>" . _("Storage") . "</td><td>" . _("Bandwidth/month") . "</td>\n\t\t\t<td>" . _("Max. Domains") . "</td><td>" . _("Price") . "</td><td>" . _("Period") . "</td></tr>";
        if ($n > 0) {
            for ($i = 0; $i < $n; $i++) {
                $ro = mysql_fetch_array($r);
                if ($i % 2) {
                    $color = " bgcolor=\"#000000\" ";
                    $fnt1 = "<font color=\"#FFFFFF\"> ";
                    $fnt2 = "</font>";
                } else {
                    $color = "";
                    $fnt1 = "";
                    $fnt2 = "";
                }
                $out .= '<tr><td>' . $fnt1 . '<input type="radio" name="prod_id" value="' . $ro["id"] . '">' . $fnt2 . '</td>';
                $out .= "<td {$color} {$nowrap} >{$fnt1}" . $ro["name"] . $fnt2 . '</td>';
                $out .= "<td {$color} {$nowrap} >{$fnt1}" . smartByte($ro["quota_disk"] * 1024 * 1024) . $fnt2 . '</td>';
                $out .= "<td {$color} {$nowrap} >{$fnt1}" . smartByte($ro["bandwidth"] * 1024 * 1024) . $fnt2 . '</td>';
                $out .= "<td {$color} {$nowrap} >{$fnt1}" . $ro["max_domain"] . $fnt2 . '</td>';
                $out .= "<td {$color} {$nowrap} >{$fnt1}" . $ro["price_dollar"] . $fnt2 . '</td>';
                $out .= "<td {$color} {$nowrap} >{$fnt1}" . smartDate($ro["period"]) . $fnt2 . '</td></tr>';
            }
            $out .= '</table><center><input type="submit" value="' . _("Calculate price") . '"></center></form>';
        } else {
            $out .= '</table><center>' . _("There is no product with greater capacity available, please contact Support service.") . '</center></form>';
        }
        return $out;
    }
    $q = "SELECT * FROM {$pro_mysql_product_table} WHERE id='" . $_REQUEST["prod_id"] . "';";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" !" . mysql_error());
    $n = mysql_num_rows($r);
    if ($n != 1) {
        die("Product not found !!!");
    }
    $ro = mysql_fetch_array($r);
    $q = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["info"]["id_client"] . "';";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" !" . mysql_error());
    $n = mysql_num_rows($r);
    if ($n != 1) {
        die("Client not found !!!");
    }
    $rocli = mysql_fetch_array($r);
    $frm_start .= '<input type="hidden" name="prod_id" value="' . $ro["id"] . '">';
    $out .= _("You have selected") . ": " . $ro["name"];
    $out .= " (" . _("Storage") . ": " . smartByte($ro["quota_disk"] * 1024 * 1024);
    $out .= ", " . _("Transfer") . ": " . smartByte($ro["bandwidth"] * 1024 * 1024) . '), ';
    $out .= ", " . _("Max. Domains") . ": " . $ro["max_domain"] . '), ';
    $out .= '$' . $ro["price_dollar"] . ' ' . _("each") . ' ' . smartDate($ro["period"]);
    $out .= "<br><br><i><u>" . _("Step 2: proceed to upgrade") . "</u></i><br>";
    $remaining = $admin["client"]["dollar"];
    $ze_price = $ro["price_dollar"];
    $heber_price = $ze_price - $refundal;
    if (isset($_REQUEST["inner_action"]) && $_REQUEST["inner_action"] == "return_from_paypal_upgrade_account") {
        $ze_refund = isPayIDValidated(addslashes($_REQUEST["pay_id"]));
        if ($ze_refund == 0) {
            $out .= "<font color=\"red\">" . _("The transaction failed, please try again!") . "</font>";
        } else {
            $out .= "<font color=\"green\">" . _("Funds added to your account!") . "</font><br>";
            $q = "UPDATE {$pro_mysql_client_table} SET dollar = dollar+" . $ze_refund . " WHERE id='" . $admin["info"]["id_client"] . "';";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
            $admin["client"]["dollar"] += $ze_refund;
            $remaining += $ze_refund;
        }
    }
    $out .= _("Remaining on your account") . ": " . $remaining . "{$secpayconf_currency_letters}<br>\n" . _("New account price") . ": " . $ze_price . "{$secpayconf_currency_letters}<br>\n" . _("Past account refundal") . ": " . $refundal . "{$secpayconf_currency_letters}<br>\n" . _("Total price") . ": " . $heber_price . "{$secpayconf_currency_letters}<br>";
    if ($heber_price > $remaining) {
        $to_pay = $heber_price - $remaining;
        $payid = createCreditCardPaiementID($to_pay, $admin["info"]["id_client"], "Account upgrade: " . $ro["name"], "no");
        $return_url = $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}" . "&addrlink={$addrlink}&action=upgrade_myaccount&prod_id=9&inner_action=return_from_paypal_upgrade_account&payid={$payid}";
        $service_location = $conf_this_server_country_code;
        $company_invoicing_id = findInvoicingCompany($conf_this_server_country_code, $rocli["country"]);
        $q = "SELECT * FROM {$pro_mysql_companies_table} WHERE id='{$company_invoicing_id}';";
        $r = mysql_query($q) or die("Cannot query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
        if ($n != 1) {
            $form = "Cannot find company invoicing line " . __LINE__ . " file " . __FILE__;
            break;
        }
        $company_invoicing = mysql_fetch_array($r);
        // If VAT is set, use it.
        if ($company_invoicing["vat_rate"] == 0 || $company_invoicing["vat_number"] == "") {
            $vat_rate = 0;
            $use_vat = "no";
        } else {
            // Both companies are in europe, in different countries, and customer as a VAT number,
            // then there is no VAT and the customer shall pay the VAT in it's own country
            // These are the VAT rules in the European Union...
            if ($client["is_company"] == "yes" && $client["vat_num"] != "" && isset($cc_europe[$client["country"]]) && isset($cc_europe[$company_invoicing["country"]]) && $client["country"] != $company_invoicing["country"]) {
                $vat_rate = 0;
                $use_vat = "no";
            } else {
                $use_vat = "yes";
                $vat_rate = $company_invoicing["vat_rate"];
            }
        }
        // Save the values in SQL and process the paynow buttons
        $q = "INSERT INTO {$pro_mysql_pending_renewal_table} (id,adm_login,renew_date,renew_time,product_id,renew_id,heb_type,country_code)\n\t\tVALUES ('','" . $_REQUEST["adm_login"] . "',now(),now(),'" . $ro["id"] . "','" . $rocli["id"] . "','shared-upgrade','{$country}');";
        $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
        $renew_id = mysql_insert_id();
        $payid = createCreditCardPaiementID($heber_price, $renew_id, "Account upgrade: " . $ro["name"] . " (login: "******"adm_login"] . ")", "no", $prod_id, $vat_rate);
        $q = "UPDATE {$pro_mysql_pending_renewal_table} SET pay_id='{$payid}' WHERE id='{$renew_id}';";
        $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
        $payButton = paynowButton($payid, $heber_price, "Account upgrade: " . $ro["name"], $return_url, $vat_rate);
        $out .= "<br>" . _("You currently don't have enough funds on your account. You will be redirected to our payment system. Please click on the button below to pay.") . "<br><br>" . $payButton;
        return $out;
    }
    $after_upgrade_remaining = $remaining - $heber_price;
    $out .= _("After upgrade, you will have") . ": " . $after_upgrade_remaining . " " . $secpayconf_currency_letters . "<br><br>";
    // Check for confirmation
    if (isset($_REQUEST["toreg_confirm_register"]) && $_REQUEST["toreg_confirm_register"] != "yes") {
        $out .= _("You have enough funds on your account to proceed account upgrade. Press the confirm button and your order will be proceeded.") . "<br><br>\n{$frm_start}\n<input type=\"hidden\" name=\"toreg_confirm_register\" value=\"yes\">\n<input type=\"submit\" value=\"" . _("Proceed to account upgrade") . "\">\n</form>";
        return $out;
    }
    return $out;
}
예제 #4
0
파일: vps.php 프로젝트: jeremy-cayrasso/dtc
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 $pro_mysql_vps_ip_table;
    global $pro_mysql_vps_stats_table;
    global $secpayconf_currency_letters;
    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>" . _("Current contract: ") . "</h3><br>{$contract}<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
    $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 .= "<form action=\"/dtc/new_account.php\">\n<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">\n<input type=\"hidden\" name=\"renew_type\" value=\"vps\">\n<input type=\"hidden\" name=\"product_id\" value=\"" . $a["id"] . "\">\n<input type=\"hidden\" name=\"vps_id\" value=\"" . $vps["id"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"submit\" value=\"" . $a["name"] . " (" . $a["price_dollar"] . " {$secpayconf_currency_letters})" . "\">\n</form>";
    }
    return $out;
}
예제 #5
0
function drawRenewalTables()
{
    global $pro_mysql_product_table;
    global $pro_mysql_admin_table;
    global $pro_mysql_ssl_ips_table;
    global $pro_mysql_product_table;
    global $pro_mysql_vps_table;
    global $pro_mysql_dedicated_table;
    global $pro_mysql_ssl_ips_table;
    global $pro_mysql_client_table;
    global $pro_mysql_domain_table;
    global $pro_mysql_completedorders_table;
    global $pro_mysql_pay_table;
    global $pro_mysql_spent_type_table;
    global $pro_mysql_spent_providers_table;
    global $pro_mysql_spent_moneyout_table;
    global $pro_mysql_companies_table;
    global $pro_mysql_spent_bank_table;
    global $pro_mysql_client_table;
    global $pro_mysql_new_admin_table;
    global $secpayconf_currency_letters;
    global $rub;
    global $conf_vps_renewal_shutdown;
    get_secpay_conf();
    if (!isset($_REQUEST["sousrub"]) || $_REQUEST["sousrub"] == "") {
        $sousrub = "renewalreport";
    } else {
        $sousrub = $_REQUEST["sousrub"];
    }
    $out = '<ul class="box_wnb_content_nb">';
    if ($sousrub == "renewalreport") {
        $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?rub={$rub}\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_clientinterface.gif\" align=\"absmiddle\" border=\"0\"> " . _("Renewal report") . "</a></li>";
    } else {
        $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?rub={$rub}\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_clientinterface.gif\" align=\"absmiddle\" border=\"0\"> " . _("Renewal repport") . "</a></li>";
    }
    $out .= '<li class="box_wnb_content_nb_item_vsep"></li>';
    if ($sousrub == "spent") {
        $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?rub={$rub}&sousrub=spent\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/config-icon/box_wnb_nb_picto-payementgateway.gif\" align=\"absmiddle\" border=\"0\">" . _("Money spent") . "</a></li>";
    } else {
        $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?rub={$rub}&sousrub=spent\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/config-icon/box_wnb_nb_picto-payementgateway.gif\" align=\"absmiddle\" border=\"0\">" . _("Money spent") . "</a></li>";
    }
    $out .= '<li class="box_wnb_content_nb_item_vsep"></li>';
    if ($sousrub == "bank") {
        $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?rub={$rub}&sousrub=bank\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/config-icon/box_wnb_nb_picto-payementgateway.gif\" align=\"absmiddle\" border=\"0\">" . _("Bank accounts & payments") . "</a></li>";
    } else {
        $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?rub={$rub}&sousrub=bank\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/config-icon/box_wnb_nb_picto-payementgateway.gif\" align=\"absmiddle\" border=\"0\">" . _("Bank accounts & payments") . "</a></li>";
    }
    $out .= '<li class="box_wnb_content_nb_item_vsep"></li>';
    if ($sousrub == "provideredit") {
        $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?rub={$rub}&sousrub=provideredit\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_admineditor.gif\" align=\"absmiddle\" border=\"0\">" . _("Upstream provider editor") . "</a></li>";
    } else {
        $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?rub={$rub}&sousrub=provideredit\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_admineditor.gif\" align=\"absmiddle\" border=\"0\">" . _("Upstream provider editor") . "</a></li>";
    }
    $out .= "</ul>";
    switch ($sousrub) {
        case "spent":
            $ret = dateSelector("spent_moneyout", "invoice_date", "date_selector");
            $out .= $ret["text"];
            $where_condition = $ret["where_condition"];
            $q = "SELECT * FROM {$pro_mysql_spent_providers_table} ";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $prov_popup_id = array();
            $prov_popup_names = array();
            for ($i = 0; $i < $n; $i++) {
                $a = mysql_fetch_array($r);
                $prov_popup_id[] = $a["id"];
                $prov_popup_names[] = $a["quick_name"];
            }
            $q = "SELECT * FROM {$pro_mysql_spent_type_table} ";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $spent_type_popup_id = array();
            $spent_type_names = array();
            for ($i = 0; $i < $n; $i++) {
                $a = mysql_fetch_array($r);
                $spent_type_popup_id[] = $a["id"];
                $spent_type_names[] = $a["label"];
            }
            $q = "SELECT * FROM {$pro_mysql_companies_table} ";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $company_paying_popup_id = array();
            $company_paying_names = array();
            for ($i = 0; $i < $n; $i++) {
                $a = mysql_fetch_array($r);
                $company_paying_popup_id[] = $a["id"];
                $company_paying_names[] = $a["name"];
            }
            $q = "SELECT * FROM {$pro_mysql_spent_bank_table} ";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $bank_popup_id = array();
            $bank_names = array();
            for ($i = 0; $i < $n; $i++) {
                $a = mysql_fetch_array($r);
                $bank_popup_id[] = $a["id"];
                $bank_names[] = $a["acct_name"];
            }
            $dsc = array("title" => _("List of payments done by your hosting company"), "table_name" => $pro_mysql_spent_moneyout_table, "action" => "money_out_editor", "forward" => array("rub", "sousrub"), "print_where_condition" => $where_condition, "order_by" => "invoice_date", "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "label" => array("type" => "text", "size" => "10", "legend" => _("Label")), "id_company_spending" => array("legend" => _("Company paying"), "type" => "popup", "values" => $company_paying_popup_id, "display_replace" => $company_paying_names), "id_provider" => array("legend" => _("Company paid"), "type" => "popup", "values" => $prov_popup_id, "display_replace" => $prov_popup_names), "expenditure_type" => array("legend" => _("Expenditure type"), "type" => "popup", "values" => $spent_type_popup_id, "display_replace" => $spent_type_names), "payment_type" => array("legend" => _("Means of payment"), "type" => "popup", "values" => array("none", "credit_card", "wire_transfer", "paypal", "check", "cash"), "display_replace" => array(_("Unknown"), _("Credit card"), _("Wire transfer"), _("Paypal"), _("Check"), _("Cash"))), "payment_total" => array("type" => "text", "size" => 6, "legend" => _("Total cost")), "vat_rate" => array("type" => "text", "size" => 4, "legend" => _("Tax rate")), "vat_total" => array("type" => "text", "size" => 4, "legend" => _("Total tax")), "currency_type" => array("type" => "text", "size" => 4, "legend" => _("Currency")), "bank_acct_id" => array("type" => "popup", "values" => $bank_popup_id, "display_replace" => $bank_names, "legend" => _("Bank account")), "amount" => array("type" => "text", "size" => 6, "legend" => _("Bank amount")), "invoice_date" => array("type" => "text", "size" => 10, "legend" => _("Invoice date")), "paid_date" => array("type" => "text", "size" => 10, "legend" => _("Payment date"))));
            if (isset($_REQUEST["date_selector"])) {
                $dsc["forward"][] = "date_selector";
            }
            $out .= dtcDatagrid($dsc);
            break;
        case "bank":
            $q = "SELECT * FROM {$pro_mysql_companies_table} ";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $company_paying_popup_id = array();
            $company_paying_names = array();
            for ($i = 0; $i < $n; $i++) {
                $a = mysql_fetch_array($r);
                $company_paying_popup_id[] = $a["id"];
                $company_paying_names[] = $a["name"];
            }
            $dsc = array("title" => _("Bank accounts edition"), "table_name" => $pro_mysql_spent_bank_table, "action" => "bank_account_editor", "forward" => array("rub", "sousrub"), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "acct_name" => array("type" => "text", "legend" => _("Account name")), "id_company" => array("legend" => _("Company"), "type" => "popup", "values" => $company_paying_popup_id, "display_replace" => $company_paying_names), "sort_code" => array("legend" => _("Sort code"), "type" => "text", "size" => "8"), "acct_number" => array("legend" => _("Account number"), "type" => "text"), "swift" => array("legend" => _("SWIFT"), "type" => "text", "size" => "8"), "bank_addr" => array("legend" => _("Bank address"), "type" => "text"), "currency_type" => array("legend" => _("Currency"), "type" => "text", "size" => "4")));
            $out .= dtcDatagrid($dsc);
            // Payment type
            $dsc = array("title" => _("Payment type edition"), "table_name" => $pro_mysql_spent_type_table, "action" => "payment_type_editor", "forward" => array("rub", "sousrub"), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "label" => array("legend" => _("Type of payment"), "type" => "text", "size" => "32")));
            $out .= dtcDatagrid($dsc);
            break;
        case "provideredit":
            $dsc = array("title" => _("Upstream provider list edition"), "table_name" => $pro_mysql_spent_providers_table, "action" => "provider_list_editor", "forward" => array("rub", "sousrub"), "id_fld" => "id", "list_fld_show" => "quick_name", "new_item_title" => _("New upstream provider") . ":", "new_item_link" => _("New upsream provider"), "edit_item_title" => _("Edit upstream provider") . ":", "check_unique" => array("quick_name"), "where_list" => array("always_yes" => "yes"), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "quick_name" => array("type" => "text", "disable_edit" => "yes", "check" => "dtc_login_or_email", "legend" => _("Short name:")), "company_name" => array("legend" => _("Company name:"), "type" => "text"), "is_company" => array("type" => "checkbox", "values" => array("yes", "no"), "default" => "yes", "legend" => _("Is it a company:")), "familyname" => array("legend" => _("First name:"), "type" => "text"), "christname" => array("legend" => _("Familly name:"), "type" => "text"), "addr1" => array("legend" => _("Address:"), "type" => "text"), "addr2" => array("legend" => _("Address (line2):"), "type" => "text"), "addr3" => array("legend" => _("Address (line3):"), "type" => "text"), "city" => array("legend" => _("City:"), "type" => "text"), "zipcode" => array("legend" => _("Zipcode:"), "type" => "text"), "state" => array("legend" => _("State:"), "type" => "text"), "country" => array("legend" => _("Country:"), "type" => "text"), "phone" => array("legend" => _("Phone:"), "type" => "text"), "fax" => array("legend" => _("Fax:"), "type" => "text"), "email" => array("legend" => _("Email:"), "type" => "text"), "special_note" => array("legend" => _("Note:"), "type" => "textarea")));
            $out .= dtcListItemsEdit($dsc);
            break;
        default:
        case "renewalreport":
            // Allow shutdown of expired VPS
            if (isset($_REQUEST["action"])) {
                switch ($_REQUEST["action"]) {
                    case "shutdown_expired_vps":
                        // Perform a clean shutdown
                        remoteVPSAction($_REQUEST["server_hostname"], $_REQUEST["vps_name"], "shutdown_vps");
                        break;
                    case "kill_vps_and_owner":
                        // Do a brutal kill of the running instance
                        deleteVPS($_REQUEST["vps_id"]);
                        remoteVPSAction($_REQUEST["server_hostname"], $_REQUEST["vps_name"], "destroy_vps");
                        remoteVPSAction($_REQUEST["server_hostname"], $_REQUEST["vps_name"], "kill_vps_disk");
                        // Delete the admin
                        $q = "DELETE FROM {$pro_mysql_admin_table} WHERE adm_login='******';";
                        $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                        // And the client
                        $q = "DELETE FROM {$pro_mysql_client_table} WHERE id='" . $_REQUEST["client_id"] . "';";
                        $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                        break;
                    default:
                        break;
                }
            }
            // Display of each month payment list
            if (isset($_REQUEST["date"])) {
                $ret = dateSelector($pro_mysql_pay_table, "date", "date");
                $out .= $ret["text"];
                $where_condition = $ret["where_condition"];
                $q = "SELECT id,name FROM {$pro_mysql_product_table} ";
                $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                $n = mysql_num_rows($r);
                $prod_ids = array();
                $prod_names = array();
                for ($i = 0; $i < $n; $i++) {
                    $a = mysql_fetch_array($r);
                    $prod_ids[] = $a["id"];
                    $prod_names[] = $a["name"];
                }
                $out .= "<h3>" . _("Payements for the period: ") . $_REQUEST["date"] . "</h3>";
                $dsc = array("title" => _("Payment history"), "table_name" => $pro_mysql_pay_table, "action" => "payment_history_list_editor", "forward" => array("rub", "sousrub", "date"), "order_by" => "date", "skip_deletion" => "yes", "skip_creation" => "yes", "print_where_condition" => $where_condition, "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "date" => array("type" => "text", "size" => "8", "legend" => _("Date")), "id_client" => array("type" => "forkey", "forkey_type" => "info", "table" => $pro_mysql_client_table, "other_table_fld" => "CONCAT(company_name,': ',familyname,', ',christname)", "other_table_key" => "id", "this_table_field" => "id_client", "link" => "?rub=crm&id=", "bk_table" => $pro_mysql_new_admin_table, "bk_other_table_fld" => "CONCAT(comp_name,': ',family_name,', ',first_name)", "bk_other_table_key" => "id", "bk_this_table_field" => "id_client", "legend" => _("Customer name")), "product_id" => array("type" => "popup", "values" => $prod_ids, "display_replace" => $prod_names, "legend" => _("Product")), "refund_amount" => array("type" => "text", "size" => "8", "legend" => _("Refund amount")), "paiement_cost" => array("type" => "text", "size" => "4", "legend" => _("Gate cost")), "vat_rate" => array("type" => "text", "size" => "4", "legend" => _("VAT rate")), "vat_total" => array("type" => "text", "size" => "4", "legend" => _("VAT total")), "paiement_total" => array("type" => "text", "size" => "6", "legend" => _("Grand total")), "paiement_type" => array("type" => "text", "size" => "6", "legend" => _("Type")), "secpay_site" => array("type" => "text", "size" => "4", "legend" => _("Gate type")), "new_account" => array("type" => "popup", "values" => array("no", "yes"), "display_replace" => array(_("New account"), _("Renewal")), "legend" => _("Is renewal")), "valid" => array("type" => "popup", "values" => array("no", "pending", "yes"), "display_replace" => array(_("No"), _("Pending"), _("Yes")), "legend" => _("Validated")), "pending_reason" => array("type" => "text", "size" => "6", "legend" => _("Pending reason"))));
                $out .= dtcDatagrid($dsc);
                return $out;
                $ret = dateSelector($pro_mysql_completedorders_table, "date", "date");
                // Allow nuke of bad payment (hackers?) to have accounting done correctly
                if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "nuke_payment") {
                    $q = "DELETE FROM {$pro_mysql_completedorders_table} WHERE id='" . $_REQUEST["completedorders_id"] . "';";
                    $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                }
                $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                $n = mysql_num_rows($r);
                if ($n < 1) {
                    $out .= _("No past payments for this period") . "<br>";
                } else {
                    $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t\t<tr><td>" . _("Product") . "</td><td>" . _("Client ID") . "</td><td>" . _("Client") . "</td><td>" . _("Service country") . "</td>\n\t\t\t\t<td>" . _("Client country") . "</td>\n\t\t\t\t<td>" . _("VAT collected") . "</td><td>" . _("Period") . "</td><td>" . _("Payment date") . "</td><td>" . _("Total") . "</td><td>" . _("Payment method") . "</td>\n\t\t\t\t<td>" . _("Action") . "</td></tr>";
                    for ($i = 0; $i < $n; $i++) {
                        $a = mysql_fetch_array($r);
                        if ($a["id_client"] == 0) {
                            $client_name = _("No client id");
                            $client_id_txt = _("No client id");
                        } else {
                            $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $a["id_client"] . "';";
                            $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                            $n2 = mysql_num_rows($r2);
                            if ($n2 != 1) {
                                $client_name = _("N/A");
                                $client_id_txt = _("N/A");
                                $client_country = _("N/A");
                            } else {
                                $a2 = mysql_fetch_array($r2);
                                $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"];
                                $client_id_txt = $a["id_client"];
                                $client_country = $a2["country"];
                            }
                        }
                        $q2 = "SELECT * FROM {$pro_mysql_product_table} WHERE id='" . $a["product_id"] . "';";
                        $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                        $n2 = mysql_num_rows($r2);
                        if ($n2 != 1) {
                            $product_txt = _("Product not found");
                        } else {
                            $a2 = mysql_fetch_array($r2);
                            $product_txt = $a2["name"];
                            $product_period_size = $a2["period"];
                        }
                        $q2 = "SELECT * FROM {$pro_mysql_pay_table} WHERE id='" . $a["payment_id"] . "';";
                        $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                        $n2 = mysql_num_rows($r2);
                        if ($n2 != 1) {
                            $payment_txt = _("Payment not found");
                            $payment_type = _("Payment not found");
                            $vat_collected = _("VAT not found");
                        } else {
                            $a2 = mysql_fetch_array($r2);
                            $payment_txt = $a2["paiement_total"] . " " . $a2["currency"];
                            $payment_type = $a2["paiement_type"];
                            if ($payment_type == "online") {
                                $payment_type .= ": " . $a2["secpay_site"];
                            }
                            $vat_collected = $a2["paiement_total"] * $a2["vat_rate"] / 100;
                        }
                        if ($a["last_expiry_date"] == "0000-00-00") {
                            $last_expiry_date = $a["date"];
                        } else {
                            $last_expiry_date = $a["last_expiry_date"];
                        }
                        if ($payment_type == 'wire') {
                            $pay = _("Wire");
                        } else {
                            if ($payment_type == 'cheque') {
                                $pay = _("cheque");
                            } else {
                                if ($payment_type == 'online: none') {
                                    $pay = _("online: none");
                                } else {
                                    $pay = $payment_type;
                                }
                            }
                        }
                        $new_expiry_date = calculateExpirationDate($last_expiry_date, $product_period_size);
                        $out .= "<tr><td>{$product_txt}</td><td>{$client_id_txt}</td><td>{$client_name}</td><td>" . $a["country_code"] . "</td>\n\t\t\t\t\t<td>{$client_country}</td>\n\t\t\t\t\t<td>{$vat_collected}</td><td>{$last_expiry_date} -> {$new_expiry_date}</td><td>" . $a["date"] . "</td><td>{$payment_txt}</td>\n\t\t\t\t\t<td>{$pay}</td>\n\t\t\t\t\t<td><a href=\"" . $_SERVER["PHP_SELF"] . "?rub={$rub}&date=" . $_REQUEST["date"] . "&action=nuke_payment&completedorders_id=" . $a["id"] . "\">" . _("Delete") . "</a></tr>";
                    }
                    $out .= "</table>";
                }
                return $out;
            }
            // Calculation of recuring totals
            $out .= "<h3>" . _("Total recurring incomes per month:") . "</h3>";
            // Monthly recurring for shared hosting:
            $q = "SELECT {$pro_mysql_product_table}.price_dollar,{$pro_mysql_product_table}.period,{$pro_mysql_product_table}.id\n\t\tFROM {$pro_mysql_product_table},{$pro_mysql_admin_table}\n\t\tWHERE {$pro_mysql_product_table}.id = {$pro_mysql_admin_table}.prod_id\n\t\tAND {$pro_mysql_product_table}.heb_type='shared'\n\t\tAND {$pro_mysql_admin_table}.expire != '0000-00-00'";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $total_shared = 0;
            for ($i = 0; $i < $n; $i++) {
                $a = mysql_fetch_array($r);
                $period = $a["period"];
                $price = $a["price_dollar"];
                $id = $a["id"];
                if ($period == '0001-00-00') {
                    $total_shared += $price / 12;
                } else {
                    $papoum = explode('-', $period);
                    $months = $papoum[1];
                    if ($months == 0) {
                        echo "Product {$id} has zero month.<br>";
                    } else {
                        $total_shared += $price / $months;
                    }
                }
            }
            // Calculate how much SSL IPs have been taken
            $q = "SELECT count(id) as num_ssl FROM {$pro_mysql_ssl_ips_table} WHERE available='no'";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $total_ssl = 0;
            if ($n != 0) {
                $a = mysql_fetch_array($r);
                $q = "SELECT price_dollar FROM {$pro_mysql_product_table} WHERE heb_type='ssl'";
                $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                $n = mysql_num_rows($r);
                if ($n != 0) {
                    $b = mysql_fetch_array($r);
                    $total_ssl = $a["num_ssl"] * $b["price_dollar"] / 12;
                }
            }
            // Monthly recurring for VPS:
            $q = "SELECT {$pro_mysql_product_table}.price_dollar,{$pro_mysql_product_table}.period,{$pro_mysql_product_table}.id\n\t\tFROM {$pro_mysql_product_table},{$pro_mysql_vps_table}\n\t\tWHERE {$pro_mysql_product_table}.id = {$pro_mysql_vps_table}.product_id";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $total_vps = 0;
            for ($i = 0; $i < $n; $i++) {
                $a = mysql_fetch_array($r);
                $period = $a["period"];
                $price = $a["price_dollar"];
                $id = $a["id"];
                if ($period == '0001-00-00') {
                    $total_shared += $price / 12;
                } else {
                    $papoum = explode('-', $period);
                    $months = $papoum[1];
                    if ($months != 0) {
                        $total_vps += $price / $months;
                    } else {
                        echo "Product {$id} has zero month.<br>";
                    }
                }
            }
            // Monthly recurring for dedicated servers:
            $q = "SELECT {$pro_mysql_product_table}.price_dollar,{$pro_mysql_product_table}.period,{$pro_mysql_product_table}.id\n\t\tFROM {$pro_mysql_product_table},{$pro_mysql_dedicated_table}\n\t\tWHERE {$pro_mysql_product_table}.id = {$pro_mysql_dedicated_table}.product_id";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            $total_dedicated = 0;
            for ($i = 0; $i < $n; $i++) {
                $a = mysql_fetch_array($r);
                $period = $a["period"];
                $price = $a["price_dollar"];
                $id = $a["id"];
                if ($period == '0001-00-00') {
                    $total_shared += $price / 12;
                } else {
                    $papoum = explode('-', $period);
                    $months = $papoum[1];
                    if ($months == 0) {
                        echo _("Dedicated server product ID {$id} has zero for the number of month to renew") . "<br>";
                    } else {
                        $total_dedicated += $price / $months;
                    }
                }
            }
            $p_renewal = "";
            $p_renewal .= _("Shared hosting: ") . round($total_shared, 2) . " {$secpayconf_currency_letters}<br>";
            $p_renewal .= _("SSL IPs renewals: ") . round($total_ssl, 2) . " {$secpayconf_currency_letters}<br>";
            $p_renewal .= _("VPS: ") . round($total_vps, 2) . " {$secpayconf_currency_letters}<br>";
            $p_renewal .= _("Dedicated servers: ") . round($total_dedicated, 2) . " {$secpayconf_currency_letters}<br>";
            $big_total = $total_shared + $total_vps + $total_dedicated + $total_ssl;
            $p_renewal .= "<b>" . _("Total: ") . round($big_total, 2) . " {$secpayconf_currency_letters}</b>";
            // Show a quick history of payments
            $year = date("Y");
            $month = date("m");
            $cur_year = $year - 2;
            $cur_month = $month;
            $p_history = "";
            $p_history .= "<table cellspacing=\"1\" cellpadding=\"1\" border=\"1\">\n\t\t<tr><td>" . _("Period") . "</td><td>" . _("Amount") . "</td><td>" . _("VAT collected") . "</td><td>" . _("Payment gateway cost") . "</td><td>" . _("Profit") . "</td></tr>";
            for ($i = 0; $i < 25; $i++) {
                $q2 = "SELECT {$pro_mysql_pay_table}.paiement_total,{$pro_mysql_pay_table}.vat_rate,{$pro_mysql_pay_table}.paiement_cost\n\t\t\tFROM {$pro_mysql_pay_table},{$pro_mysql_completedorders_table}\n\t\t\tWHERE {$pro_mysql_pay_table}.vat_rate!='0.00'\n\t\t\tAND {$pro_mysql_completedorders_table}.payment_id = {$pro_mysql_pay_table}.id\n\t\t\tAND {$pro_mysql_completedorders_table}.date LIKE '" . $cur_year . "-" . $cur_month . "-%';";
                $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                $n2 = mysql_num_rows($r2);
                $vat_collected = 0;
                $month_total = 0;
                $cost_total = 0;
                for ($j = 0; $j < $n2; $j++) {
                    $a2 = mysql_fetch_array($r2);
                    $tt = $a2["paiement_total"];
                    $vat = $a2["vat_rate"];
                    $vat_collected += $tt * $vat / 100;
                    $month_total += $tt;
                    $cost_total += $a2["paiement_cost"];
                }
                $q2 = "SELECT sum(paiement_total) as paiement_total, sum(paiement_cost) as paiement_cost FROM {$pro_mysql_completedorders_table},{$pro_mysql_pay_table}\n\t\t\tWHERE {$pro_mysql_completedorders_table}.date LIKE '" . $cur_year . "-" . $cur_month . "%'\n\t\t\tAND {$pro_mysql_completedorders_table}.payment_id = {$pro_mysql_pay_table}.id\n\t\t\tAND {$pro_mysql_pay_table}.vat_rate = '0.00';";
                $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                $n2 = mysql_num_rows($r2);
                if ($n2 > 0) {
                    $a2 = mysql_fetch_array($r2);
                    $cost_total += $a2["paiement_cost"];
                    $month_total += $a2["paiement_total"];
                    $profit = $month_total - $cost_total - $vat_collected;
                    $p_history .= "<tr><td style=\"text-align:right;\"><a href=\"" . $_SERVER["PHP_SELF"] . "?rub={$rub}&date=" . $cur_year . "-" . $cur_month . "\">" . $cur_year . "-" . $cur_month . "</a></td>\n\t\t\t\t<td style=\"text-align:right;\">" . $month_total . " {$secpayconf_currency_letters}</td>\n\t\t\t\t<td style=\"text-align:right;\">" . round($vat_collected, 2) . " {$secpayconf_currency_letters}</td>\n\t\t\t\t<td style=\"text-align:right;\">" . round($cost_total, 2) . " {$secpayconf_currency_letters}</td>\n\t\t\t\t<td style=\"text-align:right;\">" . round($profit, 2) . " {$secpayconf_currency_letters}</td></tr>";
                }
                $cur_month++;
                if ($cur_month > 12) {
                    $cur_month = 1;
                    $cur_year++;
                }
                if ($cur_month < 10) {
                    $cur_month = "0" . $cur_month;
                }
            }
            $p_history .= "</table>";
            $p_active_prods = "<img src=\"active_prods_graph.php?graph=year\"><br>\n<img src=\"active_prods_graph.php?graph=month\">";
            // Layout the recuring stat and the effective payment statistics
            $out .= "<table cellspacing=\"1\" cellpadding=\"4\" border=\"0\" width=\"100%\">\n\t\t<tr valign=\"top\"><td valign=\"top\" width=\"50%\">{$p_history}</td>\n\t\t<td valign=\"top\">{$p_renewal}</td>\n\t\t<td valign=\"top\">{$p_active_prods}</td></tr></table>";
            $out .= "<h3>" . _("Shared hosting renewals:") . "</h3>";
            $q = "SELECT * FROM {$pro_mysql_admin_table} WHERE expire < '" . date("Y-m-d") . "' AND id_client!='0' AND expire !='0000-00-00' ORDER BY expire;";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__);
            $n = mysql_num_rows($r);
            if ($n < 1) {
                $out .= _("No shared account expired.") . "<br>";
            } else {
                $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t<tr><td>" . _("Login") . "</td><td>" . _("Client") . "</td><td>" . _("Email") . "</td><td>" . _("Expiration date") . "</td></tr>";
                for ($i = 0; $i < $n; $i++) {
                    $a = mysql_fetch_array($r);
                    $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $a["id_client"] . "';";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n2 = mysql_num_rows($r2);
                    if ($n2 != 1) {
                        $client_name = _("Client name not found!");
                    } else {
                        $a2 = mysql_fetch_array($r2);
                        $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"];
                    }
                    $q2 = "SELECT * FROM {$pro_mysql_domain_table} WHERE owner='" . $a["adm_login"] . "';";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__);
                    $n2 = mysql_num_rows($r2);
                    if ($n2 > 0) {
                        $out .= "<tr><td>" . $a["adm_login"] . "</td><td>{$client_name}</td><td>" . $a2["email"] . "</td><td>" . $a["expire"] . "</td></tr>";
                    }
                }
                $out .= "</table>";
            }
            // List of expired expired SSL IPs
            $out .= "<h3>" . _("SSL IPs renewals") . "</h3>";
            $q = "SELECT * FROM {$pro_mysql_ssl_ips_table} WHERE expire < '" . date("Y-m-d") . "' AND available='no' ORDER BY expire";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n < 1) {
                $out .= _("No SSL IP expired") . "<br>";
            } else {
                $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t<tr><td>" . _("Login") . "</td><td>" . _("Client") . "</td><td>" . _("Email") . "</td><td>" . _("Expiration date") . "</td></tr>";
                for ($i = 0; $i < $n; $i++) {
                    $a = mysql_fetch_array($r);
                    $q2 = "SELECT * FROM {$pro_mysql_admin_table} WHERE adm_login='******';";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n2 = mysql_num_rows($r2);
                    if ($n2 != 1) {
                        die("Cannot find admin name " . $a["adm_login"] . " line " . __LINE__ . " file " . __FILE__);
                    } else {
                        $admin = mysql_fetch_array($r2);
                    }
                    $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["id_client"] . "';";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n2 = mysql_num_rows($r2);
                    if ($n2 != 1) {
                        $client_name = _("Client name not found!");
                    } else {
                        $a2 = mysql_fetch_array($r2);
                        $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"];
                    }
                    $out .= "<tr><td>" . $a["adm_login"] . "</td><td>{$client_name}</td><td>" . $a2["email"] . "</td><td>" . $a["expire"] . "</td></tr>";
                }
                $out .= "</table>";
            }
            // List if expired VPS
            $out .= "<h3>" . _("VPS renewals:") . "</h3>";
            $q = "SELECT * FROM {$pro_mysql_vps_table} WHERE expire_date < '" . date("Y-m-d") . "' ORDER BY expire_date";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n < 1) {
                $out .= _("No VPS expired") . "<br>";
            } else {
                $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t<tr><td>" . _("Login") . "</td><td>" . _("VPS") . "</td>\n\t\t\t<td>" . _("Client") . "</td>\n\t\t\t<td>" . _("Email") . "</td>\n\t\t\t<td>" . _("Expiration date") . "</td>\n\t\t\t<td>" . _("Days of expiration") . "</td>\n\t\t\t<td>" . _("Action") . "</td>\n\t\t\t</tr>";
                for ($i = 0; $i < $n; $i++) {
                    $a = mysql_fetch_array($r);
                    $q2 = "SELECT * FROM {$pro_mysql_admin_table} WHERE adm_login='******';";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n2 = mysql_num_rows($r2);
                    if ($n2 != 1) {
                        die("Cannot find admin name " . $a["owner"] . " line " . __LINE__ . " file " . __FILE__);
                    } else {
                        $admin = mysql_fetch_array($r2);
                    }
                    $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["id_client"] . "';";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n2 = mysql_num_rows($r2);
                    if ($n2 != 1) {
                        $client_name = _("Client name not found!");
                    } else {
                        $a2 = mysql_fetch_array($r2);
                        $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"];
                    }
                    $q2 = "SELECT adm_login FROM {$pro_mysql_admin_table} WHERE id_client='" . $admin["id_client"] . "'";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n2 = mysql_num_rows($r2);
                    if ($n2 == 1) {
                        $q2 = "SELECT * FROM {$pro_mysql_vps_table} WHERE owner='" . $admin["adm_login"] . "'";
                        $r2 = mysql_query($q2) or die("Cannot querry " . $q2 . " line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                        $n2 = mysql_num_rows($r2);
                        if ($n2 == 1) {
                            $q2 = "SELECT * FROM {$pro_mysql_dedicated_table} WHERE owner='" . $admin["adm_login"] . "'";
                            $r2 = mysql_query($q2) or die("Cannot querry " . $q2 . " line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                            $n2 = mysql_num_rows($r2);
                            if ($n2 == 0) {
                                $q2 = "SELECT * FROM {$pro_mysql_domain_table} WHERE owner='" . $admin["adm_login"] . "'";
                                $r2 = mysql_query($q2) or die("Cannot querry " . $q2 . " line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                                $n2 = mysql_num_rows($r2);
                                if ($n2 == 0) {
                                    $kill_owner_txt = "<a href=\"" . $_SERVER["PHP_SELF"] . "?action=kill_vps_and_owner&adm_login="******"adm_login"] . "&client_id=" . $admin["id_client"] . "&vps_name=" . $a["vps_xen_name"] . "&server_hostname=" . $a["vps_server_hostname"] . "&vps_id=" . $a["id"] . "\">" . _("Kill VPS and owner") . "</a>";
                                } else {
                                    $kill_owner_txt = _("Has some domains");
                                }
                            } else {
                                $kill_owner_txt = _("Has a dedicated");
                            }
                        } else {
                            $kill_owner_txt = _("More than one VPS");
                        }
                    } else {
                        $kill_owner_txt = _("More than one login");
                    }
                    if (numOfDays($a["expire_date"]) >= $conf_vps_renewal_shutdown) {
                        $bgcolor = " bgcolor=\"#FF8888\" ";
                    } else {
                        $bgcolor = " ";
                    }
                    $out .= "<tr><td>" . $a["owner"] . "</td>\n\t\t\t\t<td>" . $a["vps_xen_name"] . ":" . $a["vps_server_hostname"] . "</td>\n\t\t\t\t<td>{$client_name}</td>\n\t\t\t\t<td>" . $a2["email"] . "</td>\n\t\t\t\t<td {$bgcolor}>" . $a["expire_date"] . "</td>\n\t\t\t\t<td {$bgcolor}>" . calculateAge($a["expire_date"], "00:00:00") . "</td>\n\t\t\t\t<td><a href=\"" . $_SERVER["PHP_SELF"] . "?rub={$rub}&action=shutdown_expired_vps&server_hostname=" . $a["vps_server_hostname"] . "&vps_name=" . $a["vps_xen_name"] . "\">" . _("Shutdown") . "</a> - {$kill_owner_txt}</td></tr>";
                }
                $out .= "</table>";
            }
            // List expired dedicated servers
            $out .= "<h3>" . _("Dedicated servers renewals") . "</h3>";
            $q = "SELECT * FROM {$pro_mysql_dedicated_table} WHERE expire_date < '" . date("Y-m-d") . "' ORDER BY expire_date";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n < 1) {
                $out .= _("No dedicated server expired") . "<br>";
            } else {
                $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t<tr><td>" . _("Login") . "</td><td>" . _("Server") . "</td><td>" . _("Client") . "</td><td>" . _("Email") . "</td><td>" . _("Expiration date") . "</td></tr>";
                for ($i = 0; $i < $n; $i++) {
                    $a = mysql_fetch_array($r);
                    $q2 = "SELECT * FROM {$pro_mysql_admin_table} WHERE adm_login='******';";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n2 = mysql_num_rows($r2);
                    if ($n2 != 1) {
                        die("Cannot find admin name " . $a["owner"] . " line " . __LINE__ . " file " . __FILE__);
                    } else {
                        $admin = mysql_fetch_array($r2);
                    }
                    $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["id_client"] . "';";
                    $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
                    $n2 = mysql_num_rows($r2);
                    if ($n2 != 1) {
                        $client_name = _("Client name not found!");
                    } else {
                        $a2 = mysql_fetch_array($r2);
                        $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"];
                    }
                    $out .= "<tr><td>" . $a["owner"] . "</td><td>" . $a["server_hostname"] . "</td><td>{$client_name}</td><td>" . $a2["email"] . "</td><td>" . $a["expire_date"] . "</td></tr>";
                }
                $out .= "</table>";
            }
            break;
    }
    return $out;
}
예제 #6
0
function drawNewAdminForm()
{
    global $conf_site_root_host_path;
    global $lang;
    global $pro_mysql_admin_table;
    global $pro_mysql_client_table;
    global $pro_mysql_new_admin_table;
    global $pro_mysql_pending_queries_table;
    global $pro_mysql_pay_table;
    global $pro_mysql_pending_renewal_table;
    global $pro_mysql_product_table;
    global $pro_mysql_vps_table;
    global $pro_mysql_tik_admins_table;
    global $pro_mysql_tik_queries_table;
    global $pro_mysql_tik_cats_table;
    global $pro_mysql_dedicated_table;
    global $secpayconf_currency_letters;
    global $secpayconf_use_maxmind;
    get_secpay_conf();
    $out = "";
    // Resolve support ticket stuff
    if (isset($_REQUEST["subaction"]) && $_REQUEST["subaction"] == "resolv_ticket") {
        $q = "SELECT * FROM {$pro_mysql_tik_queries_table} WHERE id='" . $_REQUEST["tik_id"] . "';";
        $r = mysql_query($q) or die("Cannot query \"{$q}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
        $n = mysql_num_rows($r);
        if ($n != 1) {
            return _("Cannot find ticket!");
        }
        $a = mysql_fetch_array($r);
        $out .= _("Subject: ") . htmlspecialchars(stripslashes($a["subject"])) . "<br>";
        $q2 = "SELECT * FROM {$pro_mysql_tik_cats_table} WHERE id='" . $a["cat_id"] . "';";
        $r2 = mysql_query($q2) or die("Cannot query {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
        $n2 = mysql_num_rows($r2);
        if ($n2 != 1) {
            $tmp = _("Type not found!");
        } else {
            $a2 = mysql_fetch_array($r2);
            $tmp = $a2["catdescript"] . "<br>";
        }
        $out .= _("Type:") . $tmp;
        $out .= _("First query date: ") . $a["date"] . " " . $a["time"] . "<br>";
        $out .= _("Server hostname related: ") . $a["server_hostname"] . "<br>";
        $out .= _("Admin login: "******"adm_login"] . "<br><br>";
        $out .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\">";
        $next_tikq = $_REQUEST["tik_id"];
        $close_request = "no";
        while ($next_tikq != 0) {
            $q = "SELECT * FROM {$pro_mysql_tik_queries_table} WHERE adm_login='******' AND id='{$next_tikq}';";
            $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) {
                $out .= _("Cannot find ticket!");
                break;
            }
            $a = mysql_fetch_array($r);
            $last_tik = $next_tikq;
            $next_tikq = $a["reply_id"];
            if ($a["admin_or_user"] == "user") {
                $bg = " bgcolor=\"#AAAAFF\" ";
            } else {
                $bg = " bgcolor=\"#FFFFAA\" ";
            }
            if ($a["admin_or_user"] == "admin") {
                $replied_by = "<br>" . _("Replied by:") . " " . $a["admin_name"];
            } else {
                $replied_by = "";
            }
            $out .= "<tr><td{$bg} valign=\"top\"><i>" . $a["date"] . " " . $a["time"] . "</i>" . $replied_by . "</td><td{$bg}>" . nl2br(htmlspecialchars(stripslashes($a["text"]))) . "</td></tr>";
            if ($a["request_close"] == "yes") {
                $close_request = "yes";
            }
        }
        $out .= "</table>";
        $out .= _("Request to close the ticket: ");
        if ($close_request == "yes") {
            $out .= "<font color=\"#00FF00\">" . _("Yes") . "</font><br>";
        } else {
            $out .= "<font color=\"#FF0000\">" . _("No") . "</font><br>";
        }
        $out .= "<form action=\"" . $_SERVER["PHP_SELF"] . "\" method=\"post\">\n\t\t<input type=\"hidden\" name=\"subaction\" value=\"ticket_reply\">\n\t\t<textarea cols=\"100\" rows=\"10\" wrap=\"physical\" name=\"ticketbody\"></textarea><br>\n\t\t<input type=\"hidden\" name=\"tik_id\" value=\"" . $_REQUEST["tik_id"] . "\">\n\t\t<input type=\"hidden\" name=\"server_hostname\" value=\"" . $a["server_hostname"] . "\">\n\t\t<input type=\"hidden\" name=\"last_tik_id\" value=\"{$last_tik}\">\n\t\t<div class=\"input_btn_container\" onMouseOver=\"this.className='input_btn_container-hover';\" onMouseOut=\"this.className='input_btn_container';\">\n <div class=\"input_btn_left\"></div>\n <div class=\"input_btn_mid\"><input class=\"input_btn\" type=\"submit\" name=\"answer\" value=\"" . _("Send reply") . "\"></div>\n <div class=\"input_btn_right\"></div>\n</div>\n\t\t<div class=\"input_btn_container\" onMouseOver=\"this.className='input_btn_container-hover';\" onMouseOut=\"this.className='input_btn_container';\">\n <div class=\"input_btn_left\"></div>\n <div class=\"input_btn_mid\"><input class=\"input_btn\" type=\"submit\" name=\"answer_close\" value=\"" . _("Send reply and close ticket") . "\"></div>\n <div class=\"input_btn_right\"></div>\n</div>\n\t\t<div class=\"input_btn_container\" onMouseOver=\"this.className='input_btn_container-hover';\" onMouseOut=\"this.className='input_btn_container';\">\n <div class=\"input_btn_left\"></div>\n <div class=\"input_btn_mid\"><input class=\"input_btn\" type=\"submit\" name=\"close\" value=\"" . _("Close without reply") . "\"></div>\n <div class=\"input_btn_right\"></div>\n</div>\n\t\t<div class=\"input_btn_container\" onMouseOver=\"this.className='input_btn_container-hover';\" onMouseOut=\"this.className='input_btn_container';\">\n <div class=\"input_btn_left\"></div>\n <div class=\"input_btn_mid\"><input class=\"input_btn\" type=\"submit\" name=\"delete_thread\" value=\"" . _("Delete thread silently") . "\"></div>\n <div class=\"input_btn_right\"></div>\n</div>\n\t\t</form>";
        return $out;
    }
    // Reply to support ticket stuff
    if (isset($_REQUEST["subaction"]) && $_REQUEST["subaction"] == "ticket_reply") {
        $q = "SELECT * FROM {$pro_mysql_tik_queries_table} WHERE id='" . $_REQUEST["tik_id"] . "';";
        $r = mysql_query($q) or die("Cannot query \"{$q}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
        $n = mysql_num_rows($r);
        if ($n != 1) {
            return _("Cannot find ticket!");
        }
        $a = mysql_fetch_array($r);
        if (isset($_REQUEST["answer"])) {
            $closed = "no";
        } else {
            $closed = "yes";
        }
        $adm_login = $a["adm_login"];
        if (strlen($adm_login) != 0) {
            $q = "SELECT * FROM {$pro_mysql_admin_table} WHERE adm_login='******';";
            $r = mysql_query($q) or die("Cannot query \"{$q}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n != 1) {
                return "Admin {$adm_login} not found line " . __LINE__ . " file " . __FILE__;
            }
            $admin = mysql_fetch_array($r);
            if ($admin["id_client"] == "0") {
                return _("The virtual administrator for which you are trying to manage a support ticket has no client file. Go in the Customer management screen and create a client file for this administrator.");
            }
            $q = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["id_client"] . "';";
            $r = mysql_query($q) or die("Cannot query \"{$q}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n != 1) {
                return "Client id for admin {$adm_login} not found line " . __LINE__ . " file " . __FILE__;
            }
            $client = mysql_fetch_array($r);
        } else {
            $adm_login = "";
        }
        if (isset($_REQUEST["delete_thread"])) {
            deleteTicketThread($_REQUEST["tik_id"]);
            $closed = "no";
        }
        if (isset($_REQUEST["answer"]) || isset($_REQUEST["answer_close"])) {
            $qps = "SELECT * FROM {$pro_mysql_tik_admins_table} WHERE pseudo='" . $_SERVER["PHP_AUTH_USER"] . "';";
            $rps = mysql_query($qps) or die("Cannot query {$qps} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $nps = mysql_num_rows($rps);
            if ($nps != 1) {
                die("Ticket admin not found line " . __LINE__ . " file " . __FILE__);
            }
            $aps = mysql_fetch_array($rps);
            $pseudo = $aps["pseudo"];
            $q2 = "INSERT INTO {$pro_mysql_tik_queries_table} (id,adm_login,date,time,in_reply_of_id,reply_id,admin_or_user,subject,text,cat_id,initial_ticket,server_hostname,closed,admin_name)\n\t\t\tVALUES ('','" . $a["adm_login"] . "','" . date("Y-m-d") . "','" . date("H:i:s") . "','" . $_REQUEST["last_tik_id"] . "','0','admin','" . mysql_real_escape_string($a["subject"]) . "','" . mysql_real_escape_string($_REQUEST["ticketbody"]) . "','" . $a["cat_id"] . "','no','" . $a["server_hostname"] . "','{$closed}','{$pseudo}');";
            $r2 = mysql_query($q2) or die("Cannot query {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $ins_id = mysql_insert_id();
            $q2 = "UPDATE {$pro_mysql_tik_queries_table} SET reply_id='{$ins_id}' WHERE id='" . $_REQUEST["last_tik_id"] . "';";
            $r2 = mysql_query($q2) or die("Cannot query {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $out .= "Ticket reply sent!<br>";
            if (strlen($adm_login) != 0) {
                mailUserTicketReply($client["email"], $a["hash"], $a["subject"], $_REQUEST["ticketbody"], $closed, $adm_login);
            }
            if (strlen($a["customer_email"]) != 0) {
                mailUserTicketReply($a["customer_email"], $a["hash"], $a["subject"], $_REQUEST["ticketbody"], $closed, $adm_login);
            }
        }
        if ($closed == "yes") {
            $q2 = "UPDATE {$pro_mysql_tik_queries_table} SET closed='yes' WHERE id='" . $_REQUEST["tik_id"] . "';";
            $r2 = mysql_query($q2) or die("Cannot query {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
        }
        if (isset($_REQUEST["close"])) {
            if (strlen($adm_login) != 0) {
                mailUserTicketReply($client["email"], $a["hash"], "The ticket has been closed (without text reply)", "The ticket has been closed (without text reply)", $closed, $adm_login);
            }
            if (strlen($a["customer_email"]) != 0) {
                mailUserTicketReply($a["customer_email"], $a["hash"], "The ticket has been closed (without text reply)", "The ticket has been closed (without text reply)", $closed, $adm_login);
            }
        }
    }
    // Draw the form for making a new admin
    $add_a_user = "******" . _("Add a new user") . "</h3>\n<form name=\"addnewuser_frm\" action=\"?\" method=\"post\">\n<input type=\"hidden\" name=\"newadminuser\" value=\"Ok\">\n" . dtcFormTableAttrs() . dtcFormLineDraw(_("Login:"******"<input class=\"dtcDatagrid_input_color\" type=\"text\" name=\"newadmin_login\" value=\"\">") . dtcFormLineDraw(_("Password:"******"<input class=\"dtcDatagrid_input_alt_color\" type=\"password\" name=\"newadmin_pass\" value=\"\">" . autoGeneratePassButton("addnewuser_frm", "newadmin_pass"), 0) . dtcFormLineDraw(_("Path:"), "<input class=\"dtcDatagrid_input_color\" type=\"text\" name=\"newadmin_path\" value=\"{$conf_site_root_host_path}\">") . dtcFromOkDraw() . "\n</form>\n</table>\n";
    if ($secpayconf_use_maxmind == "yes") {
        $maxmindsays_th = "<td>" . _("MaxMind says") . "</td>";
    } else {
        $maxmindsays_th = "";
    }
    // Draw the list of users awaiting for an account
    $waiting_new_users = "<h3>" . _("User and domain waiting for addition:") . "</h3>";
    $q = "SELECT * FROM {$pro_mysql_new_admin_table} ORDER BY date,time";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n < 1) {
        $waiting_new_users .= "<b>" . _("No user waiting!") . "</b>";
    } else {
        $waiting_new_users .= "<table width=\"100%\"border=\"1\">\n<tr><td>" . _("Name") . "</td><td>" . _("Login") . "</td><td>" . _("Domain name / VPS server hostname") . "</td><td>" . _("Product") . "</td><td>" . _("Date") . "</td><td>" . _("Bank validated") . "</td>{$maxmindsays_th}<td>" . _("Action") . "</td></tr>";
        for ($i = 0; $i < $n; $i++) {
            $a = mysql_fetch_array($r);
            $waiting_new_users .= "<tr><td style=\"white-space:nowrap\"><u>" . $a["comp_name"] . ":</u><br>";
            $waiting_new_users .= $a["family_name"] . ", " . $a["first_name"] . "</td>";
            $waiting_new_users .= "<td>" . $a["reqadm_login"] . "</td>";
            $prod_id = $a["product_id"];
            $q2 = "SELECT * FROM {$pro_mysql_product_table} WHERE id='{$prod_id}';";
            $r2 = mysql_query($q2) or die("Cannot query \"{$q2}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
            $n2 = mysql_num_rows($r2);
            if ($n2 != 1) {
                $dom_name = _("Cannot find product in db!");
                $prod_name = _("Cannot find product in db!");
            } else {
                $a2 = mysql_fetch_array($r2);
                $prod_name = $a2["name"];
                if ($a2["heb_type"] == "vps") {
                    $dom_name = $a["vps_location"];
                } else {
                    $dom_name = $a["domain_name"];
                }
            }
            $waiting_new_users .= "<td>{$dom_name}</td><td>{$prod_name}</td>";
            $waiting_new_users .= "<td>" . $a["date"] . " " . $a["time"] . "<br>" . calculateAge($a["date"], $a["time"]) . "</td>";
            if ($a["paiement_id"] == 0) {
                $waiting_new_users .= "<td>" . _("No pay ID!") . "</td>";
            } else {
                $q = "SELECT * FROM {$pro_mysql_pay_table} WHERE id='" . $a["paiement_id"] . "';";
                $r2 = mysql_query($q) or die("Cannot select {$q} line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
                $n2 = mysql_num_rows($r2);
                if ($n2 != 1) {
                    echo "Numrows!=1 in {$q} line: " . __LINE__ . " file: " . __FILE__ . " : problems with sql tables !";
                }
                $a2 = mysql_fetch_array($r2);
                if ($a2["valid"] == "yes") {
                    $waiting_new_users .= "<td><font color=\"green\">" . _("Yes") . "</font></td>";
                } elseif ($a2["valid"] == "pending") {
                    $waiting_new_users .= "<td><font color=\"#FF8800\">" . _("Pending") . ": " . $a2["pending_reason"] . "</font></td>";
                } else {
                    $waiting_new_users .= "<td><font color=\"red\">" . _("No") . "</font></td>";
                }
            }
            if ($secpayconf_use_maxmind == "yes") {
                $waiting_new_users .= "<td><pre style='width: 200px; height: 100px; overflow: scroll;'>" . htmlspecialchars(print_r(unserialize($a["maxmind_output"]), true)) . "</pre></td>";
            }
            $waiting_new_users .= "<td style=\"white-space:nowrap\"><a target=\"_blank\" href=\"/dtcadmin/view_waitingusers.php?reqadm_id=" . $a["id"] . "\">" . _("Edit") . "</a><br/>\n\t\t\t<a href=\"" . $_SERVER["PHP_SELF"] . "?action=valid_waiting_user&reqadm_id=" . $a["id"] . "\">" . _("Add") . "</a><br/>\n\t\t\t<a href=\"" . $_SERVER["PHP_SELF"] . "?action=delete_waiting_user&reqadm_id=" . $a["id"] . "\">" . _("Delete") . "</a></td>";
            $waiting_new_users .= "</tr>";
        }
        $waiting_new_users .= "</table>";
    }
    // Draw the list of domains awaiting to be add to users
    $q = "SELECT * FROM {$pro_mysql_pending_queries_table}";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n < 1) {
        $waiting_new_users .= "<br><b>" . _("No domain waiting!") . "</b><br>";
    } else {
        $waiting_new_users .= "<table border=\"1\">\n\t<tr><td>" . _("Login") . "</td><td>" . _("Domain name") . "</td><td>" . _("Action") . "</td></tr>";
        for ($i = 0; $i < $n; $i++) {
            $a = mysql_fetch_array($r);
            $waiting_new_users .= "<td>" . $a["adm_login"] . "</td>";
            $waiting_new_users .= "<td>" . $a["domain_name"] . "</td>";
            $waiting_new_users .= "<td><a href=\"" . $_SERVER["PHP_SELF"] . "?action=valid_waiting_domain_to_user&reqid=" . $a["id"] . "\">" . _("Add") . "</a>\n- <a href=\"" . $_SERVER["PHP_SELF"] . "?action=delete_waiting_domain_to_user&reqid=" . $a["id"] . "\">" . _("Delete") . "</a></td></tr>";
        }
        $waiting_new_users .= "</table>";
    }
    // Draw the list of pending renewals
    $q = "SELECT * FROM {$pro_mysql_pending_renewal_table} ORDER BY renew_date,renew_time";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n < 1) {
        $waiting_new_users .= "<b>" . _("No pending renewals!") . "</b><br>";
    } else {
        $waiting_new_users .= "<table border=\"1\">\n<tr><td>" . _("Login") . "</td><td>" . _("Product") . "</td><td>" . _("Payment date") . "</td><td>" . _("Bank validated") . "</td><td>" . _("Type") . "</td><td>" . _("Action") . "</td></tr>";
        for ($i = 0; $i < $n; $i++) {
            $a = mysql_fetch_array($r);
            $waiting_new_users .= "<tr><td>" . $a["adm_login"] . "</td>";
            $q2 = "SELECT name,price_dollar,period FROM {$pro_mysql_product_table} WHERE id='" . $a["product_id"] . "';";
            $r2 = mysql_query($q2) or die("Cannot query \"{$q2}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
            $n2 = mysql_num_rows($r2);
            if ($n2 != 1) {
                $prod_name = _("Cannot find product!");
            } else {
                $a2 = mysql_fetch_array($r2);
                $prod_name = $a2["name"] . " (" . $a2["price_dollar"] . " {$secpayconf_currency_letters}: " . $a2["period"] . ")";
            }
            $waiting_new_users .= "<td>{$prod_name}</td>";
            $waiting_new_users .= "<td>" . $a["renew_date"] . " " . $a["renew_time"] . "</td>";
            $q2 = "SELECT * FROM {$pro_mysql_pay_table} WHERE id='" . $a["pay_id"] . "';";
            $r2 = mysql_query($q2) or die("Cannot query \"{$q2}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
            $n2 = mysql_num_rows($r2);
            if ($n2 != 1) {
                $bank = _("Cannot find payment!");
            } else {
                $a2 = mysql_fetch_array($r2);
                switch ($a2["valid"]) {
                    case "yes":
                        $bank = "<font color=\"green\">" . _("Yes") . "</font>";
                        break;
                    default:
                    case "no":
                        $bank = "<font color=\"red\">" . _("No") . "</font>";
                        break;
                    case "pending":
                        $bank = "<font color=\"#FF8800\">" . _("Pending") . ": " . $a2["pending_reason"] . "</font>";
                        break;
                }
            }
            $waiting_new_users .= "<td>{$bank}</td>";
            switch ($a["heb_type"]) {
                case "vps":
                    $q2 = "SELECT * FROM {$pro_mysql_vps_table} WHERE id='" . $a["renew_id"] . "'";
                    $r2 = mysql_query($q2) or die("Cannot query \"{$q2}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
                    if ($n2 != 1) {
                        $heb_type = _("VPS: Cannot find VPS in db!");
                    } else {
                        $a2 = mysql_fetch_array($r2);
                        $heb_type = "VPS: " . $a2["vps_xen_name"] . "@" . $a2["vps_server_hostname"];
                    }
                    break;
                case "shared":
                case "ssl":
                    $heb_type = _("Shared");
                    break;
                case "shared-upgrade":
                    $heb_type = _("Shared Upgrade");
                    break;
                case "ssl":
                    $heb_type = _("SSL Token purchase");
                    break;
                case "ssl_renew":
                    $heb_type = _("SSL Token renewal");
                    break;
                case "server":
                    $q2 = "SELECT * FROM {$pro_mysql_dedicated_table} WHERE id='" . $a["renew_id"] . "'";
                    $r2 = mysql_query($q2) or die("Cannot query \"{$q2}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
                    if ($n2 != 1) {
                        $tmp = _("Cannot find server in db!");
                    } else {
                        $a2 = mysql_fetch_array($r2);
                        $tmp = $a2["server_hostname"];
                    }
                    $heb_type = _("Server:") . $tmp;
                    break;
                default:
                    echo "Renew type " . $a["heb_type"] . " not implemented line " . __LINE__ . " file " . __FILE__;
                    break;
            }
            $waiting_new_users .= "<td>{$heb_type}</td>";
            $waiting_new_users .= "<td style=\"white-space:nowrap\"><a href=\"" . $_SERVER["PHP_SELF"] . "?action=validate_renewal&id=" . $a["id"] . "\">" . _("Validate") . "</a> <a href=\"" . $_SERVER["PHP_SELF"] . "?action=delete_renewal&id=" . $a["id"] . "\">" . _("Del") . "</a></td>";
            $waiting_new_users .= "</tr>";
        }
        $waiting_new_users .= "</table>";
    }
    // Ticket manager: draw all open tickets
    $q = "SELECT * FROM {$pro_mysql_tik_queries_table} WHERE closed='no' AND initial_ticket='yes' ORDER BY `date`,`time`;";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n < 1) {
        $waiting_new_users .= "<b>" . _("No pending support tickets!") . "</b><br>";
    } else {
        $waiting_new_users .= "<table border=\"1\">\n<tr><td>" . _("Login") . "</td><td>" . _("Age") . "</td><td>" . _("Type") . "</td><td>" . _("Subject") . "</td><td>" . _("Last message from") . "</td><td>" . _("Last message age") . "</td></tr>";
        for ($i = 0; $i < $n; $i++) {
            $a = mysql_fetch_array($r);
            if (strlen($a["customer_email"]) != 0) {
                $who = $a["customer_email"];
                if (strlen($a["adm_login"]) != 0) {
                    $who .= " / " . $a["adm_login"];
                }
            } else {
                $who = $a["adm_login"];
            }
            $waiting_new_users .= "<tr><td>{$who}</td>";
            $q2 = "SELECT * FROM {$pro_mysql_tik_cats_table} WHERE id='" . $a["cat_id"] . "'";
            $r2 = mysql_query($q2) or die("Cannot query \"{$q2}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
            $n2 = mysql_num_rows($r2);
            if ($n2 != 1) {
                $cat = _("Type not found!");
            } else {
                $a2 = mysql_fetch_array($r2);
                $cat = $a2["catname"];
            }
            $age = calculateAge($a["date"], $a["time"]);
            $waiting_new_users .= "<td style=\"white-space:nowrap;\">{$age}</td><td>{$cat}</td><td style=\"white-space:nowrap;\"><a href=\"" . $_SERVER["PHP_SELF"] . "?subaction=resolv_ticket&tik_id=" . $a["id"] . "\">" . htmlspecialchars(stripslashes($a["subject"])) . "</a></td>";
            $next_reply_id = $a["reply_id"];
            $last_reply_text = "<font color=\"green\">" . _("Admin") . "</font>";
            $last_message_date = $a["date"];
            $last_message_time = $a["time"];
            $loop_num = 0;
            $last_guy_replied = "user";
            while ($next_reply_id != 0 && $loop_num < 49) {
                $loop_num++;
                $q2 = "SELECT * FROM {$pro_mysql_tik_queries_table} WHERE id='{$next_reply_id}';";
                $r2 = mysql_query($q2) or die("Cannot query \"{$q2}\" ! Line: " . __LINE__ . " in file: " . __FILE__ . " mysql said: " . mysql_error());
                $n2 = mysql_num_rows($r2);
                if ($n2 != 1) {
                    echo "Warning: couldn't find tik query {$next_reply_id} in last reply detection!";
                    break;
                }
                $a3 = mysql_fetch_array($r2);
                $last_message_date = $a3["date"];
                $last_message_time = $a3["time"];
                if ($a3["admin_or_user"] == "user") {
                    $last_guy_replied = "user";
                } else {
                    $last_guy_replied = "admin";
                }
                $next_reply_id = $a3["reply_id"];
                if ($loop_num >= 49) {
                    echo "Warning: loop_num exeeded 50, not displaying last ticket reply from line" . __LINE__ . " file " . __FILE__;
                }
            }
            if ($last_guy_replied == "user") {
                $last_reply_text = "<font color=\"red\">" . _("User") . "</font>";
            }
            $waiting_new_users .= "<td>{$last_reply_text}</td>";
            $age2 = calculateAge($last_message_date, $last_message_time);
            $waiting_new_users .= "<td>" . $age2 . "</td>";
            $waiting_new_users .= "</tr>";
        }
        $waiting_new_users .= "</table>";
    }
    return "<table>\n<tr>\n\t<td valign=\"top\">" . $waiting_new_users . "</td>\n\t</tr><tr>\n\t<td valign=\"top\">" . $add_a_user . "</td>\n</tr></table>";
}
예제 #7
0
function renew_form()
{
    global $pro_mysql_admin_table;
    global $pro_mysql_new_admin_table;
    global $pro_mysql_product_table;
    global $pro_mysql_pending_renewal_table;
    global $pro_mysql_client_table;
    global $pro_mysql_companies_table;
    global $pro_mysql_vps_table;
    global $pro_mysql_dedicated_table;
    global $pro_mysql_vps_server_table;
    global $conf_webmaster_email_addr;
    global $conf_message_subject_header;
    global $conf_this_server_country_code;
    global $secpayconf_currency_letters;
    global $cc_europe;
    get_secpay_conf();
    // Do field format checking and escaping for all fields
    if (!isFtpLogin($_REQUEST["adm_login"])) {
        $ret["err"] = 2;
        $ret["mesg"] = "User login format incorrect. Please use letters and numbers only and from 4 to 16 chars.";
        return $ret;
    }
    $q = "SELECT adm_login,id_client FROM {$pro_mysql_admin_table} WHERE adm_login='******';";
    $r = mysql_query($q) or die("Cannot query  \"{$q}\" !!! Line: " . __LINE__ . " File: " . __FILE__ . " MySQL said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n != 1) {
        $ret["err"] = 3;
        $ret["mesg"] = "Username not found in database! Try again.";
        return $ret;
    } else {
        $admin = mysql_fetch_array($r);
    }
    if (isset($_REQUEST["renew_type"]) && ($_REQUEST["renew_type"] == "ssl" || $_REQUEST["renew_type"] == "ssl_renew")) {
        $q = "SELECT * FROM {$pro_mysql_product_table} WHERE heb_type ='ssl';";
    } else {
        $q = "SELECT * FROM {$pro_mysql_product_table} WHERE id='" . addslashes($_REQUEST["product_id"]) . "';";
    }
    $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n != 1) {
        $ret["err"] = 3;
        $ret["mesg"] = "<font color=\"red\">Cannot find product id!</font>";
        return $ret;
    }
    $a = mysql_fetch_array($r);
    $product = $a;
    $the_prod = $a["name"] . " (" . $a["price_dollar"] . " {$secpayconf_currency_letters})";
    $prod_id = $a["id"];
    $form = "<b><u>" . _("Renewal for login:"******"</u></b> " . $_REQUEST["adm_login"] . "<br>";
    $form .= "<b><u>" . _("Product to renew:") . "</u></b> " . $a["name"] . " (" . number_format($a["price_dollar"], 2) . " {$secpayconf_currency_letters})<br><br>";
    switch ($_REQUEST["renew_type"]) {
        case "vps":
            if (!isRandomNum($_REQUEST["vps_id"])) {
                $ret["err"] = 3;
                $ret["mesg"] = "<font color=\"red\">VPS id is not a valid number!</font>";
                return $ret;
            }
            $client_id = $_REQUEST["vps_id"];
            $q = "SELECT country_code  FROM {$pro_mysql_vps_table},{$pro_mysql_vps_server_table}\n\t\tWHERE {$pro_mysql_vps_table}.id='" . $_REQUEST["vps_id"] . "' AND {$pro_mysql_vps_server_table}.hostname = {$pro_mysql_vps_table}.vps_server_hostname";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " mysql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n != 1) {
                $ret["err"] = 3;
                $ret["mesg"] = "<font color=\"red\">Cannot find vps server country</font>";
                return $ret;
            }
            $ax = mysql_fetch_array($r);
            $country = $ax["country_code"];
            break;
        case "shared":
        case "ssl":
            if (!isRandomNum($_REQUEST["client_id"])) {
                $ret["err"] = 3;
                $ret["mesg"] = "<font color=\"red\">Client id is not a valid number!</font>";
                return $ret;
            }
            $client_id = $_REQUEST["client_id"];
            $country = $conf_this_server_country_code;
            break;
        case "ssl_renew":
            if (!isRandomNum($_REQUEST["ssl_ip_id"])) {
                $ret["err"] = 3;
                $ret["mesg"] = "<font color=\"red\">ssl_ip_id is not a valid number!</font>";
                return $ret;
            }
            $client_id = $_REQUEST["ssl_ip_id"];
            $country = $conf_this_server_country_code;
            break;
        case "server":
            if (!isRandomNum($_REQUEST["server_id"])) {
                $ret["err"] = 3;
                $ret["mesg"] = "<font color=\"red\">Server id is not a valid number!</font>";
                return $ret;
            }
            $client_id = $_REQUEST["server_id"];
            $q = "SELECT country_code FROM {$pro_mysql_dedicated_table} WHERE id='" . $_REQUEST["server_id"] . "';";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " mysql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n != 1) {
                $ret["err"] = 3;
                $ret["mesg"] = "<font color=\"red\">Cannot find dedicated server country</font>";
                return $ret;
            }
            $ax = mysql_fetch_array($r);
            $country = $ax["country_code"];
            break;
        default:
            die("Renew type unknown line " . __LINE__ . " file " . __FILE__);
            // To be implemented for other means!
            break;
    }
    $mail_content = "\nSomebody tried to renew a contract. Here is the details of the renewal:\n\nlogin: "******"adm_login"] . "\nProduct name: {$the_prod}\nRenew product type: " . $_REQUEST["renew_type"] . "\nService country: {$country}\n";
    if ($admin["id_client"] == 0) {
        $ret["err"] = 3;
        $ret["mesg"] = "Admin does not link to a client.";
        return $ret;
    }
    // Get the client ID so we can get the country
    $q = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["id_client"] . "'";
    $r = mysql_query($q) or die("Cannot query  \"{$q}\" !!! Line: " . __LINE__ . " File: " . __FILE__ . " MySQL said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n != 1) {
        $ret["err"] = 3;
        $ret["mesg"] = "Client not found in database! Try again.";
        return $ret;
    } else {
        $client = mysql_fetch_array($r);
    }
    // Get the VAT from the invoicing company
    $company_invoicing_id = findInvoicingCompany($country, $client["country"]);
    $q = "SELECT * FROM {$pro_mysql_companies_table} WHERE id='{$company_invoicing_id}';";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
    if ($n != 1) {
        $ret["err"] = 3;
        $ret["mesg"] = "Cannot find company for invoicing.";
        return $ret;
    }
    $company_invoicing = mysql_fetch_array($r);
    // If VAT is set, use it.
    if ($company_invoicing["vat_rate"] == 0 || $company_invoicing["vat_number"] == "") {
        $vat_rate = 0;
        $use_vat = "no";
    } else {
        // Both companies are in europe, in different countries, and customer as a VAT number,
        // then there is no VAT and the customer shall pay the VAT in it's own country
        // These are the VAT rules in the European Union...
        if ($client["is_company"] == "yes" && $client["vat_num"] != "" && isset($cc_europe[$client["country"]]) && isset($cc_europe[$company_invoicing["country"]]) && $client["country"] != $company_invoicing["country"]) {
            $vat_rate = 0;
            $use_vat = "no";
        } else {
            $use_vat = "yes";
            $vat_rate = $company_invoicing["vat_rate"];
        }
    }
    $headers = "From: DTC Robot <{$conf_webmaster_email_addr}>";
    $subject = $admin["adm_login"] . " tried to renew {$the_prod}";
    mail($conf_webmaster_email_addr, "{$conf_message_subject_header} {$subject}", $mail_content, $headers);
    // Save the values in SQL and process the paynow buttons
    $q = "INSERT INTO {$pro_mysql_pending_renewal_table} (id,adm_login,renew_date,renew_time,product_id,renew_id,heb_type,country_code)\n\tVALUES ('','" . $_REQUEST["adm_login"] . "',now(),now(),'" . $prod_id . "','" . $client_id . "','" . $_REQUEST["renew_type"] . "','{$country}');";
    $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
    $renew_id = mysql_insert_id();
    $payid = createCreditCardPaiementID($a["price_dollar"], $renew_id, $a["name"] . " (login: "******"adm_login"] . ")", "no", $prod_id, $vat_rate);
    $q = "UPDATE {$pro_mysql_pending_renewal_table} SET pay_id='{$payid}' WHERE id='{$renew_id}';";
    $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
    $return_url = $_SERVER["PHP_SELF"] . "?action=return_from_pay&regid={$payid}";
    $paybutton = paynowButton($payid, $a["price_dollar"], $a["name"] . " (login: "******"adm_login"] . ")", $return_url, $vat_rate);
    $form .= _("Please click on the button below to send money in your account:") . "<br><br>" . $paybutton;
    $ret["err"] = 0;
    $ret["mesg"] = $form;
    return $ret;
}
예제 #8
0
function drawAdminTools_VPSMonitor($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 $pro_mysql_vps_ip_table;
    global $pro_mysql_vps_stats_table;
    global $secpayconf_currency_letters;
    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
    $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;
    }
    $q = "SELECT * FROM {$pro_mysql_vps_stats_table} WHERE vps_server_hostname='{$vps_node}' AND vps_xen_name='xen{$vps_name}'\n\tAND year='{$tow_month_ago_year}' AND month='{$tow_month_ago}';";
    $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);
        $net_total = $a["network_in_count"] + $a["network_out_count"];
        $vps_out_net_stats .= _("2 months ago: ") . smartByte($net_total) . "<br>";
        $vps_out_cpu_stats .= _("2 months ago: ") . $a["cpu_usage"] . _(" CPU seconds") . "<br>";
        $vps_out_swap_stats .= _("2 months ago: ") . smartByte($a["swapio_count"]) . "<br>";
        $vps_out_hdd_stats .= _("2 months ago: ") . smartByte($a["diskio_count"]) . "<br>";
    }
    $q = "SELECT * FROM {$pro_mysql_vps_stats_table} WHERE vps_server_hostname='{$vps_node}' AND vps_xen_name='xen{$vps_name}'\n\tAND year='{$last_month_year}' AND month='{$last_month}';";
    $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);
        $net_total = $a["network_in_count"] + $a["network_out_count"];
        $vps_out_net_stats .= _("Last month: ") . smartByte($net_total) . "<br>";
        $vps_out_cpu_stats .= _("Last month: ") . $a["cpu_usage"] . _(" CPU seconds") . "<br>";
        $vps_out_swap_stats .= _("Last month: ") . smartByte($a["swapio_count"]) . "<br>";
        $vps_out_hdd_stats .= _("Last month: ") . smartByte($a["diskio_count"]) . "<br>";
    }
    $q = "SELECT * FROM {$pro_mysql_vps_stats_table} WHERE vps_server_hostname='{$vps_node}' AND vps_xen_name='xen{$vps_name}'\n\tAND year='{$cur_year}' AND month='{$cur_month}';";
    $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);
        $net_total = $a["network_in_count"] + $a["network_out_count"];
        $vps_out_net_stats .= _("This month: ") . smartByte($net_total);
        $vps_out_cpu_stats .= _("This month: ") . $a["cpu_usage"] . _(" CPU seconds");
        $vps_out_swap_stats .= _("This month: ") . smartByte($a["swapio_count"]);
        $vps_out_hdd_stats .= _("This month: ") . smartByte($a["diskio_count"]);
    }
    // Display the stats of the VPS
    $vps_stat_out = "";
    $vps_stat_out .= "<table cellspacing=\"2\" cellpaddig=\"2\" border=\"0\">";
    $vps_stat_out .= "<tr><td>" . _("Network:") . "<br>";
    $vps_stat_out .= "<img width=\"120\" height=\"48\" src=\"vps_stats_network.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_node={$vps_node}&vps_name={$vps_name}\"></td>";
    $vps_stat_out .= "<td>" . _("CPU Time:") . "<br>";
    $vps_stat_out .= "<img width=\"120\" height=\"48\" src=\"vps_stats_cpu.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_node={$vps_node}&vps_name={$vps_name}\"></td></tr>";
    $vps_stat_out .= "<tr><td>" . $vps_out_net_stats . "</td><td>{$vps_out_cpu_stats}</td></tr>";
    $vps_stat_out .= "<tr><td>" . _("Swap I/O:") . "<br>";
    $vps_stat_out .= "<img width=\"120\" height=\"48\" src=\"vps_stats_swap.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_node={$vps_node}&vps_name={$vps_name}\"></td>";
    $vps_stat_out .= "<td>" . _("HDD I/O:") . "<br>";
    $vps_stat_out .= "<img width=\"120\" height=\"48\" src=\"vps_stats_hdd.php?adm_login={$adm_login}&adm_pass={$adm_pass}&vps_node={$vps_node}&vps_name={$vps_name}\"></td></tr>";
    $vps_stat_out .= "<tr><td>" . $vps_out_swap_stats . "</td><td>" . $vps_out_hdd_stats . "</td></tr></table>";
    // VPS (remote SOAP) Status
    $soap_client = connectToVPSServer($vps_node);
    if ($soap_client != false) {
        $vps_remote_info = getVPSInfo($vps_node, $vps_name, $soap_client);
        if ($vps_remote_info == false) {
            if (strstr($vps_soap_err, _("Method getVPSState failed"))) {
                $vps_out .= _("Could not get remote status (Method getVPSState() failed). Maybe the VPS is not running?") . "<br><br>";
            } else {
                if (strstr($vps_soap_err, _("couldn't connect to host"))) {
                    $vps_out .= _("Could not get remote status: could not connect to the SOAP server (HTTP error).") . "<br><br>";
                } else {
                    $vps_out .= _("Could not get remote status. Unkown error: ") . "{$vps_soap_err}<br><br>";
                }
            }
        } else {
            if ($vps_remote_info == "fsck") {
                $vps_out .= _("Checking filesystem...") . "<br><br>";
            } else {
                if ($vps_remote_info == "mkos") {
                    $vps_out .= _("Reinstalling operating system...") . "<br><br>";
                } else {
                    if (isset($vps_remote_info["id"])) {
                        $vps_out .= _("VM id: ") . $vps_remote_info["id"] . "<br>";
                    }
                    if (isset($vps_remote_info["name"])) {
                        $vps_out .= _("Name: ") . $vps_remote_info["name"] . "<br>";
                    }
                    if (isset($vps_remote_info["memory"])) {
                        $vps_out .= _("Memory: ") . $vps_remote_info["memory"] . "<br>";
                    }
                    if (isset($vps_remote_info["maxmem"])) {
                        $vps_out .= _("Max memory: ") . $vps_remote_info["maxmem"] . "<br>";
                    } else {
                        $vps_out .= _("Maxmem: cannot fetch (maybe boot in progress?)") . "<br>";
                    }
                    if (isset($vps_remote_info["cpu"])) {
                        $vps_out .= _("Number of CPU: ") . $vps_remote_info["cpu"] . "<br>";
                    } else {
                        $vps_out .= _("Number of CPU: cannot fetch (maybe boot in progress?)") . "<br>";
                    }
                    if (isset($vps_remote_info["state"])) {
                        $vps_out .= _("VPS State: ") . $vps_remote_info["state"] . "<br>";
                    } else {
                        $vps_out .= _("State: cannot fetch (maybe boot in progress?)") . "<br>";
                    }
                    if ($vps_remote_info["xen_type"] == 2 && isset($vps_remote_info["up_time"])) {
                        $uptime = substr($vps_remote_info["up_time"], 0, strpos($vps_remote_info["up_time"], "."));
                        $uptime_s = $uptime % 60;
                        $uptime_m = round($uptime / 60) % 60;
                        $uptime_h = round($uptime / 3600) % 24;
                        $uptime_j = round($uptime / 86400);
                        if ($uptime_s > 1) {
                            $upt_s_s = "s";
                        } else {
                            $upt_s_s = "";
                        }
                        if ($uptime_m > 1) {
                            $upt_s_m = "s";
                        } else {
                            $upt_s_m = "";
                        }
                        if ($uptime_h > 1) {
                            $upt_s_h = "s";
                        } else {
                            $upt_s_h = "";
                        }
                        if ($uptime_j > 1) {
                            $upt_s_j = "s";
                        } else {
                            $upt_s_j = "";
                        }
                        $vps_out .= _("Up time: ") . "{$uptime_j} day{$upt_s_j} {$uptime_h} hour{$upt_s_h} {$uptime_m} minute{$upt_s_m} {$uptime_s} seconde{$upt_s_s}<br>";
                        $vps_out .= _("Last boot date: ") . date("Y-m-d H:i:s", substr($vps_remote_info["start_time"], 0, strlen($vps_remote_info["start_time"]) - 2)) . "<br>";
                    }
                    $vps_out .= "<br>";
                }
            }
        }
    } else {
        $vps_out .= _("Could not connect to the VPS SOAP Server.");
    }
    $frm_start = "<form action=\"?\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">";
    // The ip address(es)
    $out .= "<br><h3>" . _("IP address(es) of your VPS:") . "</h3>";
    $vps_ips = $vps["ip_addr"];
    $n = sizeof($vps_ips);
    if ($n > 1) {
        $out .= _("IP addresses: ");
    } else {
        $out .= _("IP address: ");
    }
    for ($i = 0; $i < $n; $i++) {
        if ($i != 0) {
            $out .= ", ";
        }
        $out .= $vps_ips[$i];
    }
    $out .= "<br><br>";
    // VPS status
    $out .= $vps_stat_out;
    $out .= "<h3>" . _("Current VPS status:") . "</h3><br>";
    $out .= $vps_out;
    // VPS Monitoring
    $out .= "<br><h3>" . _("Service monitoring:") . "</h3><br>";
    $frm_start = dtcFormTableAttrs() . "<form action=\"?\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">";
    $out .= $frm_start . "\n<input type=\"hidden\" name=\"action\" value=\"set_vps_monitoring_values\">\n";
    if ($vps["monitor_ping"] == "yes") {
        $monitor_ping = " checked ";
    } else {
        $monitor_ping = " ";
    }
    if ($vps["monitor_ssh"] == "yes") {
        $monitor_ssh = " checked ";
    } else {
        $monitor_ssh = " ";
    }
    if ($vps["monitor_http"] == "yes") {
        $monitor_http = " checked ";
    } else {
        $monitor_http = " ";
    }
    if ($vps["monitor_smtp"] == "yes") {
        $monitor_smtp = " checked ";
    } else {
        $monitor_smtp = " ";
    }
    if ($vps["monitor_pop3"] == "yes") {
        $monitor_pop3 = " checked ";
    } else {
        $monitor_pop3 = " ";
    }
    if ($vps["monitor_imap4"] == "yes") {
        $monitor_imap4 = " checked ";
    } else {
        $monitor_imap4 = " ";
    }
    if ($vps["monitor_ftp"] == "yes") {
        $monitor_ftp = " checked ";
    } else {
        $monitor_ftp = " ";
    }
    $out .= dtcFormLineDraw(_("VPS monitoring alerts email address: "), "<input type=\"text\" name=\"email_addr\" value=\"" . $vps["monitoring_email"] . "\">", 1);
    $out .= dtcFormLineDraw(_("Ping: "), "<input type=\"checkbox\" name=\"monitor_ping\" value=\"yes\" {$monitor_ping}>", 0);
    $out .= dtcFormLineDraw(_("SSH: "), "<input type=\"checkbox\" name=\"monitor_ssh\" value=\"yes\" {$monitor_ssh}>", 1);
    $out .= dtcFormLineDraw(_("HTTP: "), "<input type=\"checkbox\" name=\"monitor_http\" value=\"yes\" {$monitor_http}>", 0);
    $out .= dtcFormLineDraw(_("SMTP: "), "<input type=\"checkbox\" name=\"monitor_smtp\" value=\"yes\" {$monitor_smtp}>", 1);
    $out .= dtcFormLineDraw(_("POP3: "), "<input type=\"checkbox\" name=\"monitor_pop3\" value=\"yes\" {$monitor_pop3}>", 0);
    $out .= dtcFormLineDraw(_("IMAP4: "), "<input type=\"checkbox\" name=\"monitor_imap4\" value=\"yes\" {$monitor_imap4}>", 1);
    $out .= dtcFormLineDraw(_("FTP: "), "<input type=\"checkbox\" name=\"monitor_ftp\" value=\"yes\" {$monitor_ftp}>", 0);
    $out .= dtcFormLineDraw("", dtcApplyButton(), 1);
    $out .= "</form></table>";
    return $out;
}
예제 #9
0
function drawAdminTools_Dedicated($admin, $dedicated_server_hostname)
{
    global $adm_login;
    global $adm_pass;
    global $rub;
    global $addrlink;
    global $pro_mysql_product_table;
    global $pro_mysql_dedicated_table;
    global $pro_mysql_dedicated_ips_table;
    global $secpayconf_currency_letters;
    global $submit_err;
    get_secpay_conf();
    $out = "<font color=\"red\">{$submit_err}</font>";
    // Check owner and fetch!
    checkDedicatedAdmin($adm_login, $adm_pass, $dedicated_server_hostname);
    $q = "SELECT * FROM {$pro_mysql_dedicated_table} WHERE server_hostname='{$dedicated_server_hostname}';";
    $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) {
        $out .= _("Server not found!");
    }
    $dedicated = mysql_fetch_array($r);
    // Display the current contract
    $q = "SELECT * FROM {$pro_mysql_product_table} WHERE id='" . $dedicated["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) {
        $server_prod = mysql_fetch_array($r);
        $contract = $server_prod["name"];
    } else {
        $contact = _("Not found!");
    }
    $out .= "<h3>" . _("Dedicated server contract:") . "</h3><br>{$contract}<br><br>";
    $ar = explode("-", $dedicated["expire_date"]);
    $out .= "<b><u>" . _("Dedicated server expiration dates:") . "</u></b><br>";
    $out .= _("Your dedicated server was first registered on the:") . " " . $dedicated["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 dedicated server has expired on the: ") . $dedicated["expire_date"] . "</font>" . "<br>" . _("Please renew it with one of the following options") . "<br>";
    } else {
        $out .= _("Your dedicated server will expire on the: ") . $dedicated["expire_date"];
    }
    $q = "SELECT * FROM {$pro_mysql_product_table} WHERE renew_prod_id='" . $dedicated["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 .= "<form action=\"/dtc/new_account.php\">\n\t\t<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">\n\t\t<input type=\"hidden\" name=\"renew_type\" value=\"server\">\n\t\t<input type=\"hidden\" name=\"product_id\" value=\"" . $a["id"] . "\">\n\t\t<input type=\"hidden\" name=\"server_id\" value=\"" . $dedicated["id"] . "\">\n\t\t<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n\t\t<input type=\"submit\" value=\"" . $a["name"] . " (" . $a["price_dollar"] . " {$secpayconf_currency_letters})" . "\">\n\t\t</form>";
    }
    //	$out .= "Dedicated server content!";
    if ($server_prod["use_radius"] == 'yes') {
        $out .= '<BR><BR>Aca editamos Radius<BR><BR>';
    }
    $out .= "<br><br><h3>" . _("IP addresses: ") . "</h3>";
    $frm_start = "<form action=\"?\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">";
    $q = "SELECT * FROM {$pro_mysql_dedicated_ips_table} WHERE dedicated_server_hostname='{$dedicated_server_hostname}'";
    $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    $out .= dtcFormTableAttrs();
    for ($i = 0; $i < $n; $i++) {
        $a = mysql_fetch_array($r);
        if ($i % 2) {
            $alt_color = 0;
        } else {
            $alt_color = 1;
        }
        $out .= dtcFormLineDraw($a["ip_addr"], "{$frm_start}<input type=\"hidden\" name=\"action\" value=\"set_dedicated_ip_rdns\">\n<input type=\"hidden\" name=\"ip_addr\" value=\"" . $a["ip_addr"] . "\">\n<input type=\"text\" name=\"rdns\" value=\"" . $a["rdns_addr"] . "\">\n</td><td><div class=\"input_btn_container\" onMouseOver=\"this.className='input_btn_container-hover';\" onMouseOut=\"this.className='input_btn_container';\">\n<div class=\"input_btn_left\"></div>\n<div class=\"input_btn_mid\"><input class=\"input_btn\" type=\"submit\" value=\"" . _("Change RDNS") . "\"></div>\n<div class=\"input_btn_right\"></div>\n</div></form>", $alt_color);
        /*		if($i > 0){
        			$out .= ", ";
        		}
        		$out .= $a["ip_addr"];*/
    }
    $out .= "</table>";
    return $out;
}
예제 #10
0
function drawAdminTools_DomainInfo($admin, $eddomain)
{
    global $adm_login;
    global $adm_pass;
    global $addrlink;
    global $dtcshared_path;
    global $conf_administrative_site;
    global $pro_mysql_domain_table;
    global $pro_mysql_whois_table;
    global $renew_return;
    global $secpayconf_currency_letters;
    $out = "";
    $webname = $eddomain["name"];
    get_secpay_conf();
    // Domain registration API stuffs
    $out .= "<br><h3>" . _("Registration:") . "</h3>";
    if ($eddomain["whois"] == "away") {
        $out .= _("Your domain is not registered here.");
    } else {
        $q = "SELECT * FROM {$pro_mysql_domain_table} WHERE name='{$webname}';";
        $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) {
            $out .= _("Cannot find your domain name registration information in the database.");
        } else {
            $a = mysql_fetch_array($r);
            // Domain renewals
            if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "renew_domain") {
                $out .= dtcFormTableAttrs();
                $out .= dtcFormLineDraw(_("Money on your account: "), $admin["client"]["dollar"] . " {$secpayconf_currency_letters}", 1);
                $tld = find_domain_extension($webname);
                $out .= dtcFormLineDraw(_("Type of extension: "), $tld, 0);
                $out .= dtcFormLineDraw(_("Renewal for how many years: "), $_REQUEST["num_years"], 1);
                $price = find_domain_price($tld);
                if ($price === FALSE) {
                    $out .= dtcFormLineDraw("", "<font color=\"red\">" . _("Price for the domain not found!") . "</font>", 0);
                    $out .= "</table>";
                } else {
                    $price = $_REQUEST["num_years"] * $price;
                    $out .= dtcFormLineDraw(_("Total price: "), $price . " {$secpayconf_currency_letters}", 0);
                    $remaining = $admin["client"]["dollar"] - $price;
                    $out .= dtcFormLineDraw(_("Balance after transaction: "), $remaining . " {$secpayconf_currency_letters}", 1);
                    if ($remaining < 0) {
                        $out .= dtcFormLineDraw("", "<font color=\"red\">" . _("Insufisant balance for the transaction, please go to \"My account\" and add money.") . "</font>", 0);
                        $out .= "</table>";
                    } else {
                        $out .= dtcFormLineDraw("", "<form action=\"" . $_SERVER["PHP_SELF"] . "\"><input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"edit_domain\" value=\"" . $webname . "\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"action\" value=\"registry_renew_domain\">\n<input type=\"hidden\" name=\"num_years\" value=\"" . $_REQUEST["num_years"] . "\">\n" . submitButtonStart() . _("Renew domain") . submitButtonEnd() . "</form>", 0);
                        $out .= "</table>";
                    }
                }
            } elseif (isset($_REQUEST["action"]) && $_REQUEST["action"] == "registry_renew_domain") {
                $out .= $renew_return["response_text"];
            } else {
                $out .= dtcFormTableAttrs();
                // Domain auth code
                $authcode = registry_get_auth_code($webname);
                if ($authcode === FALSE || $authcode["is_success"] != 1) {
                    $txt = _("Auth code retrival failed.");
                } else {
                    $txt = $authcode["response_text"];
                }
                $frm = "<form action=\"" . $_SERVER["PHP_SELF"] . "\"><input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"edit_domain\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"action\" value=\"renew_domain\">";
                $out .= dtcFormLineDraw(_("Registrar: ") . $frm, $a["registrar"], 1);
                $out .= dtcFormLineDraw(_("Creation date: "), $a["creation_date"], 0);
                $out .= dtcFormLineDraw(_("Last modification date: "), $a["modification_date"], 1);
                $out .= dtcFormLineDraw(_("Expiration date: "), $a["expiration_date"], 0);
                $out .= dtcFormLineDraw(_("Domain auth code: "), $txt, 1);
                $out .= dtcFormLineDraw("<select name=\"num_years\">\n<option value=\"1\">1</option>\n<option value=\"2\">2</option>\n<option value=\"3\">3</option>\n<option value=\"4\">4</option>\n<option value=\"5\">5</option>\n<option value=\"6\">6</option>\n<option value=\"7\">7</option>\n<option value=\"8\">8</option>\n<option value=\"9\">9</option>\n</select>" . _("year(s)"), submitButtonStart() . _("Renew domain") . submitButtonEnd() . "</form>", 0);
                $out .= "</table>";
            }
            // Domain protection
            if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "change_domain_protection") {
                switch ($_REQUEST["protection"]) {
                    case "unlocked":
                        $sel = "unlocked";
                        break;
                    case "transferprot":
                        $sel = "transferprot";
                        break;
                    default:
                    case "locked":
                        $sel = "locked";
                        break;
                }
                $ret = registry_set_domain_protection($webname, $sel);
                if ($ret != FALSE && $ret["is_success"] == 1) {
                    $q = "UPDATE {$pro_mysql_whois_table} SET protection='{$sel}' WHERE domain_name='{$webname}';";
                    $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . "sql said: " . mysql_error());
                    $a["protection"] = $sel;
                }
            }
            $frm = "<form action=\"" . $_SERVER["PHP_SELF"] . "\"><input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"edit_domain\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"action\" value=\"change_domain_protection\">";
            $out .= dtcFormTableAttrs();
            $unlck_sel = "";
            $trans_sel = "";
            $lockd_sel = "";
            switch ($a["protection"]) {
                case "unlocked":
                    $unlck_sel = " selected ";
                    break;
                case "transferprot":
                    $trans_sel = " selected ";
                    break;
                default:
                case "locked":
                    $lockd_sel = " selected ";
                    break;
            }
            $out .= dtcFormLineDraw(_("Domain protection: ") . $frm, "<select name=\"protection\">\n<option value=\"unlocked\" {$unlck_sel}>" . _("Domain name unlocked") . "</option>\n<option value=\"transferprot\" {$trans_sel}>" . _("Domain name transfer protected") . "</option>\n<option value=\"locked\" {$lockd_sel}>" . _("Domain name protected") . "</option>\n</select>", 1);
            $out .= dtcFormLineDraw("", submitButtonStart() . _("Set protection") . submitButtonEnd(), 0);
            $out .= "</form></table>";
        }
    }
    // End of domain registration API code
    // Retrive domain config
    $quota = $eddomain["quota"];
    $max_email = $eddomain["max_email"];
    $max_ftp = $eddomain["max_ftp"];
    $max_subdomain = $eddomain["max_subdomain"];
    $domain_parking = $eddomain["domain_parking"];
    $domain_parking_type = $eddomain["domain_parking_type"];
    $adm_path = $admin["info"]["path"];
    // Retrive disk usage
    //	$du_string = exec("du -sm $adm_path/$webname --exclude=access.log",$retval);
    //	$du_state = explode("\t",$du_string);
    //	$du = $du_state[0];
    // The upper version might be too slow and give a bad feeling to the user. This one should be a lot better:
    $du_stat = $eddomain["du_stat"];
    $du = $du_stat;
    // Retrive number of mailbox
    if (isset($eddomain["emails"])) {
        $email_nbr = sizeof($eddomain["emails"]);
    } else {
        $email_nbr = 0;
    }
    // Retrive number of ftp account
    if (isset($eddomain["ftps"])) {
        $ftp_nbr = sizeof($eddomain["ftps"]);
    } else {
        $ftp_nbr = 0;
    }
    // Retrive number of ftp account
    $subdomain_nbr = sizeof($eddomain["subdomains"]);
    $total_http_transfer = fetchHTTPInfo($webname);
    $total_ftp_transfer = fetchFTPInfo($webname);
    $total_pop_transfer = fetchPOPInfo($webname);
    $total_imap_transfer = fetchIMAPInfo($webname);
    $total_smtp_transfer = fetchSMTPInfo($webname);
    $total_transfer = smartByte($total_http_transfer + $total_ftp_transfer + $total_smtp_transfer + $total_pop_transfer + $total_imap_transfer);
    $out .= "<br><h3>" . _("Your domain usage and quota:") . "</h3>\n\t" . _("Total transfered bytes this month:") . " {$total_transfer}<br>\n\t" . _("Your area disk usage:") . " " . smartByte($du) . " / {$quota} MBytes<br>\n\t" . _("Mailboxes:") . " {$email_nbr} / {$max_email}<br>\n\t" . _("FTP accounts:") . " {$ftp_nbr} / {$max_ftp}<br>\n\t" . _("Subdomains:") . " {$subdomain_nbr} / {$max_subdomain}<br><br>";
    $out .= "<h3>" . _("Preview URL:") . "</h3>\n\t" . _("Use") . " http(s)://" . $conf_administrative_site . "/www." . $_REQUEST["addrlink"] . " " . _("aliasing") . ":";
    if ($eddomain["gen_unresolved_domain_alias"] == "yes") {
        $radio_yes = " checked";
        $radio_no = "";
    } else {
        $radio_no = " checked";
        $radio_yes = "";
    }
    $out .= "<form action=\"" . $_SERVER["PHP_SELF"] . "\"><input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"edit_domain\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"radio\" name=\"domain_gen_unresolv_alias\" value=\"yes\"{$radio_yes}>" . _("Yes") . "\n<input type=\"radio\" name=\"domain_gen_unresolv_alias\" value=\"no\"{$radio_no}>" . _("No") . "\n<input type=\"hidden\" name=\"change_unresolv_alias\" value=\"Ok\"><br>" . submitButtonStart() . _("Ok") . submitButtonEnd() . "</form><br><br>";
    $out .= "<h3>" . _("Domain parking:") . "</h3>";
    $out .= _("This domain will be the alias of the following domain (domain parking):");
    $out .= "<form action=\"" . $_SERVER["PHP_SELF"] . "\"><input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"edit_domain\" value=\"" . $_REQUEST["addrlink"] . "\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"set_domain_parcking\" value=\"Ok\">\n<select name=\"domain_parking_value\">\n<option value=\"no-parking\">" . _("No parking") . "</option>\n";
    $q = "SELECT name FROM {$pro_mysql_domain_table} WHERE owner='{$adm_login}' AND domain_parking='no-parking' AND name NOT LIKE '" . $_REQUEST["addrlink"] . "';";
    $r = mysql_query($q) or die("Cannot query \"{$q}\" line " . __LINE__ . " in file " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    for ($i = 0; $i < $n; $i++) {
        $a = mysql_fetch_array($r);
        if ($domain_parking == $a["name"]) {
            $checked = " selected ";
        } else {
            $checked = "";
        }
        $out .= "<option value=\"" . $a["name"] . "\"{$checked}>" . $a["name"] . "</option>";
    }
    $out .= "</select><br>";
    $redirect_selected = " ";
    $same_docroot_selected = " ";
    $serveralias_selected = " ";
    switch ($domain_parking_type) {
        case "redirect":
            $redirect_selected = " checked ";
            break;
        case "same_docroot":
            $same_docroot_selected = " checked ";
            break;
        case "serveralias":
            $serveralias_selected = " checked ";
            break;
    }
    $out .= "<input type=\"radio\" name=\"domain_parking_type\" value=\"redirect\" {$redirect_selected}>" . _("Redirection") . " ";
    $out .= "<input type=\"radio\" name=\"domain_parking_type\" value=\"same_docroot\" {$same_docroot_selected}>" . _("Same DocumentRoot") . " ";
    $out .= "<input type=\"radio\" name=\"domain_parking_type\" value=\"serveralias\" {$serveralias_selected}>" . _("ServerAlias") . " ";
    $out .= "<br>" . submitButtonStart() . _("Ok") . submitButtonEnd() . "</form><br><br>";
    $out .= "<h3>" . _("Domain configuration backup:") . "</h3>";
    $out .= "<a href=\"?adm_login={$adm_login}&adm_pass={$adm_pass}&action=export_domain&addrlink=" . $_REQUEST["addrlink"] . "\" target=\"_blank\">" . _("Export this domain to a file") . "</a>";
    $out .= "<br><br>" . helpLink("UserDoc/Domain-General-Config");
    return $out;
}
예제 #11
0
function configEditorTemplate($dsc, $conftype = "config")
{
    global $pro_mysql_config_table;
    global $pro_mysql_secpayconf_table;
    $out = "";
    if ($conftype == "config") {
        $sql_table = $pro_mysql_config_table;
        $prefix = "conf_";
    } else {
        $sql_table = $pro_mysql_secpayconf_table;
        $prefix = "secpayconf_";
    }
    $keys = array_keys($dsc["cols"]);
    $n = sizeof($keys);
    // Do the sql stuff here!
    if (isset($_REQUEST["action"]) && $_REQUEST["action"] == $dsc["action"]) {
        $vals = "";
        for ($i = 0; $i < $n; $i++) {
            if ($i != 0) {
                $vals .= ", ";
            }
            if (!isset($_REQUEST[$keys[$i]])) {
                $_REQUEST[$keys[$i]] = "";
            }
            if (!is_array($_REQUEST[$keys[$i]])) {
                $my_value = $_REQUEST[$keys[$i]];
            } else {
                $my_value = join(",", $_REQUEST[$keys[$i]]);
            }
            $vals .= $keys[$i] . "='" . $my_value . "'";
        }
        $q = "UPDATE {$sql_table} SET {$vals} WHERE 1;";
        $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " mysql said: " . mysql_error());
    }
    if (isset($dsc["edit_callback"])) {
        $dsc["edit_callback"]();
    }
    if ($conftype == "config") {
        getConfig();
    } else {
        get_secpay_conf();
    }
    $out .= "<h3>" . $dsc["title"] . "</h3>";
    if (isset($dsc["desc"])) {
        $out .= $dsc["desc"] . "<br><br>";
    }
    $nbr_forwards = sizeof($dsc["forward"]);
    $fw = "";
    for ($i = 0; $i < $nbr_forwards; $i++) {
        $fw .= "<input type=\"hidden\" name=\"" . $dsc["forward"][$i] . "\" value=\"" . $_REQUEST[$dsc["forward"][$i]] . "\">";
    }
    $out .= dtcFormTableAttrs();
    $out .= "<form action=\"" . $_SERVER["PHP_SELF"] . "\">\n<input type=\"hidden\" name=\"action\" value=\"" . $dsc["action"] . "\">{$fw}";
    for ($i = 0; $i < $n; $i++) {
        $fld = $prefix . $keys[$i];
        global ${$fld};
        if ($i % 2 == 1) {
            $input_class = "dtcDatagrid_input_alt_color";
        } else {
            $input_class = "dtcDatagrid_input_color";
        }
        switch ($dsc["cols"][$keys[$i]]["type"]) {
            case "radio":
                $nb_choices = sizeof($dsc["cols"][$keys[$i]]["values"]);
                $control = "";
                for ($j = 0; $j < $nb_choices; $j++) {
                    if (${$fld} == $dsc["cols"][$keys[$i]]["values"][$j]) {
                        $selected = " checked ";
                    } else {
                        $selected = "";
                    }
                    if (isset($dsc["cols"][$keys[$i]]["display_replace"][$j])) {
                        $text = $dsc["cols"][$keys[$i]]["display_replace"][$j];
                    } else {
                        $text = $dsc["cols"][$keys[$i]]["values"][$j];
                    }
                    $control .= "<input type=\"radio\" name=\"" . $keys[$i] . "\" value=\"" . $dsc["cols"][$keys[$i]]["values"][$j] . "\" {$selected}> {$text}";
                }
                break;
            case "popup":
                $nb_choices = sizeof($dsc["cols"][$keys[$i]]["values"]);
                $control = "";
                for ($j = 0; $j < $nb_choices; $j++) {
                    if (${$fld} == $dsc["cols"][$keys[$i]]["values"][$j]) {
                        $selected = " selected ";
                    } else {
                        $selected = "";
                    }
                    if (isset($dsc["cols"][$keys[$i]]["display_replace"][$j])) {
                        $text = $dsc["cols"][$keys[$i]]["display_replace"][$j];
                    } else {
                        $text = $dsc["cols"][$keys[$i]]["values"][$j];
                    }
                    $control .= "<option value=\"" . $dsc["cols"][$keys[$i]]["values"][$j] . "\" {$selected}>{$text}</option>";
                }
                $control = "<select class=\"{$input_class}\" name=\"" . $keys[$i] . "\">" . $control . "</select>";
                break;
            case "checkboxcomma":
                $nb_choices = sizeof($dsc["cols"][$keys[$i]]["values"]);
                $control = "";
                $arr_values = split(",", ${$fld});
                $cntchk = 0;
                for ($j = 0; $j < $nb_choices; $j++) {
                    if (in_array($dsc["cols"][$keys[$i]]["values"][$j], $arr_values)) {
                        $selected = " checked ";
                    } else {
                        $selected = "";
                    }
                    if (isset($dsc["cols"][$keys[$i]]["display_replace"][$j])) {
                        $text = $dsc["cols"][$keys[$i]]["display_replace"][$j];
                    } else {
                        $text = $dsc["cols"][$keys[$i]]["values"][$j];
                    }
                    $control .= "<input type=\"checkbox\" name=\"" . $keys[$i] . "[]\" value=\"" . $dsc["cols"][$keys[$i]]["values"][$j] . "\" {$selected}> {$text}\n";
                    if ($cntchk > 3) {
                        $control .= "<br />";
                        $cntchk = 0;
                    }
                    $cntchk++;
                }
                break;
            case "textarea":
                if (isset($dsc["cols"][$keys[$i]]["cols"])) {
                    $cols = " cols=\"" . $dsc["cols"][$keys[$i]]["cols"] . "\" ";
                } else {
                    $cols = "";
                }
                if (isset($dsc["cols"][$keys[$i]]["rows"])) {
                    $rows = " rows=\"" . $dsc["cols"][$keys[$i]]["rows"] . "\" ";
                } else {
                    $rows = "";
                }
                $control = "<textarea class=\"{$input_class}\" {$cols} {$rows} name=\"" . $keys[$i] . "\">" . ${$fld} . "</textarea>";
                break;
            case "text":
            default:
                if (isset($dsc["cols"][$keys[$i]]["size"])) {
                    $size = " size=\"" . $dsc["cols"][$keys[$i]]["size"] . "\" ";
                } else {
                    $size = "";
                }
                $control = "<input class=\"{$input_class}\" {$size} type=\"text\" name=\"" . $keys[$i] . "\" value=\"" . ${$fld} . "\">";
                break;
        }
        $out .= dtcFormLineDraw($dsc["cols"][$keys[$i]]["legend"], $control, !($i % 2));
    }
    $out .= dtcFromOkDraw() . "</form></table>";
    return $out;
}
예제 #12
0
function drawAdminTools_MyAccount($admin)
{
    global $PHP_SELF;
    global $adm_login;
    global $adm_pass;
    global $addrlink;
    global $dtcshared_path;
    global $pro_mysql_pay_table;
    global $pro_mysql_client_table;
    global $pro_mysql_ssl_ips_table;
    global $pro_mysql_product_table;
    global $secpayconf_currency_letters;
    global $cc_code_array;
    get_secpay_conf();
    $frm_start = "<form action=\"{$PHP_SELF}\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n";
    $out = "";
    $id_client = $admin["info"]["id_client"];
    $stats = fetchAdminStats($admin);
    if (isset($_REQUEST["action"]) && $id_client != 0 && $_REQUEST["action"] == "upgrade_myaccount") {
        return draw_UpgradeAccount($admin);
    }
    if (isset($_REQUEST["action"]) && $id_client != 0 && $_REQUEST["action"] == "refund_myaccount") {
        if (isset($_REQUEST["inneraction"]) && $_REQUEST["inneraction"] == "return_from_paypal_refund_my_account") {
            $ze_refund = isPayIDValidated(addslashes($_REQUEST["payid"]));
            if ($ze_refund == 0) {
                $out .= "<font color=\"red\">The transaction failed, please try again!</font>";
                return $out;
            } else {
                $out .= "<font color=\"green\">Funds added to your account!</font><br><br>";
                $q = "UPDATE {$pro_mysql_client_table} SET dollar = dollar+" . $ze_refund . " WHERE id='" . $admin["info"]["id_client"] . "';";
                $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
                $admin["client"]["dollar"] += $ze_refund;
                $out .= "Your account now has \$" . $admin["client"]["dollar"];
                return $out;
            }
        } else {
            $payid = createCreditCardPaiementID(addslashes($_REQUEST["refund_amount"]), $admin["info"]["id_client"], "Refund my account", "no");
            $return_url = $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}" . "&addrlink={$addrlink}&action=refund_myaccount&inneraction=return_from_paypal_refund_my_account&payid={$payid}";
            $paybutton = paynowButton($payid, addslashes($_REQUEST["refund_amount"]), "Refund my account", $return_url);
            $out .= "<b><u>Pay \$" . $_REQUEST["refund_amount"] . " on my account:</u></b><br>";
            $out .= " Please click on the button below to pay your acount.<br><br>{$paybutton}";
            return $out;
        }
    }
    if ($id_client != 0) {
        $client = $admin["client"];
    }
    if (isset($admin["data"])) {
        $out .= "<br><h3>" . _("Transfer and disk usage:") . "</h3>";
        // Draw overall this month usage
        // if there is no usage, set to 0
        if (!isset($stats["total_transfer"])) {
            $stats["total_transfer"] = 0;
        }
        $overall = "<br>" . _("Transfer this month:") . smartByte($stats["total_transfer"]);
        if ($id_client != 0) {
            $bw_quota = $admin["info"]["bandwidth_per_month_mb"] * 1024 * 1024;
            $overall .= " / " . smartByte($bw_quota) . "<br>";
            $overall .= drawPercentBar($stats["total_transfer"], $bw_quota);
        }
        $overall .= "<br>" . _("Total disk usage:") . smartByte($stats["total_du"]);
        if ($id_client != 0 && isset($admin["data"])) {
            $du_quota = $admin["info"]["quota"] * 1024 * 1024;
            $overall .= " / " . smartByte($du_quota) . "<br>";
            $overall .= drawPercentBar($stats["total_du"], $du_quota);
        }
        if ($id_client != 0) {
            $out .= '<table><td>' . $overall . '</td><td><img src="bw_per_month.php?cid=' . $id_client . '&adm_login='******'"></td></tr></table>';
        } else {
            $out .= $overall;
        }
    }
    $out .= "<h3>" . _("Export configuration:") . "</h3>";
    $out .= "<a href=\"?adm_login={$adm_login}&adm_pass={$adm_pass}&action=export_my_account&addrlink=" . $_REQUEST["addrlink"] . "\" target=\"_blank\">" . _("Export all my domains configuration to a file") . "</a>";
    if ($id_client != 0) {
        // If the customer has domains (he could have only a VPS...).
        if (isset($admin["data"])) {
            $out .= "<br><h3>" . _("Your hosting account:") . "</h3>";
            $out .= "<table width=\"100%\" height=\"1\" cellpadding=\"4\" cellspacing=\"0\" border=\"1\">\n<tr>\n\t<td><b>" . _("Storage space") . "</b></td><td><b>" . _("Allowed bandwidth per month") . "</b></td><td><b>" . _("Expiry date") . "</b></td>\n</tr>\n<tr>\n\t<td>" . smartByte($du_quota) . "</td><td>" . smartByte($bw_quota) . "</td><td>" . $admin["info"]["expire"] . "</td>\n</tr>\n</table>";
            if (file_exists($dtcshared_path . "/dtcrm")) {
                $out .= "<br><center>{$frm_start}<input type=\"hidden\" name=\"action\" value=\"upgrade_myaccount\">\n<input type=\"submit\" value=\"" . _("Upgrade my account") . "\">\n</form>";
                $out .= "<form action=\"/dtc/new_account.php\">\n<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">\n<input type=\"hidden\" name=\"renew_type\" value=\"shared\">\n<input type=\"hidden\" name=\"product_id\" value=\"" . $admin["info"]["prod_id"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"client_id\" value=\"{$id_client}\">\n<input type=\"submit\" value=\"" . _("Renew my account") . "\">\n</form></center><br>";
            }
            $out .= "<h3>" . _("SSL tokens") . "</h3><br>";
            $q = "SELECT * FROM {$pro_mysql_ssl_ips_table} WHERE adm_login='******' AND available='no';";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n == 0) {
                $out .= _("You currently don't have any SSL tokens.") . "<br><br>";
            } else {
                $out .= "<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\">";
                $out .= "<tr><td>" . _("IP address") . "</td><td>" . _("Used by") . "</td><td>" . _("Expire") . "</td><td>" . _("Action") . "</td></tr>";
                for ($i = 0; $i < $n; $i++) {
                    $a = mysql_fetch_array($r);
                    $nbr_domains = sizeof($admin["data"]);
                    $used_by = "Not used";
                    for ($j = 0; $j < $nbr_domains; $j++) {
                        $nbr_subdomains = sizeof($admin["data"][$j]["subdomains"]);
                        for ($k = 0; $k < $nbr_subdomains; $k++) {
                            if ($admin["data"][$j]["subdomains"][$k]["ssl_ip"] == $a["ip_addr"]) {
                                $used_by = $admin["data"][$j]["subdomains"][$k]["name"] . "." . $admin["data"][$j]["name"];
                            }
                        }
                    }
                    $q = "SELECT * FROM {$pro_mysql_product_table} WHERE heb_type='ssl';";
                    $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) {
                        $ssl_renew_form = _("No ssl product defined.");
                    } else {
                        $prod = mysql_fetch_array($r);
                        $ssl_renew_form = "<form action=\"/dtc/new_account.php\">\n<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">\n<input type=\"hidden\" name=\"renew_type\" value=\"ssl_renew\">\n<input type=\"hidden\" name=\"ssl_ip_id\" value=\"" . $a["id"] . "\">\n<input type=\"hidden\" name=\"product_id\" value=\"" . $prod["id"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"client_id\" value=\"{$id_client}\">\n<input type=\"submit\" value=\"Renew SSL IP\"></form>";
                    }
                    $out .= "<tr><td>" . $a["ip_addr"] . "</td><td>{$used_by}</td><td>" . $a["expire"] . "</td><td>{$ssl_renew_form}</td></tr>";
                }
                $out .= "</table><br><br>";
            }
            $q = "SELECT * FROM {$pro_mysql_ssl_ips_table} WHERE available='yes';";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $n = mysql_num_rows($r);
            if ($n == 0) {
                $out .= _("No SSL token available: contact your administrator to request it.") . "<br><br>";
            } else {
                $q = "SELECT * FROM {$pro_mysql_product_table} WHERE heb_type='ssl';";
                $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) {
                    $out .= _("No ssl product defined.");
                } else {
                    $prod = mysql_fetch_array($r);
                    $out .= "<form action=\"/dtc/new_account.php\">\n<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">\n<input type=\"hidden\" name=\"renew_type\" value=\"ssl\">\n<input type=\"hidden\" name=\"product_id\" value=\"" . $prod["id"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"client_id\" value=\"{$id_client}\">\n<input type=\"submit\" value=\"Buy an SSL IP\">\n</form></center><br>";
                }
            }
            $out .= "<h3>" . _("Remaining money on my account:") . "</h3>";
            $out .= dtcFormTableAttrs();
            $out .= dtcFormLineDraw(_("Money remaining: "), $client["dollar"] . " {$secpayconf_currency_letters}", 1);
            $out .= dtcFormLineDraw(_("Refund my account:"), "{$frm_start}<input type=\"hidden\" name=\"action\" value=\"refund_myaccount\">\n<input size=\"8\" type=\"text\" name=\"refund_amount\" value=\"\"> {$secpayconf_currency_letters}", 0);
            $out .= dtcFormLineDraw("", submitButtonStart() . _("Add money") . submitButtonEnd() . "</form>", 1);
            $out .= "</table>";
        }
        $out .= "<h3>" . _("Your address (please tell us if the following is not correct):") . "</h3>";
        if ($client["is_company"] == "yes") {
            $out .= _("Company name:") . $client["company_name"] . "<br>";
            $out .= _("VAT / GST number:") . $client["vat_num"] . "<br>";
        }
        $out .= _("First name:") . $client["christname"] . "<br>";
        $out .= _("Family name:") . $client["familyname"] . "<br>";
        $out .= _("Address:") . $client["addr1"] . "<br>";
        $out .= $client["addr2"] . "<br>";
        $out .= _("Zipcode:") . $client["zipcode"] . "<br>";
        $out .= _("City:") . $client["city"] . "<br>";
        $out .= _("State:") . $client["state"] . "<br>";
        $out .= _("Country:") . $cc_code_array[$client["country"]] . "<br>";
        $out .= _("Phone number:") . $client["phone"] . "<br>";
        $out .= _("Fax:") . $client["fax"] . "<br>";
        $out .= _("Email:") . $client["email"] . "<br>";
        $sql = "SELECT SUM(kickback) as kickbacks FROM affiliate_payments WHERE adm_login = '******' and date_paid IS NULL; ";
        $result = mysql_query($sql);
        $row = mysql_fetch_array($result);
        $afftotal = $row["kickbacks"];
        if ($afftotal) {
            global $pro_mysql_completedorders_table;
            $sql = "SELECT * FROM affiliate_payments INNER JOIN {$pro_mysql_completedorders_table} on (affiliate_payments.order_id = {$pro_mysql_completedorders_table}.id) WHERE adm_login = '******' and date_paid IS NULL; ";
            $result = mysql_query($sql);
            $out .= "" . _("Outstanding payments:") . "<br><table><tr><th>" . _("Date") . "</th><th>" . _("Amount") . "</th></tr>";
            while ($row = mysql_fetch_array($result)) {
                $out .= "<tr><td>{$row['date']}</td><td>{$row['kickback']}</td></tr>";
            }
            $out .= "<tr><td></td><th>{$afftotal}</th></tr>";
            $out .= "</table>";
        }
        $out .= "<h3>" . _("Affiliation") . "</h3>";
        $out .= _("If you want to earn money, all you have to do is place a link on your site, pointing to:") . "<pre>https://{$_SERVER['SERVER_NAME']}/dtc/affiliation.php?affiliate={$adm_login}&amp;return=/hosting-vps.html</pre>" . _("You can customize the <code>return</code> variable to redirect the user to any particular landing page that exists on our Web site (though we recommend the product page as per the example).  Then, when one of your visitors clicks on that link to buy a product from us, he will be redirected to our Web site.  Once he buys, you will automatically be credited a payment depending on the product that your visitor bought.");
    } else {
        $out .= "<br>" . _("You do not have a client account, so there is no money in your account.");
    }
    return $out;
}
예제 #13
0
function validatePaiement($pay_id, $amount_paid, $paiement_type, $secpay_site = "none", $secpay_custom_id = "0", $total_payed = -1)
{
    global $pro_mysql_pay_table;
    global $conf_webmaster_email_addr;
    global $pro_mysql_new_admin_table;
    global $secpayconf_maxmind_threshold;
    global $secpayconf_currency_letters;
    global $conf_message_subject_header;
    if (!isset($secpayconf_currency_letters)) {
        get_secpay_conf();
    }
    $q = "SELECT * FROM {$pro_mysql_pay_table} WHERE id='{$pay_id}';";
    logPay("Querying: {$q}");
    $r = mysql_query($q) or die(logPay("Cannot query \"{$q}\" ! " . mysql_error() . " in file " . __FILE__ . " line " . __LINE__));
    $n = mysql_num_rows($r);
    if ($n != 1) {
        die(logPay("Pay id {$pay_id} not found in file " . __FILE__ . " line " . __LINE__));
    }
    $ar = mysql_fetch_array($r);
    if ($ar["valid"] != "no" && $ar["valid"] != "pending") {
        die(logPay("Paiement already validated in file " . __FILE__ . " line " . __LINE__));
    }
    logPay("Ammount paid: {$amount_paid}");
    // Ensure the amt paid is inclusive of tax
    $payable_amt = $ar["refund_amount"] + $ar["refund_amount"] * ($ar["vat_rate"] / 100);
    // Round the amount to the nearest 2 decimals
    $payable_amt = round($payable_amt, 2);
    if ($amount_paid < $payable_amt) {
        die(logPay("Amount paid on gateway lower than refund ammount file " . __FILE__ . " line " . __LINE__));
    }
    if ($total_payed != -1) {
        $cost = $total_payed - $amount_paid;
        $total = $total_payed;
    } else {
        $cost = $amount_paid - $ar["refund_amount"];
        $total = $amount_paid;
    }
    $new_account_array;
    if ($ar["new_account"] == "yes") {
        $q = "SELECT * FROM {$pro_mysql_new_admin_table} WHERE paiement_id='" . $ar["id"] . "';";
        $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
        $new_account_array = mysql_fetch_array($r);
    }
    $maxmind_hash = unserialize($new_account_array["maxmind_output"]);
    $maxmind_score = $maxmind_hash["riskScore"];
    if ($maxmind_score >= $secpayconf_maxmind_threshold) {
        $q = "UPDATE {$pro_mysql_pay_table} SET paiement_type='{$paiement_type}',\n\t\t\tsecpay_site='{$secpay_site}',paiement_cost='{$cost}',paiement_total='{$total}',\n\t\t\tvalid_date='" . date("Y-m-j") . "', valid_time='" . date("H:i:s") . "',\n\t\t\tsecpay_custom_id='{$secpay_custom_id}',valid='pending',pending_reason='MaxMind' WHERE id='{$pay_id}';";
    } else {
        $q = "UPDATE {$pro_mysql_pay_table} SET paiement_type='{$paiement_type}',\n\t\tsecpay_site='{$secpay_site}',paiement_cost='{$cost}',paiement_total='{$total}',\n\t\tvalid_date='" . date("Y-m-j") . "', valid_time='" . date("H:i:s") . "',\n\t\tsecpay_custom_id='{$secpay_custom_id}',valid='yes' WHERE id='{$pay_id}';";
    }
    logPay($q);
    mysql_query($q) or die(logPay("Cannot query \"{$q}\" ! " . mysql_error() . " in file " . __FILE__ . " line " . __LINE__));
    $txt_userwaiting_account_activated_subject = "{$conf_message_subject_header} " . $amount_paid . " {$secpayconf_currency_letters} payment occured";
    if ($ar["new_account"] == "yes") {
        $a = $new_account_array;
        $added_comments = "Login: "******"reqadm_login"] . "\nEmail: " . $a["email"] . "\nCompany: " . $a["comp_name"] . "\nCustomer: " . $a["first_name"] . ", " . $a["family_name"] . "\nCity: " . $a["city"] . "\nCountry: " . $a["country"] . "";
    } else {
        $added_comments = "";
    }
    $txt_mail = "Hello,\n\nThis is Domain Technologie Control panel robot.\nA " . $amount_paid . " {$secpayconf_currency_letters} payment has just occured.\n\nPayid: " . $pay_id . "\n{$added_comments}\n\nGPLHost:>_ Open-source hosting worldwide.\nhttp://www.gplhost.com\n";
    $headers = "From: " . $conf_webmaster_email_addr;
    mail($conf_webmaster_email_addr, $txt_userwaiting_account_activated_subject, $txt_mail, $headers);
}
예제 #14
0
function drawNameTransfer($admin, $given_fqdn = "none")
{
    global $adm_login;
    global $adm_pass;
    global $addrlink;
    global $registration_added_price;
    global $pro_mysql_domain_table;
    global $pro_mysql_client_table;
    global $registry_api_modules;
    global $form_enter_dns_infos;
    global $form_enter_auth_code;
    global $whois_forwareded_params;
    global $secpayconf_currency_letters;
    global $allTLD;
    get_secpay_conf();
    $out = "";
    if (isset($_REQUEST["toreg_domain"])) {
        $toreg_domain = $_REQUEST["toreg_domain"];
    }
    if (isset($_REQUEST["toreg_extention"])) {
        $toreg_extention = $_REQUEST["toreg_extention"];
    }
    if ($given_fqdn != "none" && !isset($toreg_extention)) {
        $c = strrpos($given_fqdn, ".");
        $toreg_extention = find_domain_extension($given_fqdn);
        $toreg_domain = str_replace($toreg_extention, "", $given_fqdn);
        # echo "extension: $toreg_extention    domain: $toreg_domain<br />";
    }
    // Step 1: enter domain name and check domain transferability
    $form_start = "<form action=\"" . $_SERVER["PHP_SELF"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n<input type=\"hidden\" name=\"dtcrm_action\" value=\"transfer_domain\">\n<input type=\"hidden\" name=\"add_regortrans\" value=\"transfer\">\n<input type=\"hidden\" name=\"add_domain_type\" value=\"" . $_REQUEST["add_domain_type"] . "\">\n";
    $out .= "<br><h3>" . _("Transfer from another registrar to this server:") . "</h3>\n<i><u>" . _("Step1: check if domain is transferable") . "</u></i>";
    # echo "Checking1 $toreg_domain$toreg_extention<br />";
    if (!isset($toreg_extention) || $toreg_extention == "" || !isset($toreg_domain) || $toreg_domain == "" || $toreg_extention != ".com" && $toreg_extention != ".net" && $toreg_extention != ".org" && $toreg_extention != ".biz" && $toreg_extention != ".name" && $toreg_extention != ".info" && $toreg_extention != ".co.uk") {
        $out .= "{$form_start}<br>\n" . _("Please enter the domain name you wish to transfer:") . "<br>\n" . make_registration_tld_popup();
        return $out;
    }
    $form_start .= "<input type=\"hidden\" name=\"toreg_domain\" value=\"{$toreg_domain}\">\n<input type=\"hidden\" name=\"toreg_extention\" value=\"{$toreg_extention}\">";
    $regz = registry_check_transfer($toreg_domain . $toreg_extention);
    # echo "Checking2 $toreg_domain$toreg_extention<br />";
    if ($regz["is_success"] != 1) {
        die("<font color=\"red\">" . _("TRANSFER CHECK FAILED: registry server didn't reply successfuly.") . "</font>");
    }
    if ($regz["attributes"]["transferrable"] != 1) {
        $out .= "<br><font color=\"red\">" . _("TRANSFER CHECK FAILED") . "</font><br>\n" . _("Server said: ") . $regz["attributes"]["reason"] . "<br>\n{$form_start}<br>\n" . _("Please enter the domain name you wish to transfer:") . "<br>\n" . make_registration_tld_popup();
        return $out;
    }
    $out .= "<br><font color=\"green\">" . _("TRANSFER CHECK SUCCESSFUL") . "</font><br><br>";
    // Step 2: enter whois infos
    $out .= "<i><u>" . _("Step 2: select contacts for domain transfer") . "</u></i><br>";
    if (!isset($_REQUEST["dtcrm_owner_hdl"]) || $_REQUEST["dtcrm_owner_hdl"] == "" || !isset($_REQUEST["dtcrm_admin_hdl"]) || $_REQUEST["dtcrm_admin_hdl"] == "" || !isset($_REQUEST["dtcrm_billing_hdl"]) || $_REQUEST["dtcrm_billing_hdl"] == "" || !isset($_REQUEST["toreg_dns1"]) || $_REQUEST["toreg_dns1"] == "" || !isset($_REQUEST["toreg_dns2"]) || $_REQUEST["toreg_dns2"] == "") {
        $out .= $form_start . whoisHandleSelection($admin);
        $out .= $form_enter_dns_infos;
        $out .= $form_enter_auth_code;
        $out .= "<br>" . submitButtonStart() . _("Proceed to transfer") . submitButtonEnd() . "</form>";
        return $out;
    }
    $form_start .= $whois_forwareded_params;
    $out .= "DNS1: " . $_REQUEST["toreg_dns1"] . "<br>";
    $out .= "DNS2: " . $_REQUEST["toreg_dns2"] . "<br><br>";
    $fqdn = $toreg_domain . $toreg_extention;
    $fqdn_price = $price = find_domain_price($toreg_extention);
    if ($admin["info"]["id_client"] != 0) {
        $remaining = $admin["client"]["dollar"];
    } else {
        $out .= _("You don't have a client ID. Please contact us.");
        $remaining = 0;
        return $out;
    }
    // Step 3: check account balance and transfer the domain name after transaction aprooval
    $out .= "<i><u>Step3: Proceed for transfer</u></i><br>";
    $out .= _("Remaining on your account: ") . " " . $remaining . " {$secpayconf_currency_letters}<br>\n" . _("Total price: ") . " " . $fqdn_price . " {$secpayconf_currency_letters}<br><br>";
    if (!isset($_REQUEST["authcode"])) {
        $out .= $form_enter_auth_code;
    } else {
        $out .= "Auth Code:" . " " . $_REQUEST["authcode"] . "<br />";
    }
    if (isset($_REQUEST["inner_action"]) && $_REQUEST["inner_action"] == "return_from_paypal_domain_add") {
        $ze_refund = isPayIDValidated(addslashes($_REQUEST["pay_id"]));
        if ($ze_refund == 0) {
            $out .= "<font color=\"red\">" . _("The transaction failed, please try again!") . "</font>";
        } else {
            $out .= "<font color=\"green\">" . _("Your account has been credited!") . "</font><br>";
            $q = "UPDATE {$pro_mysql_client_table} SET dollar = dollar+" . $ze_refund . " WHERE id='" . $admin["info"]["id_client"] . "';";
            $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
            $remaining += $ze_refund;
        }
    }
    if ($fqdn_price > $remaining) {
        $payid = createCreditCardPaiementID($fqdn_price, $admin["info"]["id_client"], "Domain name registration " . $_REQUEST["toreg_extention"], "no");
        $return_url = $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}" . "&addrlink={$addrlink}&add_domain_type=" . $_REQUEST["add_domain_type"] . "&add_regortrans=" . $_REQUEST["add_regortrans"] . "&toreg_domain=" . $_REQUEST["toreg_domain"] . "&toreg_extention=" . $_REQUEST["toreg_extention"] . "&dtcrm_owner_hdl=" . $_REQUEST["dtcrm_owner_hdl"] . "&dtcrm_admin_hdl=" . $_REQUEST["dtcrm_admin_hdl"] . "&dtcrm_billing_hdl=" . $_REQUEST["dtcrm_billing_hdl"] . "&toreg_dns1=" . $_REQUEST["toreg_dns1"] . "&toreg_dns2=" . $_REQUEST["toreg_dns2"] . "&toreg_dns3=" . $_REQUEST["toreg_dns3"] . "&toreg_dns4=" . $_REQUEST["toreg_dns4"] . "&toreg_dns5=" . $_REQUEST["toreg_dns5"] . "&toreg_dns6=" . $_REQUEST["toreg_dns6"] . "&toreg_period=1&inner_action=return_from_paypal_domain_add&payid={$payid}";
        if (isset($_REQUEST["action"])) {
            $return_url .= "&action=" . $_REQUEST["action"];
        }
        if (isset($_REQUEST["dtcrm_action"])) {
            $return_url .= "&dtcrm_action=" . $_REQUEST["dtcrm_action"];
        }
        $paybutton = paynowButton($payid, $fqdn_price, "Domain name registration " . $_REQUEST["toreg_extention"], $return_url);
        $out .= _("You currently don't have enough funds on your account. You will be redirected to our payment system. Please click on the button below to pay.") . "<br><br>\n{$paybutton}";
        return $out;
    }
    // Check for confirmation
    if (!isset($_REQUEST["toreg_confirm_transfert"]) || $_REQUEST["toreg_confirm_transfert"] != "yes") {
        $out .= _("You have enough funds on your account to proceed with transfert. Press the confirm button to proceed.") . "<br><br>\n{$form_start}\n<input type=\"hidden\" name=\"toreg_confirm_transfert\" value=\"yes\">\n<input type=\"hidden\" name=\"authcode\" value=\"" . $_REQUEST['authcode'] . "\">\n" . submitButtonStart() . _("Proceed to name-transfert") . submitButtonEnd() . "\n</form>";
        return $out;
    }
    ///////////////////////////////////////
    // START OF DOMAIN NAME TRANSFERT //
    $owner_id = $_REQUEST["dtcrm_owner_hdl"];
    $billing_id = $_REQUEST["dtcrm_billing_hdl"];
    $admin_id = $_REQUEST["dtcrm_admin_hdl"];
    $teck_id = $_REQUEST["dtcrm_teck_hdl"];
    $authcode = $_REQUEST["authcode"];
    $contacts = getContactsArrayFromID($owner_id, $billing_id, $admin_id, $teck_id);
    $dns_servers = array();
    for ($i = 1; $i < 7; $i++) {
        if (isset($_REQUEST["toreg_dns{$i}"]) && isHostname($_REQUEST["toreg_dns{$i}"])) {
            $dns_servers[] = $_REQUEST["toreg_dns{$i}"];
        } else {
            if ($i == 1) {
                $dns_servers[] = $conf_addr_primary_dns;
            } else {
                if ($i == 2) {
                    $dns_servers[] = $conf_addr_secondary_dns;
                }
            }
        }
    }
    $q = "SELECT * FROM {$pro_mysql_domain_table} WHERE owner='{$adm_login}';";
    $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n > 0) {
        $new_user = "******";
    } else {
        $new_user = "******";
    }
    //	sleep(2);
    $regz = registry_transfert_domain($adm_login, $adm_pass, $fqdn, $contacts, $dns_servers, $new_user, $authcode);
    if ($regz["is_success"] != 1) {
        $out .= "<font color=\"red\"><b>" . _("Transfert failed") . "</b></font><br>\n" . _("Server said: ") . "<i>" . $regz["response_text"] . "</i>";
        return $out;
    }
    $out .= "<font color=\"green\"><b>Transfert succesfull</b></font><br>\nServer said: <i>" . $regz["response_text"] . "</i><br>";
    $operation = $remaining - $fqdn_price;
    $query = "UPDATE {$pro_mysql_client_table} SET dollar='{$operation}' WHERE id='" . $admin["info"]["id_client"] . "';";
    mysql_query($query) or die("Cannot query \"{$query}\" !!!" . mysql_error());
    $q = "SELECT * FROM {$pro_mysql_domain_table} WHERE domain='{$fqdn}';";
    $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    // Is this a transfer of a domain already hosted?
    if ($n == 0) {
        addDomainToUser($adm_login, $adm_pass, $fqdn, $adm_pass);
    }
    if ($regz["is_success"] == 1) {
        $id = find_registry_id($fqdn);
        $q = "UPDATE {$pro_mysql_domain_table} SET registrar='" . $registry_api_modules[$id]["name"] . "' WHERE name='{$fqdn}';";
        $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
        unset($ns_ar);
        $ns_ar = array();
        $ns_ar[] = $_REQUEST["toreg_dns1"];
        $ns_ar[] = $_REQUEST["toreg_dns2"];
        if (isset($_REQUEST["toreg_dns3"]) && $_REQUEST["toreg_dns3"] != "") {
            $ns_ar[] = $_REQUEST["toreg_dns3"];
        }
        if (isset($_REQUEST["toreg_dns4"]) && $_REQUEST["toreg_dns4"] != "") {
            $ns_ar[] = $_REQUEST["toreg_dns4"];
        }
        if (isset($_REQUEST["toreg_dns5"]) && $_REQUEST["toreg_dns5"] != "") {
            $ns_ar[] = $_REQUEST["toreg_dns5"];
        }
        if (isset($_REQUEST["toreg_dns6"]) && $_REQUEST["toreg_dns6"] != "") {
            $ns_ar[] = $_REQUEST["toreg_dns6"];
        }
        newWhois($fqdn, $owner_id, $billing_id, $admin_id, $teck_id, $period = "1", $ns_ar, $registry_api_modules[$id]["name"]);
    }
    $out .= "<font color=\"green\"><b>" . _("Successfully added your domain name to the hosting database") . "</b></font><br>";
    $out .= _("Click") . " " . "<a href=\"" . $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}&addrlink={$addrlink}\">" . _("here") . "</a>" . " " . _("to refresh the menu or add another domain name.");
    // END OF DOMAIN NAME TRANSFERT //
    /////////////////////////////////////
    return $out;
}
예제 #15
0
<?php

require_once "../shared/autoSQLconfig.php";
$panel_type = "client";
// All shared files between DTCadmin and DTCclient
require_once "{$dtcshared_path}/dtc_lib.php";
require_once "new_account_form.php";
require_once "new_account_renewal.php";
get_secpay_conf();
// The language stuff...
$anotherTopBanner = anotherTopBanner("DTC");
if (isset($txt_top_menu_entrys)) {
    $anotherMenu = makeHoriMenu($txt_top_menu_entrys[$lang], 2);
}
$anotherLanguageSelection = anotherLanguageSelection();
$lang_sel = skin($conf_skin, $anotherLanguageSelection, _("Language"));
$proceed = "yes";
if (!isset($_REQUEST["hash_check"]) || !isRandomNum($_REQUEST["hash_check"])) {
    $form = _("Hash check not in correct format: cannot validate payment.");
    $proceed = "no";
}
if (!isset($_REQUEST["item_id"]) || !isRandomNum($_REQUEST["item_id"])) {
    $form = _("Hash check not in correct format: cannot validate payment.");
    $proceed = "no";
}
if ($proceed == "yes") {
    $q = "SELECT * FROM {$pro_mysql_pay_table} WHERE hash_check_key='" . $_REQUEST["hash_check"] . "' AND id='" . $_REQUEST["item_id"] . "'";
    $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__);
    $n = mysql_num_rows($r);
    if ($n != 1) {
        $form = _("Could not find your registration in the database.");
예제 #16
0
function drawAdminTools_AddDomain($admin)
{
    global $adm_login;
    global $adm_pass;
    global $addrlink;
    global $registration_added_price;
    global $conf_addr_primary_dns;
    global $conf_addr_secondary_dns;
    global $form_enter_dns_infos;
    global $form_enter_domain_name;
    global $whois_forwareded_params;
    global $form_period_popup;
    global $conf_webmaster_email_addr;
    global $conf_use_registrar_api;
    global $pro_mysql_pending_queries_table;
    global $pro_mysql_domain_table;
    global $pro_mysql_client_table;
    global $pro_mysql_product_table;
    global $registry_api_modules;
    global $secpayconf_currency_letters;
    global $pro_mysql_handle_table;
    get_secpay_conf();
    $out = "";
    $form_start = "\n<form action=\"" . $_SERVER["PHP_SELF"] . "\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n<input type=\"hidden\" name=\"action\" value=\"dtcrm_add_domain\">\n";
    // User is trying to add a new service, let's complete the form!
    if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "add_new_service") {
        if (!isRandomNum($_REQUEST["product_id"])) {
            $out .= _("The product ID is not a valid integer number.");
            return $out;
        }
        $q = "SELECT * FROM {$pro_mysql_product_table} WHERE id='" . $_REQUEST["product_id"] . "';";
        $r = mysql_query($q) or die("Cannot execute query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
        $n = mysql_num_rows($r);
        if ($n != 1) {
            $out .= _("Cannot reselect product: registration failed!");
            return $out;
        }
        $product = mysql_fetch_array($r);
        switch ($product["heb_type"]) {
            default:
            case "shared":
                // -> Something has to be done to select dedicated servers location in the form !!!
            // -> Something has to be done to select dedicated servers location in the form !!!
            case "server":
                $added1 = "<input type=\"hidden\" name=\"vps_location\" value=\"node0001.example.com\">\n<input type=\"hidden\" name=\"vps_os\" value=\"debian\">";
                break;
            case "vps":
                $added1 = _("VPS location: ") . "<select name=\"vps_location\">" . vpsLocationSelector() . "</select><br>" . _("VPS OS: ") . "<select name=\"vps_os\">\n<option value=\"debian\">Debian</option>\n<option value=\"centos\">CentOS</option>\n<option value=\"gentoo\">Gentoo</option>\n<option value=\"netbsd\">NetBSD</option>\n</select><br>";
                break;
        }
        $out .= "<br><br><h3>" . _("Add another service to your account:") . "</h3>" . "<br><form action=\"/dtc/new_account.php\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n<input type=\"hidden\" name=\"product_id\" value=\"" . $_REQUEST["product_id"] . "\">\n<input type=\"hidden\" name=\"action\" value=\"add_new_service\">" . $added1 . "\n" . _("Special notes for the setup") . ":<textarea name=\"custom_notes\" cols=\"50\" rows=\"5\"></textarea><br>\n" . submitButtonStart() . _("Register") . submitButtonEnd() . "\n";
        return $out;
    }
    // Registration, hosting, or both ?
    if (!isset($_REQUEST["add_domain_type"]) || $_REQUEST["add_domain_type"] != "domregandhosting" && $_REQUEST["add_domain_type"] != "domreg" && $_REQUEST["add_domain_type"] != "hosting") {
        $out .= "<br><h3>" . _("What do you want to add:") . "</h3>\n{$form_start}";
        if ($conf_use_registrar_api == "yes") {
            $out .= "<input type=\"radio\" name=\"add_domain_type\" value=\"domregandhosting\" checked>" . _("Hosting + domain name registration or transfer") . "<br>";
            $add_domain_type_checked = " ";
        } else {
            $add_domain_type_checked = " checked ";
        }
        $out .= "<input type=\"radio\" name=\"add_domain_type\" value=\"hosting\" checked>" . _("Hosting only") . "<br>\n" . submitButtonStart() . _("Ok") . submitButtonEnd() . "\n</form>\n";
        $out .= "<br><br><h3>" . _("Add another service to your account:") . "</h3>";
        if (isset($admin["data"])) {
            $added_conditions = " AND heb_type NOT LIKE 'shared' ";
        } else {
            $added_conditions = "";
        }
        $q = "SELECT * FROM {$pro_mysql_product_table} WHERE private='no' AND renew_prod_id='0' AND heb_type NOT LIKE 'ssl' {$added_conditions};";
        $r = mysql_query($q) or die("Cannot execute 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);
            //			if($i > 0){
            //				$out .= " - ";
            //			}
            $out .= "<form action=\"" . $_SERVER["PHP_SELF"] . "\">\n\t\t\t<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n\t\t\t<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n\t\t\t<input type=\"hidden\" name=\"action\" value=\"add_new_service\">\n\t\t\t<input type=\"hidden\" name=\"product_id\" value=\"" . $a["id"] . "\">\n\t\t\t<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n\t\t\t" . submitButtonStart() . $a["name"] . submitButtonEnd() . "</form>";
            //			$out .= "<a href=\"/dtc/new_account.php?action=add_new_service&adm_login=$adm_login&product_id=".$a["id"]."\">".$a["name"]."</a>";
        }
        return $out;
    }
    $form_start .= "<input type=\"hidden\" name=\"add_domain_type\" value=\"" . $_REQUEST["add_domain_type"] . "\">";
    //	$form_start .= "<input type=\"hidden\" name=\"add_domain_type\" value=\"domregandhosting\">";
    if ($_REQUEST["add_domain_type"] == "hosting") {
        // The don't want name registration or transfer,
        // Simply add the domain.
        if ($admin["info"]["allow_add_domain"] == "no") {
            return _("You curently don't have enough privileges to add domain names. If you often add domain names, you can ask the administrator to do so. To request hosting for a new domain without domain name registration, please write to:") . "<br>" . "<a href=\"mailto:{$conf_webmaster_email_addr}?subject=[DTC] More domains\">{$conf_webmaster_email_addr}</a>.";
        }
        if ($admin["info"]["max_domain"] != 0) {
            $maxdomq = "SELECT COUNT(name) AS numofdomains FROM {$pro_mysql_domain_table} WHERE owner='{$adm_login}';";
            $maxdomr = mysql_query($maxdomq) or die("Cannot query {$maxdomq} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
            $maxdoma = mysql_fetch_array($maxdomr);
            $num_of_installed_domains = $maxdoma["numofdomains"];
            if ($num_of_installed_domains >= $admin["info"]["max_domain"]) {
                return _("You have reached the maximum number of domains that you are allowed to run with this type of account.\nIf you want to add more domain names, you should get in touch by opening a new support ticket.");
            }
        }
        if (!isset($_REQUEST["domain_name"]) || $_REQUEST["domain_name"] == "") {
            return "<br><b><u>" . _("Please enter the domain name you wish to add:") . "</u></b><br>\n{$form_start}<input type=\"text\" name=\"domain_name\" value=\"\">\n" . submitButtonStart() . _("Ok") . submitButtonEnd() . "\n</form>";
        }
        if (!isHostname($_REQUEST["domain_name"])) {
            return _("Domain name is not in correct format. Please enter another name.");
        }
        $q = "SELECT * FROM {$pro_mysql_domain_table} WHERE name='" . $_REQUEST["domain_name"] . "';";
        $r = mysql_query($q) or die("Cannot execute query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
        $n = mysql_num_rows($r);
        if ($n > 0) {
            return _("This domain name already hosted here, please enter another name.");
        }
        if ($admin["info"]["allow_add_domain"] == "check") {
            $q = "INSERT INTO {$pro_mysql_pending_queries_table} (adm_login,domain_name,date) VALUES ('{$adm_login}','" . $_REQUEST["domain_name"] . "','" . date("Y-m-d H:i") . "');";
            $r = mysql_query($q) or die("Cannot execute query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
            return "<br><u><b>" . _("Your domain name will be soon validated:") . "</b></u><br>" . _("An administrator will examine your request shortly, and validate the addition of this domain name to your account. You curently don't have enough privileges to add domain names. If you often add domain names, you can ask the administrator to grant you the privilege of automatic domain name addition. To request hosting for a new domain name, without administrator validation or domain name registration, please write to:") . "<br>\n<a href=\"{$conf_webmaster_email_addr}?subject=[DTC] More domains\">{$conf_webmaster_email_addr}</a>.<br>\n<br>\n" . _("You can add another domain name:") . "\n{$form_start}<input type=\"text\" name=\"domain_name\" value=\"\">\n" . submitButtonStart() . _("Ok") . submitButtonEnd() . "\n</form>\n";
        }
        addDomainToUser($adm_login, $adm_pass, $_REQUEST["domain_name"]);
        return "<br><u><b>" . _("Your domain name is now ready:") . "</b></u><br>\n" . _("Now you can go to check its configuration by clicking here:") . "<br>\n<a href=\"" . $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}&addrlink=" . $_REQUEST["domain_name"] . "\">" . $_REQUEST["domain_name"] . "</a><br>\n<br>\n" . _("Alternatively, you can add another domain name:") . "\n{$form_start}<input type=\"text\" name=\"domain_name\" value=\"\">\n" . submitButtonStart() . _("Ok") . submitButtonEnd() . "\n</form>\n";
    }
    // Registration or domain transfer ?
    if (!isset($_REQUEST["add_regortrans"]) || $_REQUEST["add_regortrans"] != "register" && $_REQUEST["add_regortrans"] != "transfer") {
        $out .= "<br><h3>" . _("Do you want to transfer an existing domain or register a new domain?") . "</h3>\n{$form_start}\n<input type=\"radio\" name=\"add_regortrans\" value=\"register\" checked>" . _("Register a new domain") . "<br>\n<input type=\"radio\" name=\"add_regortrans\" value=\"transfer\">" . _("Transfer an existing domain from another registrar") . "<br>\n" . submitButtonStart() . _("Ok") . submitButtonEnd() . "\n</form>\n";
        return $out;
    }
    if ($_REQUEST["add_regortrans"] == "transfer") {
        return drawNameTransfer($admin);
    }
    $form_start .= "<input type=\"hidden\" name=\"add_regortrans\" value=\"register\">";
    // Start registration procedure (with or without hosting)
    $out .= "<br><h3>" . _("Register a domain name") . "</h3>";
    $out .= "<i><u>" . _("Step 1: Verify availability") . "</u></i><br>";
    if (!isset($_REQUEST["toreg_domain"]) || $_REQUEST["toreg_domain"] == "" || !isset($_REQUEST["toreg_extention"]) || $_REQUEST["toreg_extention"] == "") {
        $out .= "<br>" . _("Enter the domain name you want to register:") . "<br>\n{$form_start} " . make_registration_tld_popup() . "</form>";
        return $out;
    }
    $fqdn = $_REQUEST["toreg_domain"] . $_REQUEST["toreg_extention"];
    $domlookup = registry_check_availability($fqdn);
    if ($domlookup["is_success"] != 1) {
        $out .= "<font color=\"red\">" . _("Could not connect to domain registration server: please try again later!") . "</font><br>" . $domlookup['response_text'];
        return $out;
    }
    if ($domlookup["attributes"]["status"] != "available") {
        $out .= "<br>\n" . _("Sorry, the domain name ") . " <b>{$fqdn}</b> " . _("is NOT available for registration. The registration server returned: ") . "<br><font color=\"red\">" . $domlookup["response_text"] . "</font>\n<br><br>\nHave another try:<br>{$form_start} " . make_registration_tld_popup() . "</form>";
        return $out;
    }
    $form_start .= "<input type=\"hidden\" name=\"toreg_domain\" value=\"" . $_REQUEST["toreg_domain"] . "\">\n<input type=\"hidden\" name=\"toreg_extention\" value=\"" . $_REQUEST["toreg_extention"] . "\">";
    $q = "SELECT * FROM {$pro_mysql_domain_table} WHERE name='{$fqdn}';";
    $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n != 0) {
        $out .= "<br>\n" . _("The domain name") . " <b>{$fqdn}</b> " . _("is already in use in this server: you can't register that domain name.") . "<br>" . _("Have another try:") . "<br>{$form_start} " . make_registration_tld_popup() . "</form>";
        return $out;
    }
    // DOMAIN IS AVAILABLE, PROCEED DO REGISTRATION
    $out .= "Domain name <b>{$fqdn}</b> is available for registration.<br><br>\n<i><u>" . _("Step 2: Enter whois information") . "</u></i><br>\n";
    //http://dtc.example.com/dtc/index.php?adm_login=dtc&adm_pass=bemybest&
    //addrlink=myaccount%2Fadddomain&
    //action=dtcrm_add_domain&add_domain_type=domreg&add_regortrans=register&
    //toreg_domain=yugluxrfvcd&toreg_extention=.com&
    //dtcrm_owner_hdl=1&dtcrm_billing_hdl=1&dtcrm_admin_hdl=1&
    //toreg_dns1=default&toreg_dns2=default&
    //toreg_period=1
    if (!isset($_REQUEST["dtcrm_owner_hdl"]) || $_REQUEST["dtcrm_owner_hdl"] == "" || !isset($_REQUEST["dtcrm_admin_hdl"]) || $_REQUEST["dtcrm_admin_hdl"] == "" || !isset($_REQUEST["dtcrm_billing_hdl"]) || $_REQUEST["dtcrm_billing_hdl"] == "" || !isset($_REQUEST["dtcrm_teck_hdl"]) || $_REQUEST["dtcrm_teck_hdl"] == "" || !isset($_REQUEST["toreg_dns1"]) || $_REQUEST["toreg_dns1"] == "" || !isset($_REQUEST["toreg_dns2"]) || $_REQUEST["toreg_dns2"] == "" || $_REQUEST["toreg_period"] < 1 || $_REQUEST["toreg_period"] > 10) {
        $year = _("year");
        $years = _("years");
        $out .= _("Please select registran and the 3 contact handles you want to use for registering that domain name.") . "<br><br>{$form_start}";
        $out .= whoisHandleSelection($admin);
        if (isset($domlookup["attributes"]["minperiod"])) {
            $minreg = str_replace("Y", "", $domlookup["attributes"]["maxperiod"]);
        } else {
            $minreg = 1;
        }
        if (isset($domlookup["attributes"]["maxperiod"])) {
            $maxreg = str_replace("Y", "", $domlookup["attributes"]["maxperiod"]);
        } else {
            $maxreg = 10;
        }
        $out .= "<br>{$form_enter_dns_infos}<br><br>\n" . _("Select how long you want to register this domain name:") . "<br>\n<select name=\"toreg_period\"><option value=\"1\">1 {$year}</option>";
        for ($p = 2; $p <= $maxreg; $p++) {
            $out .= "<option value=\"{$p}\"";
            if ($p == $minreg) {
                $out .= " selected>Minimum";
            } else {
                $out .= ">";
            }
            $out .= " {$p} {$years}</option>";
        }
        $out .= "</select><br><br>\n" . submitButtonStart() . _("Ok") . submitButtonEnd() . "\n</form>\n";
        return $out;
    }
    $form_start .= "{$whois_forwareded_params}\n<input type=\"hidden\" name=\"toreg_period\" value=\"" . $_REQUEST["toreg_period"] . "\">";
    $out .= "Registration for <b>" . $_REQUEST["toreg_period"] . " years</b><br>";
    $out .= "DNS1: " . $_REQUEST["toreg_dns1"] . "<br>";
    $out .= "DNS2: " . $_REQUEST["toreg_dns2"] . "<br><br>";
    $out .= "<i><u>" . _("Step 3: Proceed to registration") . "</u></i>\n{$form_start}\n";
    // Check if paiement has just occured !
    if (isset($_REQUEST["inner_action"]) && $_REQUEST["inner_action"] == "return_from_paypal_domain_add") {
        $ze_refund = isPayIDValidated(addslashes($_REQUEST["pay_id"]));
        if ($ze_refund == 0) {
            $out .= "<font color=\"red\">The transaction failed, please try again!</font>";
        } else {
            $out .= "<font color=\"green\">Funds added to your account</font>";
            $q = "UPDATE {$pro_mysql_client_table} SET dollar = dollar+" . $ze_refund . " WHERE id='" . $admin["info"]["id_client"] . "';";
            $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said " . mysql_error());
            $admin["client"]["dollar"] += $ze_refund;
        }
    }
    // Check billing to know if user has enough money on his account
    $price = find_domain_price($_REQUEST["toreg_extention"]);
    $fqdn_price = $price;
    $fqdn_price *= $_REQUEST["toreg_period"];
    if ($admin["info"]["id_client"] != 0) {
        $remaining = $admin["client"]["dollar"];
    } else {
        $out .= _("You don't have a client ID. Please contact us.") . "<br>";
        $remaining = 0;
        return $out;
    }
    $out .= _("Remaining on your account: ") . " {$secpayconf_currency_letters}" . $remaining . "<br>\n" . _("Total price: ") . " " . $secpayconf_currency_letters . "" . $fqdn_price . "<br><br>";
    if ($fqdn_price > $remaining) {
        $to_pay = $fqdn_price - $remaining;
        $payid = createCreditCardPaiementID($to_pay, $admin["info"]["id_client"], "Domain name registration " . $_REQUEST["toreg_extention"], "no");
        $return_url = $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}" . "&addrlink={$addrlink}&action=dtcrm_add_domain&add_domain_type=" . $_REQUEST["add_domain_type"] . "&add_regortrans=" . $_REQUEST["add_regortrans"] . "&toreg_domain=" . $_REQUEST["toreg_domain"] . "&toreg_extention=" . $_REQUEST["toreg_extention"] . "&dtcrm_owner_hdl=" . $_REQUEST["dtcrm_owner_hdl"] . "&dtcrm_admin_hdl=" . $_REQUEST["dtcrm_admin_hdl"] . "&dtcrm_billing_hdl=" . $_REQUEST["dtcrm_billing_hdl"] . "&dtcrm_teck_hdl=" . $_REQUEST["dtcrm_teck_hdl"] . "&toreg_dns1=" . $_REQUEST["toreg_dns1"] . "&toreg_dns2=" . $_REQUEST["toreg_dns2"] . "&toreg_dns3=" . $_REQUEST["toreg_dns3"] . "&toreg_dns4=" . $_REQUEST["toreg_dns4"] . "&toreg_dns5=" . $_REQUEST["toreg_dns5"] . "&toreg_dns6=" . $_REQUEST["toreg_dns6"] . "&toreg_period=" . $_REQUEST["toreg_period"] . "&inner_action=return_from_paypal_domain_add&payid={$payid}";
        $paybutton = paynowButton($payid, $to_pay, "Domain name registration " . $_REQUEST["toreg_extention"], $return_url);
        $out .= _("You currently don't have enough funds on your account. You will be redirected to our payment system. Please click on the button below to pay.") . "<br>\n<br><br>\n{$form_start}\n" . submitButtonStart() . _("Payment complete. Proceed to checkout") . submitButtonEnd() . "\n</form> {$paybutton}";
        return $out;
    }
    // Check for confirmation
    if (!isset($_REQUEST["toreg_confirm_register"]) || $_REQUEST["toreg_confirm_register"] != "yes") {
        $out .= _("You have enough funds on your account to proceed with registration. Press the confirm button to proceed.") . "<br><br>\n{$form_start}\n<input type=\"hidden\" name=\"toreg_confirm_register\" value=\"yes\">\n" . submitButtonStart() . _("Proceed to name-registration") . submitButtonEnd() . "\n</form>";
        return $out;
    }
    ///////////////////////////////////////
    // START OF DOMAIN NAME REGISTRATION //
    $owner_id = $_REQUEST["dtcrm_owner_hdl"];
    $billing_id = $_REQUEST["dtcrm_billing_hdl"];
    $admin_id = $_REQUEST["dtcrm_admin_hdl"];
    $teck_id = $_REQUEST["dtcrm_teck_hdl"];
    $contacts = getContactsArrayFromID($owner_id, $billing_id, $admin_id, $teck_id);
    $dns_servers = array();
    for ($i = 1; $i < 7; $i++) {
        if (isset($_REQUEST["toreg_dns{$i}"]) && isHostname($_REQUEST["toreg_dns{$i}"])) {
            $dns_servers[] = $_REQUEST["toreg_dns{$i}"];
        } else {
            if ($i == 1) {
                $dns_servers[] = $conf_addr_primary_dns;
            } else {
                if ($i == 2) {
                    $dns_servers[] = $conf_addr_secondary_dns;
                }
            }
        }
    }
    $q = "SELECT * FROM {$pro_mysql_domain_table} WHERE owner='{$adm_login}' AND whois='here';";
    $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    if ($n > 0) {
        $new_user = "******";
    } else {
        $new_user = "******";
    }
    //	sleep(2);
    $regz = registry_register_domain($adm_login, $adm_pass, $fqdn, $_REQUEST["toreg_period"], $contacts, $dns_servers, $new_user);
    if ($regz["is_success"] != 1) {
        $out .= "<font color=\"red\"><b>" . _("Registration failed") . "</b></font><br>\n" . _("Server said: ") . "<i>" . $regz["response_text"] . "</i>";
        return $out;
    }
    $out .= "<font color=\"green\"><b>Registration succesfull</b></font><br>\nServer said: <i>" . $regz["response_text"] . "</i><br>";
    $operation = $remaining - $fqdn_price;
    $query = "UPDATE {$pro_mysql_client_table} SET dollar='{$operation}' WHERE id='" . $admin["info"]["id_client"] . "';";
    mysql_query($query) or die("Cannot query \"{$query}\" !!!" . mysql_error());
    addDomainToUser($adm_login, $adm_pass, $fqdn, $adm_pass);
    if ($regz["is_success"] == 1) {
        $id = find_registry_id($fqdn);
        $q = "UPDATE {$pro_mysql_domain_table} SET registrar='" . $registry_api_modules[$id]["name"] . "' WHERE name='{$fqdn}';";
        $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
        unset($ns_ar);
        $ns_ar = array();
        $ns_ar[] = $_REQUEST["toreg_dns1"];
        $ns_ar[] = $_REQUEST["toreg_dns2"];
        if (isset($_REQUEST["toreg_dns3"]) && $_REQUEST["toreg_dns3"] != "") {
            $ns_ar[] = $_REQUEST["toreg_dns3"];
        }
        if (isset($_REQUEST["toreg_dns4"]) && $_REQUEST["toreg_dns4"] != "") {
            $ns_ar[] = $_REQUEST["toreg_dns4"];
        }
        if (isset($_REQUEST["toreg_dns5"]) && $_REQUEST["toreg_dns5"] != "") {
            $ns_ar[] = $_REQUEST["toreg_dns5"];
        }
        if (isset($_REQUEST["toreg_dns6"]) && $_REQUEST["toreg_dns6"] != "") {
            $ns_ar[] = $_REQUEST["toreg_dns6"];
        }
        newWhois($fqdn, $owner_id, $billing_id, $admin_id, $teck_id, $_REQUEST["toreg_period"], $ns_ar, $registry_api_modules[$id]["name"]);
    }
    $out .= "<font color=\"green\"><b>" . _("Successfully added your domain name to the hosting database") . "</b></font><br>";
    $out .= _("Click") . " " . "<a href=\"" . $_SERVER["PHP_SELF"] . "?adm_login={$adm_login}&adm_pass={$adm_pass}&addrlink={$addrlink}\">" . _("here") . "</a>" . " " . _("to refresh the menu or add another domain name.");
    // END OF DOMAIN NAME REGISTRATION //
    /////////////////////////////////////
    return $out;
}
예제 #17
0
function registration_form()
{
    global $conf_this_server_country_code;
    global $conf_skin;
    global $pro_mysql_product_table;
    global $pro_mysql_vps_ip_table;
    global $pro_mysql_vps_server_table;
    global $conf_selling_conditions_url;
    global $secpayconf_currency_symbol;
    global $conf_main_domain;
    global $conf_provide_own_domain_hosts;
    get_secpay_conf();
    if (isset($_REQUEST["product_id"]) && isRandomNum($_REQUEST["product_id"])) {
        $q = "SELECT * FROM {$pro_mysql_product_table} WHERE id='" . $_REQUEST["product_id"] . "';";
        $r = mysql_query($q) or die("Cannot execute query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
        $n = mysql_num_rows($r);
        if ($n != 1) {
            die("Product ID not found here line " . __LINE__ . " file " . __FILE__);
        }
        $a = mysql_fetch_array($r);
        $heb_type_condition = " heb_type='" . $a["heb_type"] . "' ";
        $heb_type = $a["heb_type"];
    } else {
        $heb_type_condition = " 1 ";
        $heb_type = "all";
    }
    $prod_popup = "";
    $p_jscript = " prod_popup_htype = new Array();";
    $q = "SELECT * FROM {$pro_mysql_product_table} WHERE {$heb_type_condition} AND renew_prod_id='0' AND private='no' ORDER BY id";
    $r = mysql_query($q) or die("Cannot execute query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
    $n = mysql_num_rows($r);
    $prod_popup .= "<option value=\"-1\">" . _("Please select!") . "</optioon>";
    for ($i = 0; $i < $n; $i++) {
        $a = mysql_fetch_array($r);
        $p_jscript .= " prod_popup_htype[" . $a["id"] . "] = '" . $a["heb_type"] . "';\n";
        if (isset($_REQUEST["product_id"]) && $a["id"] == $_REQUEST["product_id"]) {
            $prod_popup .= "<option value=\"" . $a["id"] . "\" selected>" . $a["name"] . " / " . $a["price_dollar"] . "{$secpayconf_currency_symbol}</option>\n";
        } else {
            $prod_popup .= "<option value=\"" . $a["id"] . "\">" . $a["name"] . " / " . $a["price_dollar"] . "{$secpayconf_currency_symbol}</option>\n";
        }
    }
    $prod_popup = "<select onChange=\"hostingProductChanged();\" name=\"product_id\">" . $prod_popup . "</select>";
    /*	$q = "SELECT $pro_mysql_vps_server_table.hostname,$pro_mysql_vps_server_table.location
    	FROM $pro_mysql_vps_ip_table,$pro_mysql_vps_server_table
    	WHERE $pro_mysql_vps_ip_table.vps_server_hostname=$pro_mysql_vps_server_table.hostname
    	AND $pro_mysql_vps_ip_table.available='yes'
    	GROUP BY $pro_mysql_vps_server_table.location;";
    	$r = mysql_query($q)or die("Cannot execute query \"$q\" ! line: ".__LINE__." file: ".__FILE__." sql said: ".mysql_error());
    	$n = mysql_num_rows($r);
    	$vps_location_popup = "<option value=\"-1\">Please select!</optioon>";
    	for($i=0;$i<$n;$i++){
    		$a = mysql_fetch_array($r);
    		if(isset($_REQUEST["vps_server_hostname"]) && $_REQUEST["vps_server_hostname"] == $a["hostname"]){
    			$selected = " selected ";
    		}else{
    			$selected = "";
    		}
    		$vps_location_popup .= "<option value=\"".$a["hostname"]."\" $selected>".$a["location"]."</optioon>";
    	}*/
    $vps_location_popup = vpsLocationSelector();
    if (isset($_REQUEST["reqadm_login"])) {
        $frm_login = htmlspecialchars($_REQUEST["reqadm_login"]);
    } else {
        $frm_login = "";
    }
    if (isset($_REQUEST["domain_name"])) {
        $frm_domain_name = htmlspecialchars($_REQUEST["domain_name"]);
    } else {
        $frm_domain_name = "";
    }
    if (isset($_REQUEST["domain_tld"])) {
        $frm_domain_tld = htmlspecialchars($_REQUEST["domain_tld"]);
    } else {
        $frm_domain_tld = "";
    }
    if (isset($_REQUEST["firstname"])) {
        $frm_firstname = htmlspecialchars($_REQUEST["firstname"]);
    } else {
        $frm_firstname = "";
    }
    if (isset($_REQUEST["familyname"])) {
        $frm_family_name = htmlspecialchars($_REQUEST["familyname"]);
    } else {
        $frm_family_name = "";
    }
    if (isset($_REQUEST["compname"])) {
        $frm_compname = htmlspecialchars($_REQUEST["compname"]);
    } else {
        $frm_compname = "";
    }
    if (isset($_REQUEST["vat_num"])) {
        $frm_vat_num = htmlspecialchars($_REQUEST["vat_num"]);
    } else {
        $frm_vat_num = "";
    }
    if (isset($_REQUEST["email"])) {
        $frm_email = htmlspecialchars($_REQUEST["email"]);
    } else {
        $frm_email = "";
    }
    if (isset($_REQUEST["phone"])) {
        $frm_phone = htmlspecialchars($_REQUEST["phone"]);
    } else {
        $frm_phone = "";
    }
    if (isset($_REQUEST["fax"])) {
        $frm_fax = htmlspecialchars($_REQUEST["fax"]);
    } else {
        $frm_fax = "";
    }
    if (isset($_REQUEST["address1"])) {
        $frm_addr1 = htmlspecialchars($_REQUEST["address1"]);
    } else {
        $frm_addr1 = "";
    }
    if (isset($_REQUEST["address2"])) {
        $frm_addr2 = htmlspecialchars($_REQUEST["address2"]);
    } else {
        $frm_addr2 = "";
    }
    if (isset($_REQUEST["address3"])) {
        $frm_addr3 = htmlspecialchars($_REQUEST["address3"]);
    } else {
        $frm_addr3 = "";
    }
    if (isset($_REQUEST["zipcode"])) {
        $frm_zipcode = htmlspecialchars($_REQUEST["zipcode"]);
    } else {
        $frm_zipcode = "";
    }
    if (isset($_REQUEST["city"])) {
        $frm_city = htmlspecialchars($_REQUEST["city"]);
    } else {
        $frm_city = "";
    }
    if (isset($_REQUEST["state"])) {
        $frm_state = htmlspecialchars($_REQUEST["state"]);
    } else {
        $frm_state = "";
    }
    if (isset($_REQUEST["country"])) {
        $frm_country = htmlspecialchars($_REQUEST["country"]);
    } else {
        $frm_country = "";
    }
    if (isset($_REQUEST["custom_notes"])) {
        $frm_custom_notes = htmlspecialchars($_REQUEST["custom_notes"]);
    } else {
        $frm_custom_notes = "";
    }
    if ($heb_type == "all" || $heb_type == "shared" || $heb_type == "ssl") {
        $domname_hidden = " style=\"white-space:nowrap;\" ";
    } else {
        $domname_hidden = " style=\"display:none;visibility:hidden;white-space:nowrap;\" ";
    }
    if ($heb_type == "all" || $heb_type == "vps") {
        $vps_hidden = " ";
    } else {
        $vps_hidden = " style=\"display:none;visibility:hidden;\" ";
    }
    $debian_selected = " ";
    $debiandtc_selected = " ";
    $centos_selected = " ";
    $gentoo_selected = " ";
    $netbsd_selected = " ";
    if (isset($_REQUEST["vps_os"]) && $_REQUEST["vps_os"] == "debian") {
        $debian_selected = " selected ";
    }
    if (isset($_REQUEST["vps_os"]) && $_REQUEST["vps_os"] == "debian-dtc") {
        $debiandtc_selected = " selected ";
    }
    if (isset($_REQUEST["vps_os"]) && $_REQUEST["vps_os"] == "centos") {
        $centos_selected = " selected ";
    }
    if (isset($_REQUEST["vps_os"]) && $_REQUEST["vps_os"] == "netbsd") {
        $netbsd_selected = " selected ";
    }
    $tld_popup = "";
    if ($conf_provide_own_domain_hosts == "yes") {
        $tld_popup = "<option value=\".{$conf_main_domain}\">.{$conf_main_domain}</option>";
    }
    $tld_popup .= domainNamePopup($frm_domain_tld);
    $rek = "<font color=\"red\">*</font>";
    $prod_popup = "<table>\n<tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Product") . ": </td><td>" . $prod_popup . "</td>\n</td><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\"><div name=\"domname_text\" id=\"domname_text\" {$domname_hidden}>" . _("Desired domain name") . ":</div></td>\n\t<td><div name=\"domname_field\" id=\"domname_field\" {$domname_hidden}>www.<input type=\"text\" name=\"domain_name\" value=\"{$frm_domain_name}\"><select name=\"domain_tld\">" . $tld_popup . "</select></div></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\"><div name=\"vps_popup_text\" id=\"vps_popup_text\" {$vps_hidden}>" . _("VPS location: ") . "</div></td>\n\t<td><div name=\"vps_popup_field\" id=\"vps_popup_field\" {$vps_hidden}><select name=\"vps_server_hostname\">{$vps_location_popup}</select></div></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\"><div name=\"vps_ospopup_text\" id=\"vps_ospopup_text\" {$vps_hidden}></div></td>\n\t<td><div name=\"vps_ospopup_field\" id=\"vps_ospopup_field\" {$vps_hidden}><select name=\"vps_os\">\n\t\t<option value=\"debian\" {$debian_selected}>Debian (" . _("network install with debootstrap") . ")</option>\n\t\t<option value=\"debian-dtc\" {$debiandtc_selected}>Debian with DTC panel (" . _("network install with debootstrap") . ")</option>\n\t\t<option value=\"centos\" {$centos_selected}>CentOS (" . _("network install with yum") . ")</option>\n\t\t<option value=\"netbsd\" {$netbsd_selected}>NetBSD (" . _("network setup with install kernel") . ")</option></select></div></td>\n</tr></table>";
    $login_info = "<table>\n<tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Login: "******"</td>\n\t<td><input type=\"text\" name=\"reqadm_login\" value=\"{$frm_login}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Password: "******"</td>\n\t<td><input type=\"password\" name=\"reqadm_pass\" value=\"\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Confirm pass: "******"</td>\n\t<td><input type=\"password\" name=\"reqadm_pass2\" value=\"\"></td>\n</tr></table>";
    #	$login_skined = skin("frame",$login_info,"");
    $login_skined = $login_info;
    $compyes = "";
    $compno = "";
    if (isset($_REQUEST["iscomp"]) && $_REQUEST["iscomp"] == "yes") {
        $compyes = "checked";
    } else {
        if (isset($_REQUEST["iscomp"]) && $_REQUEST["iscomp"] == "no") {
            $compno = " checked";
        }
    }
    $client_info = "<table>\n<tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Familly name: ") . $rek . "</td>\n\t<td><input type=\"text\" name=\"familyname\" value=\"{$frm_family_name}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("First name: ") . $rek . "</td>\n\t<td><input type=\"text\" name=\"firstname\" value=\"{$frm_firstname}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Is it a company: ") . $rek . "</td>\n\t<td><input type=\"radio\" name=\"iscomp\" value=\"yes\"{$compyes}>" . _("Yes") . "\n<input type=\"radio\" name=\"iscomp\" value=\"no\"{$compno}>" . _("No") . "</td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Company name: ") . "</td>\n\t<td><input type=\"text\" name=\"compname\" value=\"{$frm_compname}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("VAT/GST Number: ") . "</td>\n\t<td><input type=\"text\" name=\"vat_num\" value=\"{$frm_vat_num}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Email: ") . $rek . "</td>\n\t<td><input type=\"text\" name=\"email\" value=\"{$frm_email}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Phone number: ") . $rek . "</td>\n\t<td><input type=\"text\" name=\"phone\" value=\"{$frm_phone}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Fax: ") . "</td>\n\t<td><input type=\"text\" name=\"fax\" value=\"{$frm_fax}\"></td>\n</tr></table>";
    $client_skined = $client_info;
    if ($frm_country == "" && !isset($db_product) || $frm_country == "" && $db_product["heb_type"] == "shared") {
        $frm_country = $conf_this_server_country_code;
    }
    $client_addr = "<table>\n<tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Address (line1): ") . $rek . "</td>\n\t<td><input type=\"text\" name=\"address1\" value=\"{$frm_addr1}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Address (line2): ") . "</td>\n\t<td><input type=\"text\" name=\"address2\" value=\"{$frm_addr2}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Address (line3): ") . "</td>\n\t<td><input type=\"text\" name=\"address3\" value=\"{$frm_addr3}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Zipcode: ") . $rek . "</td>\n\t<td><input type=\"text\" name=\"zipcode\" value=\"{$frm_zipcode}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("City: ") . $rek . "</td>\n\t<td><input type=\"text\" name=\"city\" value=\"{$frm_city}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("State: ") . "</td>\n\t<td><input type=\"text\" name=\"state\" value=\"{$frm_state}\"></td>\n</tr><tr>\n\t<td style=\"white-space: nowrap;text-align: right;\">" . _("Country: ") . $rek . "</td>\n\t<td><select name=\"country\">" . cc_code_popup($frm_country) . "</select></td>\n</tr></table>";
    #	$addr_skined = skin("frame",$client_addr,"");
    $addr_skined = $client_addr;
    if ($conf_selling_conditions_url != "none") {
        $conditions = "<input type=\"checkbox\" name=\"condition\" value=\"yes\"> " . $rek . _("I agree to the") . " <a href=\"{$conf_selling_conditions_url}\">" . _("selling conditions") . "</a>";
    } else {
        $conditions = "";
    }
    $HTML_admin_edit_data = "<a href=\"/dtc\">" . _("Go to login") . "</a>\n<script language=\"javascript\">\n\n{$p_jscript}\n\nvar DHTML = (document.getElementById || document.all || document.layers);\nfunction getObj(name){\n\tif (document.getElementById){\n\t\tthis.obj = document.getElementById(name);\n\t\tthis.style = document.getElementById(name).style;\n\t}else if(document.all){\n\t\tthis.obj = document.all[name];\n\t\tthis.style = document.all[name].style;\n\t}else{\n\t\tthis.obj = document.layers[name];\n\t\tthis.style = document.layers[name];\n\t}\n}\n\nfunction hostingProductChanged(){\n\tif (!DHTML) return;\n\tif(document.newuser_form.product_id.value == -1){\n\t\treturn;\n\t}\n\thosting_type = prod_popup_htype[document.newuser_form.product_id.value];\n\tvar a = new getObj('domname_field');\n\tvar b = new getObj('domname_text');\n\tvar c = new getObj('vps_popup_field');\n\tvar d = new getObj('vps_popup_text');\n\tvar e = new getObj('vps_ospopup_text');\n\tvar f = new getObj('vps_ospopup_field');\n\tif(hosting_type == 'vps'){\n\t\ta.style.visibility = 'hidden';\n\t\ta.style.display = 'none';\n\t\tb.style.visibility = 'hidden';\n\t\tb.style.display = 'none';\n\n\t\tc.style.visibility = 'visible';\n\t\tc.style.display = 'block';\n\t\td.style.visibility = 'visible';\n\t\td.style.display = 'block';\n\t\te.style.visibility = 'visible';\n\t\te.style.display = 'block';\n\t\tf.style.visibility = 'visible';\n\t\tf.style.display = 'block';\n\t}else{\n\t\ta.style.visibility = 'visible';\n\t\ta.style.display = 'block';\n\t\tb.style.visibility = 'visible';\n\t\tb.style.display = 'block';\n\n\t\tc.style.visibility = 'hidden';\n\t\tc.style.display = 'none';\n\t\td.style.visibility = 'hidden';\n\t\td.style.display = 'none';\n\t\te.style.visibility = 'hidden';\n\t\te.style.display = 'none';\n\t\tf.style.visibility = 'hidden';\n\t\tf.style.display = 'none';\n\t}\n}\n\n</script><br>\n<br>\n<i>" . _("Feilds with a <font color=\"red\">*</font> are mandatory.") . "</i><br>\n<form name=\"newuser_form\" action=\"" . $_SERVER["PHP_SELF"] . "\" methode=\"post\">\n<input type=\"hidden\" name=\"action\" value=\"new_user_request\">\n<table>\n<tr>\n\t<td valign=\"top\"><h3>" . _("Product:") . "</h3>\n\t{$prod_popup}<br>\n<h3>" . _("Login info") . ":</h3> " . $login_skined . "</td>\n\t<td width=\"4\" background=\"gfx/border_2.gif\"></td>\n\t<td valign=\"top\"><h3>" . _("Client info") . "</h3> {$client_skined}</td>\n\t<td width=\"4\" background=\"gfx/border_2.gif\"></td>\n\t<td valign=\"top\"><h3>" . _("Customer's address") . "</h3> {$addr_skined}</td>\n</tr></table>\n{$conditions}\n<table border=\"0\">\n<tr>\n\t<td>" . _("Leave a message describing any specific requirements you might have for your account:") . "</td>\n\t<td><textarea name=\"custom_notes\" cols=\"50\" rows=\"5\">{$frm_custom_notes}</textarea></td>\n\t<td><input type=\"submit\" name=\"Login\" value=\"Register\"></td>\n</tr>\n</table>\n</form>";
    //	return $login_skined;
    return $HTML_admin_edit_data;
}
예제 #18
0
function drawAdminTools_VPSInstallation($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 $pro_mysql_vps_ip_table;
    global $pro_mysql_vps_stats_table;
    global $secpayconf_currency_letters;
    global $panel_type;
    global $submit_err;
    $reinstall_os = 1;
    get_secpay_conf();
    $out = "<font color=\"red\">{$submit_err} {$vps_soap_err}</font>";
    $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 = "";
    // 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;
    }
    // Check if the VPS has expired or not
    $ar = explode("-", $vps["expire_date"]);
    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]) {
        $expired = "yes";
    } else {
        $expired = "no";
    }
    // VPS (remote SOAP) Status
    $soap_client = connectToVPSServer($vps_node);
    if ($soap_client != false) {
        $vps_remote_info = getVPSInfo($vps_node, $vps_name, $soap_client);
        if ($vps_remote_info == false) {
            if (strstr($vps_soap_err, _("Method getVPSState failed"))) {
                $vps_out .= _("Could not get remote status (Method getVPSState() failed). Maybe the VPS is not running?") . "<br><br>";
            } else {
                if (strstr($vps_soap_err, _("couldn't connect to host"))) {
                    $vps_out .= _("Could not get remote status: could not connect to the SOAP server (HTTP error).") . "<br><br>";
                } else {
                    $vps_out .= _("Could not get remote status. Unkown error: ") . "{$vps_soap_err}<br><br>";
                }
            }
        } else {
            if ($vps_remote_info == "fsck") {
                $vps_out .= _("Checking filesystem...") . "<br><br>";
            } else {
                if ($vps_remote_info == "mkos") {
                    $vps_out .= _("Reinstalling operating system...") . "<br><br>";
                } else {
                    if (isset($vps_remote_info["id"])) {
                        $vps_out .= _("VM id: ") . $vps_remote_info["id"] . "<br>";
                    }
                    if (isset($vps_remote_info["name"])) {
                        $vps_out .= _("Name: ") . $vps_remote_info["name"] . "<br>";
                    }
                    if (isset($vps_remote_info["memory"])) {
                        $vps_out .= _("Memory: ") . $vps_remote_info["memory"] . "<br>";
                    }
                    if (isset($vps_remote_info["maxmem"])) {
                        $vps_out .= _("Max memory: ") . $vps_remote_info["maxmem"] . "<br>";
                    } else {
                        $vps_out .= _("Maxmem: cannot fetch (maybe boot in progress?)") . "<br>";
                    }
                    if (isset($vps_remote_info["cpu"])) {
                        $vps_out .= _("Number of CPU: ") . $vps_remote_info["cpu"] . "<br>";
                    } else {
                        $vps_out .= _("Number of CPU: cannot fetch (maybe boot in progress?)") . "<br>";
                    }
                    if (isset($vps_remote_info["state"])) {
                        $vps_out .= _("VPS State: ") . $vps_remote_info["state"] . "<br>";
                    } else {
                        $vps_out .= _("State: cannot fetch (maybe boot in progress?)") . "<br>";
                    }
                    if ($vps_remote_info["xen_type"] == 2 && isset($vps_remote_info["up_time"])) {
                        $uptime = substr($vps_remote_info["up_time"], 0, strpos($vps_remote_info["up_time"], "."));
                        $uptime_s = $uptime % 60;
                        $uptime_m = round($uptime / 60) % 60;
                        $uptime_h = round($uptime / 3600) % 24;
                        $uptime_j = round($uptime / 86400);
                        if ($uptime_s > 1) {
                            $upt_s_s = "s";
                        } else {
                            $upt_s_s = "";
                        }
                        if ($uptime_m > 1) {
                            $upt_s_m = "s";
                        } else {
                            $upt_s_m = "";
                        }
                        if ($uptime_h > 1) {
                            $upt_s_h = "s";
                        } else {
                            $upt_s_h = "";
                        }
                        if ($uptime_j > 1) {
                            $upt_s_j = "s";
                        } else {
                            $upt_s_j = "";
                        }
                        $vps_out .= _("Up time: ") . "{$uptime_j} day{$upt_s_j} {$uptime_h} hour{$upt_s_h} {$uptime_m} minute{$upt_s_m} {$uptime_s} seconde{$upt_s_s}<br>";
                        $vps_out .= _("Last boot date: ") . date("Y-m-d H:i:s", substr($vps_remote_info["start_time"], 0, strlen($vps_remote_info["start_time"]) - 2)) . "<br>";
                    }
                    $vps_out .= "<br>";
                }
            }
        }
    } else {
        $vps_out .= _("Could not connect to the VPS SOAP Server.");
    }
    $frm_start = "<form action=\"?\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">";
    // The ip address(es)
    $vps_ips = $vps["ip_addr"];
    $n = sizeof($vps_ips);
    if ($n > 1) {
        $ip_title = _("IP addresses: ");
    } else {
        $ip_title = _("IP address: ");
    }
    $out .= "<br><h3>" . $ip_title . "</h3>";
    $out .= dtcFormTableAttrs();
    for ($i = 0; $i < $n; $i++) {
        if ($i % 2) {
            $alt_color = 0;
        } else {
            $alt_color = 1;
        }
        $q = "SELECT * FROM {$pro_mysql_vps_ip_table} WHERE ip_addr='" . $vps_ips[$i] . "';";
        $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error());
        $n2 = mysql_num_rows($r);
        if ($n2 != 1) {
            $out .= _("Error line " . __LINE__ . " file " . __FILE__);
        } else {
            $a = mysql_fetch_array($r);
            $out .= dtcFormLineDraw($vps_ips[$i], "{$frm_start}<input type=\"hidden\" name=\"action\" value=\"set_ip_reverse_dns\">\n\t<input type=\"hidden\" name=\"ip_addr\" value=\"" . $vps_ips[$i] . "\">\n\t<input type=\"text\" name=\"rdns\" value=\"" . $a["rdns_addr"] . "\">\n</td><td><div class=\"input_btn_container\" onMouseOver=\"this.className='input_btn_container-hover';\"\nonMouseOut=\"this.className='input_btn_container';\">\n <div class=\"input_btn_left\"></div>\n <div class=\"input_btn_mid\"><input class=\"input_btn\" type=\"submit\" value=\"" . _("Change RDNS") . "\"></div>\n <div class=\"input_btn_right\"></div>\n</div></form>", $alt_color);
        }
    }
    $out .= "</table><br><br>";
    // VPS status
    $out .= "<h3>" . _("Current VPS status:") . "</h3><br>";
    $out .= $vps_out;
    // Start / stop VPS
    $out .= "<h3>" . _("Start and stop of your VPS:") . "</h3><br>";
    if ($vps_remote_info == "fsck") {
        $out .= _("Please wait until file system check is finished first.") . "<br><br>";
    } else {
        if ($vps_remote_info == "mkos") {
            $out .= _("Please wait until operating system reinstallation has completed.") . "<br><br>";
            $reinstall_os = 1;
        } else {
            if ($vps_remote_info == true) {
                $out .= $frm_start . "<input type=\"hidden\" name=\"action\" value=\"shutdown_vps\">\n" . submitButtonStart() . _("Gracefully shutdown (xm shutdown)") . submitButtonEnd() . "\n</form><br><br>";
                $out .= $frm_start . "<input type=\"hidden\" name=\"action\" value=\"destroy_vps\">\n" . submitButtonStart() . _("Immediate kill (xm destroy)") . submitButtonEnd() . "\n</form><br><br>";
                $out .= _("To do a file system check or an operating system reinstallation, you need to shutdown or destroy your server first.") . "<br><br>";
            } else {
                if ($expired == "yes") {
                    $out .= _("You cannot start your VPS if it has expired. Please renew it if you want the boot up (xm start) button to appear here.");
                } else {
                    $out .= $frm_start . "<input type=\"hidden\" name=\"action\" value=\"start_vps\">" . submitButtonStart() . _("Boot up (xm start)") . submitButtonEnd() . "<br><br></form>";
                }
                // FSCK
                $out .= "<h3>" . _("File-system check:") . "</h3><br>";
                $out .= $frm_start . "<input type=\"hidden\" name=\"action\" value=\"fsck_vps\">" . submitButtonStart() . _("File system check (fsck)") . submitButtonEnd() . "\n<br><br></form>";
                // OS reinstall
                $out .= "<h3>" . _("Reinstall operating system:") . "</h3><br>";
                $out .= _("Currently installed operating system: ") . $vps["operatingsystem"] . "<br>";
                $deb_selected = " ";
                $debdtc_selected = " ";
                $cent_selected = " ";
                $gen_selected = " ";
                $bsd_selected = " ";
                $xenhvm_selected = " ";
                switch ($vps["operatingsystem"]) {
                    case "debian":
                        $deb_selected = " selected ";
                        break;
                    case "debian-dtc":
                        $debdtc_selected = " selected ";
                        break;
                    case "centos":
                        $cent_selected = " selected ";
                        break;
                    case "netbsd":
                        $bsd_selected = " selected ";
                        break;
                    case "xenhvm":
                        $xenhvm_selected = " selected ";
                        break;
                    default:
                        break;
                }
                // Operating system selection popup and reinstallation button
                $out .= $frm_start . "<table><tr><td>" . _("Operating system:") . " </td><td><select name=\"os_type\">\n<option value=\"debian\" {$deb_selected}>Debian (" . _("network install with debootstrap") . ")</option>\n<option value=\"debian-dtc\" {$debdtc_selected}>Debian with DTC panel (" . _("network install with debootstrap") . ")</option>\n<option value=\"centos\" {$cent_selected}>CentOS (" . _("network install with yum") . ")</option>\n<option value=\"netbsd\" {$bsd_selected}>NetBSD (" . _("network setup with install kernel") . ")</option>\n<option value=\"xenhvm\" {$xenhvm_selected}>Xen HVM (" . _("boot on your own .iso image") . ")</option>";
                $installable_os = getInstallableOS($soap_client);
                $nbr_os = sizeof($installable_os);
                for ($i = 0; $i < $nbr_os; $i++) {
                    $os_name = $installable_os[$i];
                    if ($vps["operatingsystem"] == $os_name) {
                        $selected = " selected ";
                    } else {
                        $selected = "";
                    }
                    $out .= "<option value=\"{$os_name}\" {$selected}>{$os_name} (" . _("operating system image") . ")</option>";
                }
                $installable_app = getInstallableAPP($soap_client);
                $nbr_app = sizeof($installable_app);
                for ($i = 0; $i < $nbr_app; $i++) {
                    $app_name = $installable_app[$i];
                    if ($vps["operatingsystem"] == $os_name) {
                        $selected = " selected ";
                    } else {
                        $selected = "";
                    }
                    $out .= "<option value=\"{$app_name}\" {$selected}>{$app_name} (" . _("applicance builder") . ")</option>";
                }
                $out .= "</select></td></tr>\n<tr><td>" . "VPS root password:"******" </td><td><input type=\"password\" name=\"root_password\"><input type=\"hidden\" name=\"action\" value=\"reinstall_os\"></td></tr>\n<tr><td></td><td>" . submitButtonStart() . _("Reinstall operating system") . submitButtonEnd() . "\n</td></tr></table></form>";
                //		}
                // BSD kernel change popup
                if ($vps["operatingsystem"] == "netbsd") {
                    if ($vps["bsdkernel"] == "install") {
                        $normal_selected = " ";
                        $install_selected = " selected ";
                    } else {
                        $normal_selected = " selected ";
                        $install_selected = " ";
                    }
                    $out .= $frm_start . "<select name=\"bsdkernel\">\n    <option value=\"normal\" {$normal_selected}>Normal</option>\n    <option value=\"install\" {$install_selected}>Install</option>\n    </select><input type=\"hidden\" name=\"action\" value=\"change_bsd_kernel_type\">\n    " . submitButtonStart() . _("Change NetBSD kernel") . submitButtonEnd() . "\n    </form>";
                }
                if ($vps["operatingsystem"] == "xenhvm") {
                    $vps_xenhvm_iso = getVPSIso($vps_node, $vps_name, $soap_client);
                    $out .= "<br><br>" . _("To upload .iso files so they appear below and you can boot on them, you can upload them using ftp, ") . "xen{$vps_name}@{$vps_node}" . _(" using the password of your physical console.") . "<br><br>";
                    $boot_device_selector = "<select name=\"xenhvm_iso\">\n<option value=\"hdd\">" . _("Boot on hard drive") . "</option>";
                    $n_iso = sizeof($vps_xenhvm_iso);
                    if (is_array($vps_xenhvm_iso)) {
                        for ($i = 0; $i < $n_iso; $i++) {
                            $iso = $vps_xenhvm_iso[$i];
                            if ($vps["howtoboot"] == $iso) {
                                $selected = " selected ";
                            } else {
                                $selected = " ";
                            }
                            $boot_device_selector .= "<option value=\"" . htmlspecialchars($iso) . "\" {$selected}>" . htmlspecialchars($iso) . "</option>";
                        }
                    }
                    $boot_device_selector .= "</select>";
                    if ($vps["vncpassword"] == "no_vnc") {
                        $vncons_act_yes_selected = " ";
                        $vncons_act_no_selected = " checked ";
                    } else {
                        $vncons_act_yes_selected = " ";
                        $vncons_act_no_selected = " checked ";
                    }
                    $out .= dtcFormTableAttrs();
                    $out .= dtcFormLineDraw($frm_start . _("Boot device: "), "<input type=\"hidden\" name=\"action\" value=\"change_xenhvm_boot_iso\">" . $boot_device_selector, 1);
                    $out .= dtcFormLineDraw(_("VNC console password: "******"<input type=\"text\" name=\"vnc_console_pass\" value=\"\">", 0);
                    $out .= dtcFormLineDraw(_("VNC console activation: "), "<input type=\"radio\" name=\"vnc_console_activate\" value=\"yes\" {$vncons_act_yes_selected}>" . _("yes") . " <input type=\"radio\" name=\"vnc_console_activate\" value=\"no\" {$vncons_act_no_selected}>" . _("no"), 1);
                    $out .= dtcFormLineDraw("", submitButtonStart() . _("Write parameters") . submitButtonEnd(), 0);
                    $out .= "</table></form>";
                }
            }
        }
    }
    $out .= "<br><br>";
    // SSH Physical console password changing
    $out .= "<h3>" . _("Physical console last display and ssh access:") . "</h3><br>";
    $out .= "Once your VPS is installed, ssh to the physical console to use it for the first time." . "<br><br>";
    $out .= dtcFormTableAttrs();
    $out .= dtcFormLineDraw($frm_start . "<input type=\"hidden\" name=\"action\" value=\"change_xm_console_ssh_passwd\">" . _("New SSH password: "******"<input size=\"40\" type=\"text\" name=\"new_password\" value=\"\"></td><td>" . submitButtonStart() . _("Ok") . submitButtonEnd() . "</form>", 1);
    $out .= dtcFormLineDraw($frm_start . "<input type=\"hidden\" name=\"action\" value=\"change_xm_console_ssh_key\">" . _("New SSH key: "), "<input size=\"40\" type=\"text\" name=\"new_key\" value=\"\"></td><td>" . submitButtonStart() . _("Ok") . submitButtonEnd() . "</form>", 0);
    $out .= "</table>";
    $out .= "<br><br>" . _("To access to your console, first enter a ssh password or key above, and then ssh to:") . "<br>xen" . $vps_name . "@" . $vps_node . "<br><br>";
    $out .= "<br>" . _("You should then install sshd in your VPS and use the physical console only for debugging purposes.");
    $out .= "<br>" . helpLink("PmWiki/Setup-A-VPS-Once-DTC-Xen-Installed-It");
    /* FIXME probably don't need any of this stuff'
    
    	if($reinstall_os == 1){
    		if($panel_type == "admin"){
    			$path_url = "/dtcadmin";
    		}else{
    			$path_url = "/dtc";
    		}
    		$ajax_url = "https://".$_SERVER["SERVER_NAME"].$path_url."/xanjaxPushlet.php?";
    		$ajax_auth = "adm_login="******"&adm_pass="******"&vps_node=".$vps_node."&vps_name=".$vps_name;
    		$r = "";
    	}else{
    		$r = $soap_client->call("getVPSInstallLog",array("vpsname" => $vps_name,"numlines" => "20"),"","","");
    		$err = $soap_client->getError();
    		if($err){
    			$r = _("Could not get VPS install log. Error: ").$err._(" maybe there are no logs yet?");
    		}
    		// print_r($r);
    		$r = str_replace("\n\n","\n",$r);
    	}
    */
    // tested AJAX stuff starts here
    $out .= "<script language=\"javascript\" src=\"xanjaxXHR.js\"></script>";
    $out .= "<h3>" . _("Installation log (last 20 lines):") . "</h3><br>";
    $out .= "<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\">\n<tr><td bgcolor=\"black\"><font color=\"white\">{$vps_node}:{$vps_name}</font></td>\n<tr><td bgcolor=\"black\"><font color=\"white\"><pre id=\"reinstall_os_log\" class=\"reinstall_os_log\"><font color=\"red\">dtc-xen</font>@<font color=\"blue\">{$vps_node}</font>&gt;_ #<br>...</pre></font></td>\n</table>";
    $out .= "\n\t\t<script type=\"text/javascript\">\n\t\t\txanGet(logPushlet,\"logPushlet.php?vps_node=" . $vps_node . "&vps_name=" . $vps_name . "\");\n\t\t</script>";
    return $out;
}