$id_client = $admin["id_client"]; $q = "SELECT * FROM {$pro_mysql_client_table} WHERE id='{$id_client}';"; $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) { die("Client record not found line " . __LINE__ . " file " . __FILE__); } $client = mysql_fetch_array($r); $tld = find_domain_extension($edit_domain); if ($tld === FLASE) { die("Domain TLD not found line " . __LINE__ . " file " . __FILE__); } $price = find_domain_price($tld); if ($price === FALSE) { die("TLD price not found line " . __LINE__ . " file " . __FILE__); } $price = $_REQUEST["num_years"] * $price; $remaining = $client["dollar"] - $price; if ($remaining < 0) { die("Not enough money on the account line " . __LINE__ . " file " . __FILE__); } $renew_return = registry_renew_domain($edit_domain, $_REQUEST["num_years"]); // If renew successful, remove some money from the account, and update expiration date of the domain if ($renew_return["attributes"]["status"] == 0) { $q = "UPDATE {$pro_mysql_client_table} SET dollar='{$remaining}' WHERE id='{$id_client}';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $q = "UPDATE {$pro_mysql_domain_table} SET expiration_date=DATE_ADD(expiration_date, INTERVAL " . $_REQUEST["num_years"] . " YEAR) WHERE name='{$edit_domain}';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); } } }
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; }