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;
}
Example #2
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;
}
Example #3
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;
}
Example #4
0
function drawNameRenew($domain_name, $admin)
{
    global $adm_login;
    global $adm_pass;
    global $addrlink;
    global $renew_added_price;
    global $registry_api_modules;
    global $pro_mysql_client_table;
    global $pro_mysql_domain_table;
    $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=\"renew_domain\">\n<input type=\"hidden\" name=\"add_regortrans\" value=\"renew\">\n";
    //first step : renewable ?
    $domlookup = registry_check_renew($domain_name);
    if ($domlookup["is_success"] != 1) {
        $out = "<font color=\"red\">" . _("Could not connect to domain renew server: please try again later!") . "</font><br>" . $domlookup['response_text'];
        return $out;
    }
    if ($domlookup["attributes"]["renewable"] != 1) {
        $out = "<br>\n" . _("Sorry, the domain name ") . " <b>{$domain_name}</b> " . _("is NOT renewable. The registration server returned: ") . "<br><font color=\"red\">" . $domlookup["response_text"] . "</font>\n<br><br>";
        return $out;
    }
    $out = "<br><font color=\"green\">" . _("RENEW CHECK SUCCESSFUL") . "</font><br><br>";
    // second step : price and payment
    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;
    }
    $fqdn = $domain_name;
    $price = registry_get_domain_price($fqdn, 1);
    $fqdn_price = $price + $renew_added_price;
    $out .= "<i><u>Step3: Proceed for renew</u></i><br>";
    $out .= _("Remaining on your account: ") . " \$" . $remaining . "<br>\n" . _("Total price: ") . " \$" . $fqdn_price . "<br><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 renew " . $_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 renew " . $_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_renew"]) || $_REQUEST["toreg_confirm_renew"] != "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_renew\" value=\"yes\">\n<input type=\"submit\" value=\"" . _("Proceed to name-renew") . "\">\n</form><br><br>";
        return $out;
    }
    ///////////////////////////////////////
    // START OF DOMAIN NAME RENEW           //
    $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_renew_domain($domain_name);
    if ($regz["is_success"] != 1) {
        $out .= "<font color=\"red\"><b>" . _("Renew failed") . "</b></font><br>\n" . _("Server said: ") . "<i>" . $regz["response_text"] . "</i>";
        return $out;
    }
    $out .= "<font color=\"green\"><b>Renew 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());
    $out .= "<font color=\"green\"><b>" . _("Successfully renew your domain name") . "</b></font><br><br>";
    // END OF DOMAIN NAME RENEW //
    /////////////////////////////////////
    return $out;
}
Example #5
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;
}
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;
}
Example #7
0
                 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 ($newadmin["iscomp"] == "yes" && $newadmin["vat_num"] != "" && isset($cc_europe[$newadmin["country"]]) && isset($cc_europe[$company_invoicing["country"]]) && $newadmin["country"] != $company_invoicing["country"]) {
                         $vat_rate = 0;
                         $use_vat = "no";
                     } else {
                         $use_vat = "yes";
                         $vat_rate = $company_invoicing["vat_rate"];
                     }
                 }
                 $payid = createCreditCardPaiementID($product["price_dollar"] + $product["setup_fee"], $reguser["id"], $product["name"] . " (login: "******"reqadm_login"] . ")", "yes", $product["id"], $vat_rate);
                 $q = "UPDATE {$pro_mysql_new_admin_table} SET paiement_id='{$payid}' WHERE id='" . $reguser["id"] . "';";
                 $r = mysql_query($q) or die("Cannot query \"{$q}\" ! line: " . __LINE__ . " file: " . __FILE__ . " sql said: " . mysql_error());
                 $return_url = $_SERVER["PHP_SELF"] . "?action=return_from_pay&regid={$payid}";
                 $paybutton = paynowButton($payid, $product["price_dollar"] + $product["setup_fee"], $product["name"] . " (login: "******"reqadm_login"] . ")", $return_url, $vat_rate, $secpayconf_use_paypal_recurring);
             }
             if ($print_form == "yes") {
                 $master_total = $product["price_dollar"] + $product["setup_fee"];
                 $form = $reguser["mesg"] . "<br><h4>" . _("Registration successful!") . "<!--Registration successfull!--></h4>\n<u>" . _("Product name:") . "</u> " . $product["name"] . "<br>\n<u>" . _("Product price:") . "</u> " . $product["price_dollar"] . " {$secpayconf_currency_letters}<br>\n<u>" . _("Setup fees:") . "</u> " . $product["setup_fee"] . " {$secpayconf_currency_letters}<br>\n<u>" . _("Product net price before VAT and payment gateway:") . "</u> " . $master_total . " {$secpayconf_currency_letters}<br><br><br>\n<b>" . _("Please now click on the following button to go for payment:") . "</b><br>\n<br>{$paybutton}";
             }
         }
     }
 } else {
     if ($reguser["err"] == 1) {
         $form = registration_form();
     } else {