Файл: billing/order.php
Строк: 3708
<?
session_set_cookie_params(86400);
session_start();
$full_home_path = dirname(__FILE__);
require_once($full_home_path."/_rootload.php");
mconnect();
if ($elogin and $epassword and !$_SESSION["userId"] and $usertype == "exists") {
userLogOn($elogin,$epassword);
}
validateUser();
if (!EnableLanguages()) { error("Can not load languages."); mclose(); exit; }
if (!GetCurrentCurrency()) { print $_lang[ErrorGetCurrentCurrency]; mclose(); exit; }
if (!$step) {$step = 1;}
if ($prev) {$step--;}
if ($next) {$step++;}
$steps=3;
$needrules = GetSetting("needrules");
if ($step > 1) {
if (!$_SESSION['userId'] and $usertype == "exists") {
if (!$elogin) {$error = $_lang[ErrorNoLogin];}
else if (!$epassword) {$error = $_lang[ErrorNoPassword];}
else {
$auth=userLogOn($elogin,$epassword);
if ($auth == '-1') {$error=$_lang[ErrorNonExistsLogin];}
else if (!$auth) {$error=$_lang[ErrorBadPassword];}
}
} else if (!$_SESSION['userId'] and $usertype == "new") {
$login=strtolower($login);
if (!$login) {$error=$_lang[ErrorNoLogin];}
else if (preg_match("/^[0-9]/ui",$login)) {$error=$_lang[OrderErrorLoginBegin];}
else if (preg_match("/[^a-z0-9]/ui",$login)) {$error=$_lang[OrderErrorLoginSymbols];}
else if (strlen($login) < 3 or strlen($login) > 10) {$error=$_lang[OrderErrorLoginLength];}
else if (!$password) {$error=$_lang[ErrorNoPassword];}
else if (!$repassword) {$error=$_lang[ErrorPasswordNoConfirm];}
else if (strlen($password) < 6) {$error=$_lang[ErrorPasswordLength];}
else if ($password != $repassword) {$error=$_lang[ErrorPasswordConfirm];}
else if (!valid_email($email)) {$error=$_lang[OrderErrorWrongEmail];}
else if (IsEmailUsed($email)) {$error=$_lang[OrderErrorEmailExists];}
else if ($needrules and !$rules) {$error=$_lang[OrderErrorNoRules];}
else {
$r=@mysql_query("select * from users where login='$login'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($r) > 0) {$error=$_lang[OrderErrorLoginExists];}
else {
if ($step > 3 or $type == "partner") {
if (!$_SESSION['userId'] and $usertype == "new") {
if ((GetSetting("captcha_reg") and $_SESSION['captchakey'] == $captchakeyin) or !GetSetting("captcha_reg")) {
if ($_SESSION["userLang"]) {$user_lng = $_SESSION["userLang"];}
@mysql_query("insert into users (login,password,email,datareg,referal,aboutusfromid,currency,lang) values('$login','".crypt($password)."','$email',NOW(),'$referal','$aboutusfromid','".strtoupper($valuta)."','$user_lng')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
userLogOn("$login","$password");
@mysql_query("insert into users_profile (uid,email) values('".$_SESSION["userId"]."','$email')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$profileId=mysql_insert_id();
@mysql_query("update users SET defaultProfileId='$profileId' where id='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
} else if ($type == "partner") {
$error=$_lang[ErrorWrongCaptcha];
}
}
}
}
}
}
if (!$error and $type == "h") {
$t = GetTarifById($tarif_id);
$PAGE_TITLE_ITEMNAME = $t->name;
if ($selectedZone) {$zone = $selectedZone;}
if ($domain and $zone) {
$domain=strtolower($domain); $fulldomain=strtolower($domain.".".$zone);
$zones=@mysql_query("select * from zones where zone='$zone' and active='1' order by isDefault desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($zones) > 1) {
$selectRegistratorFlag = 1;
}
if (!$zone_id) {
$zone_one=mysql_fetch_object($zones);
$zone_id = $zone_one->id;
}
$tzones=@mysql_query("select * from zones where zone='$zone' and id='$zone_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$tzones=mysql_fetch_object($tzones);
$zid=$tzones->id;
$domainMinSrok=$tzones->minsrok;
$domainCost=$tzones->cost_if_not_host*($domainMinSrok/12);
}
else {$fulldomain=strtolower($otherdomain); $fulldomain=preg_replace("/^www./ui","",$fulldomain);}
if ($fulldomain) {
$dom=new domain($fulldomain);
$r=@mysql_query("select * from orders where domain='$fulldomain' and domain_reg='0' and todate>NOW()") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$k=@mysql_query("select * from orders_domains where domain='$fulldomain' and todate>NOW()") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
if (!$tarif_id) {$error=$_lang[OrderErrorNoTarif];}
else if ($domain_reg == '') {$error=$_lang[OrderErrorNoDomainReg];}
else if (((!$domain or !$zone) and $domain_reg == "1") or (!$otherdomain and $domain_reg == "0")) {$error=$_lang[OrderErrorNoDomain];}
else if ($domain_reg == "1" and (mb_strlen($domain) < $tzones->minWidth or mb_strlen($domain) > $tzones->maxWidth)) { $error = $_lang[OrderErrorDomainLength];$error=str_replace("{minWidth}",$tzones->minWidth,$error);$error=str_replace("{maxWidth}",$tzones->maxWidth,$error);}
else if ($domain_reg == "0" and !preg_match("/^[a-zа-яёЁ0-9]{1}[a-zа-яёЁ0-9-]*[a-zа-яёЁ0-9]{1}.[a-zа-яёЁ0-9-.]*[a-zа-яёЁ0-9]{1}$/u",$fulldomain)) { $error = $_lang[OrderErrorDomainSymbols];}
else if ($domain_reg == "1" and !preg_match("/^[a-zа-яёЁ0-9]{1}[a-zа-яёЁ0-9-]*[a-zа-яёЁ0-9]{1}$/u",$domain)) { $error = $_lang[OrderErrorDomainSymbols];}
else if ($domain_reg == "1" and !$dom->is_available()) {$error=$_lang[OrderErrorDomainRegistered]; $domainNotAvailable=1;}
else if (@mysql_num_rows($r) > 0) {$error=$_lang[OrderErrorTarifForDomainOrderByAnotherUser];}
else if ($domain_reg == "1" and @mysql_num_rows($k) > 0) {$error=$_lang[OrderErrorDomainOrderByAnotherUser];}
else if ($_SESSION['userId']) {
$tarifSpecCost = GetSpecialCost($_SESSION['userId'],"tarif",$t->id);
if ($tarifSpecCost) {
$t->cost_setup = $tarifSpecCost["cost1"];
$t->cost = $tarifSpecCost["cost2"];
}
$domainCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,1);
$domainCost=$domainCost*($domainMinSrok/12);
}
}
if (!$error and $type == "d") {
if ($selectedZone) {$zone = $selectedZone;}
$domain=strtolower($domain); $fulldomain=strtolower($domain.".".$zone);
$PAGE_TITLE_ITEMNAME = $fulldomain;
if ($zone) {
$zones=@mysql_query("select * from zones where zone='$zone' and active='1' order by isDefault desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($zones) > 1) {
$selectRegistratorFlag = 1;
}
if (!$zone_id) {
$zone_one=mysql_fetch_object($zones);
$zone_id = $zone_one->id;
}
$tzones=@mysql_query("select * from zones where zone='$zone' and id='$zone_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$tzones=mysql_fetch_object($tzones);
$zid=$tzones->id;
$domainMinSrok=$tzones->minsrok;
// if ($tzones->action > 0)
// {
// $domainCost=$tzones->action*($domainMinSrok/12);
// }
// else
// {
$domainCost=$tzones->cost_if_not_host*($domainMinSrok/12);
// }
}
if ($fulldomain) {
$dom=new domain($fulldomain);
$k=@mysql_query("select * from orders_domains where domain='$fulldomain' and todate>NOW()") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
if (!$domain or !$zone) {$error=$_lang[OrderErrorNoDomain];}
else if (mb_strlen($domain) < $tzones->minWidth or mb_strlen($domain) > $tzones->maxWidth) { $error = $_lang[OrderErrorDomainLength]; $error=str_replace("{minWidth}",$tzones->minWidth,$error);$error=str_replace("{maxWidth}",$tzones->maxWidth,$error);}
else if (!preg_match("/^[a-zа-яёЁ0-9]{1}[a-zа-яёЁ0-9-]*[a-zа-яёЁ0-9]{1}$/u",$domain)) { $error = $_lang[OrderErrorDomainSymbols];}
else if (!$dom->is_available()) {$error=$_lang[OrderErrorDomainRegistered]; $domainNotAvailable=1;}
else if (@mysql_num_rows($k) > 0) {$error=$_lang[OrderErrorDomainOrderByAnotherUser];}
else if ($_SESSION['userId']) {
$domainCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,0);
$domainCost=$domainCost*($domainMinSrok/12);
}
}
if (!$error and $type == "dopt") {
if ($freedomains == '') {$error=$_lang[OrderErrorNoFreeDomains];}
else if (!$dnstype) {$error=$_lang[OrderErrorNoDnsType];}
}
if (!$error and $type == "shop") {
$t = GetShopItemById($item_id);
$PAGE_TITLE_ITEMNAME = $t->name;
if (!$item_id) {$error=$_lang[OrderErrorNoItem];}
else if ($_SESSION['userId']) {
$itemSpecCost = GetSpecialCost($_SESSION['userId'],"shop",$t->id);
if ($itemSpecCost) {
$t->cost = $tarifSpecCost["cost1"];
}
}
}
if (!$error and $type == "partner") {
$chkProfile = GetSetting("checkprofiletype");
$resCheckProfile = checkProfile($chkProfile, $_SESSION["userId"]);
if (!$resCheckProfile) {
Header("Location: billing.php?do=profile");
} else {
Header("Location: billing.php?do=partner");
}
}
}
if ($step > 2 and !$error and $type == "h") {
if (!$months) {$error=$_lang[OrderErrorNoSrokZakaza];}
else {
$hostmonths = $months;
$host_setup = $t->cost_setup;
$hostcost = $t->cost;
$tsroki=@mysql_query("select discount from tarifs_sroki where tarif_id='$tarif_id' and months='$hostmonths'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($tsroki) > 0) {
$tsroki=mysql_fetch_object($tsroki);
$srokDiscount=$tsroki->discount;
} else {
$srokDiscount=0;
}
$host=$hostcost*$hostmonths; $host=$host-($host/100)*$srokDiscount+$host_setup;
# Учитываем скидку на хостинг при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $host > 0) {
$host=$host-($host/100)*GetAboutUsFromDiscount($aboutusfromid,'host');
}
$host=round($host,2);
$addonsCost=0;
if (@is_array($addons)) {$selectedAddons=$addons;} else {$selectedAddons=@split(":x:",$addons);}
$addonsToSave="";
$addonsToSaveText="";
while (list($k,$v) = @each($selectedAddons)) {
if ($v) {
$selectedAddon = GetAddonById($v);
if ($addonsToSaveText) {
$addonsToSaveText = $addonsToSaveText.", ".$selectedAddon->name;
} else {
$addonsToSaveText = $selectedAddon->name;
}
if ($addonsToSave) {
$addonsToSave = $addonsToSave.":x:$selectedAddon->id";
} else {
$addonsToSave = $selectedAddon->id;
}
#Устанавливаем спец. цену, если она указана для данной доп. услуги и данного пользователя
#
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$selectedAddon->id);
if ($addonSpecCost) {
$addonsCost += $addonSpecCost["cost1"];
$addonsCost += $addonSpecCost["cost2"]*$hostmonths;
} else {
$addonsCost += $selectedAddon->cost_start;
$addonsCost += $selectedAddon->cost_monthly*$hostmonths;
}
}
}
if (!$addonsToSaveText) { $addonsToSaveText=$_lang[No]; }
# Учитываем скидку на доп. услуги при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $addonsCost > 0) {
$addonsCost=$addonsCost-($addonsCost/100)*GetAboutUsFromDiscount($aboutusfromid,'addon');
}
$addonsCost=round($addonsCost,2);
$dom=0;
if ($domain_reg == "1") {
$domaincost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,1);
# #Устанавливаем спец. цену, если она указана для данной доменной зоны и данного пользователя
# #
# $domSpecCost = GetSpecialCost($_SESSION['userId'],"zone",$tzones->id);
# if ($domSpecCost) {
# $domaincost=$domSpecCost["cost1"];
# } else {
# $domaincost=$tzones->cost_if_host;
# }
$domainminsrok=$tzones->minsrok;
$dom=$domaincost*($domainminsrok/12);
# Учитываем скидку на домен при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $dom > 0) {
$dom=$dom-($dom/100)*GetAboutUsFromDiscount($aboutusfromid,'domain');
}
$dom=round($dom,2);
$allsumm = $host+$dom+$addonsCost;
$domainfree = 0;
$tfreedomains=@mysql_query("select * from tarifs_freedomains where tarif_id='$tarif_id' and zone='$zone' and hostmonths='$hostmonths'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($tfreedomains) > 0) {$domainfree=1;}
$tfreedomains=@mysql_query("select * from tarifs_freedomains where tarif_id='$tarif_id' and zone='$zone' and ordersum > 0 and ordersum <= $allsumm") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($tfreedomains) > 0) {$domainfree=1;}
if ($domainfree) {$dom=0; $bonus=$_lang[OrderFreeDomainInZone]." .$zone";}
}
$allsumm = $host+$dom+$addonsCost;
}
}
if ($step > 2 and !$error and $type == "d") {
$ns1=trim($ns1); $ns1 = preg_replace("/.$/ui","",$ns1);
$ns2=trim($ns2); $ns2 = preg_replace("/.$/ui","",$ns2);
$ns3=trim($ns3); $ns3 = preg_replace("/.$/ui","",$ns3);
$ns4=trim($ns4); $ns4 = preg_replace("/.$/ui","",$ns4);
if (!$ns1) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns1)) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if (preg_match("/.$fulldomain$/u",$ns1)) {$error=$_lang[OrderErrorNoOwnNS];}
else if (!$ns2) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns2)) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if (preg_match("/.$fulldomain$/u",$ns2)) {$error=$_lang[OrderErrorNoOwnNS];}
else if ($ns3 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns3)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($ns3 and preg_match("/.$fulldomain$/u",$ns3)) {$error=$_lang[OrderErrorNoOwnNS];}
else if ($ns4 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns4)) {$error=$_lang[OrderErrorNoFourNS];}
else if ($ns4 and preg_match("/.$fulldomain$/u",$ns4)) {$error=$_lang[OrderErrorNoOwnNS];}
else if ($ns1 == $ns2) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if ($ns3 and ($ns3 == $ns1 or $ns3 == $ns2)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($ns4 and ($ns4 == $ns1 or $ns4 == $ns2 or $ns4 == $ns3)) {$error=$_lang[OrderErrorNoFourNS];}
else {
# Учитываем скидку на домен при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $domainCost > 0) {
$domainCost=$domainCost-($domainCost/100)*GetAboutUsFromDiscount($aboutusfromid,'domain');
}
$domainCost=round($domainCost,2);
$allsumm = $domainCost;
}
}
if ($step > 2 and !$error and $type == "dopt") {
if ($dnstype == "each") {
$nodnsflag=false;
$noowndnsflag=false;
$freedom = @mb_split("rn",$freedomains);
while (list($k,$v) = @each($freedom)) {
$dns1[$v]=trim($dns1[$v]); $dns1[$v] = preg_replace("/.$/ui","",$dns1[$v]);
$dns2[$v]=trim($dns2[$v]); $dns2[$v] = preg_replace("/.$/ui","",$dns2[$v]);
$dns3[$v]=trim($dns3[$v]); $dns3[$v] = preg_replace("/.$/ui","",$dns3[$v]);
$dns4[$v]=trim($dns4[$v]); $dns4[$v] = preg_replace("/.$/ui","",$dns4[$v]);
if (!$dns1[$v] or !$dns2[$v]) {$nodnsflag=true;}
if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$dns1[$v]) or !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$dns2[$v])) {$nodnsflag=true;}
if ($dns3[$v] and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$dns3[$v])) {$nodnsflag=true;}
if ($dns4[$v] and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$dns4[$v])) {$nodnsflag=true;}
if (preg_match("/.$v$/u",$dns1[$v]) or preg_match("/.$v$/u",$dns2[$v])) {$noowndnsflag=true;}
if ($dns3[$v] and preg_match("/.$v$/u",$dns3[$v])) {$noowndnsflag=true;}
if ($dns4[$v] and preg_match("/.$v$/u",$dns4[$v])) {$noowndnsflag=true;}
if ($dns1[$v] == $dns2[$v]) {$nodnsflag=true;}
if ($dns3[$v] and ($dns3[$v] == $dns1[$v] or $dns3[$v] == $dns2[$v])) {$nodnsflag=true;}
if ($dns4[$v] and ($dns4[$v] == $dns1[$v] or $dns4[$v] == $dns2[$v] or $dns4[$v] == $dns3[$v])) {$nodnsflag=true;}
}
} else if ($dnstype == "one") {
$ns1=trim($ns1); $ns1 = preg_replace("/.$/ui","",$ns1);
$ns2=trim($ns2); $ns2 = preg_replace("/.$/ui","",$ns2);
$ns3=trim($ns3); $ns3 = preg_replace("/.$/ui","",$ns3);
$ns4=trim($ns4); $ns4 = preg_replace("/.$/ui","",$ns4);
$noowndnsflag=false;
$freedom = @mb_split("rn",$freedomains);
while (list($k,$v) = @each($freedom)) {
if (preg_match("/.$v$/u",$ns1) or preg_match("/.$v$/u",$ns2)) {$noowndnsflag=true;}
if ($ns3 and preg_match("/.$v$/u",$ns3)) {$noowndnsflag=true;}
if ($ns4 and preg_match("/.$v$/u",$ns4)) {$noowndnsflag=true;}
}
}
if ($dnstype == "one" and !$ns1) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if ($dnstype == "one" and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns1)) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if ($dnstype == "one" and !$ns2) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if ($dnstype == "one" and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns2)) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if ($dnstype == "one" and $ns3 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns3)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($dnstype == "one" and $ns4 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns4)) {$error=$_lang[OrderErrorNoFourNS];}
else if ($dnstype == "one" and $ns1 == $ns2) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if ($dnstype == "one" and $ns3 and ($ns3 == $ns1 or $ns3 == $ns2)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($dnstype == "one" and $ns4 and ($ns4 == $ns1 or $ns4 == $ns2 or $ns4 == $ns3)) {$error=$_lang[OrderErrorNoFourNS];}
else if ($dnstype == "each" and $nodnsflag) {$error=$_lang[OrderErrorNoOneOfNS];}
else if ($noowndnsflag) {$error=$_lang[OrderErrorNoOwnNS];}
else {
$freedom = @mb_split("rn",$freedomains);
$domainCostArr = array(); $domainMinSrokArr = array();
while (list($k,$v) = each($freedom)) {
$arr=""; $domain=""; $zone="";
preg_match("/^([^.]+).(.+)$/ui",$v,$arr);
$domain=$arr[1]; $zone=$arr[2];
$domain=strtolower($domain); $fulldomain=strtolower($domain.".".$zone);
if ($zone_id[$v]) {
$zid = $zone_id[$v];
} else {
$zid=@mysql_query("select * from zones where zone='$zone' and active='1' order by isDefault desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$zid=mysql_fetch_object($zid); $zid=$zid->id;
}
$tzones=@mysql_query("select * from zones where zone='$zone' and id='$zid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$tzones=mysql_fetch_object($tzones);
$domainCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,0);
# if (IsUserDomainReseller($_SESSION['userId'])) {
# $domainCost=$tzones->cost_if_domainreseller;
# } else if (IsUserActiveReseller($_SESSION['userId'])) {
# $domainCost=$tzones->cost_if_reseller;
# } else {
# $domainCostType = GetSetting("domainCostType");
#
# if ($domainCostType and IsUserHaveActiveOrders($_SESSION['userId'])) { $domainCost=$tzones->cost_if_host; }
# else { $domainCost=$tzones->cost_if_not_host; }
# }
#
# # Устанавливаем спец.цену, если она есть для данной доменной зоны и данного пользователя
# $domSpecCost = GetSpecialCost($_SESSION['userId'],"zone",$zid);
# if ($domSpecCost) {
# $domainCost = $domSpecCost["cost1"];
# }
$domainMinSrok=$tzones->minsrok;
$domainCost=$domainCost*($domainMinSrok/12);
# Учитываем скидку на домен при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid) {
$domainCost=$domainCost-($domainCost/100)*GetAboutUsFromDiscount($aboutusfromid,'domain');
}
$domainCost=round($domainCost,2);
$domainCostArr[$v] = $domainCost;
$domainMinSrokArr[$v] = $domainMinSrok;
$allsumm = $allsumm + $domainCost;
}
}
}
if ($step > 2 and !$error and $type == "shop") {
if ($t->costtype != "one" and !$months) {$error=$_lang[OrderErrorNoSrokZakaza];}
else {
$itemmonths = $months;
$itemcost = $t->cost;
if ($t->costtype == "month") {
$itemcost=$itemcost*$itemmonths;
} else if ($t->costtype == "year") {
$itemcost=$itemcost*($itemmonths/12);
}
# Учитываем скидку на товары при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $itemcost > 0) {
$itemcost=$itemcost-($itemcost/100)*GetAboutUsFromDiscount($aboutusfromid,'shop');
}
$itemcost=round($itemcost,2);
$allsumm = $itemcost;
}
}
if ($step > 3 and !$error) {
if (GetSetting("orderShowServerName") and ($vid == "vds" or $vid == "dedicated") and !$servername) {$error=$_lang[OrderErrorServerName];}
else if (GetSetting("orderShowAdminPassword") and ($vid == "vds" or $vid == "dedicated") and !$adminpassword) {$error=$_lang[OrderErrorAdminPassword];}
else if (GetSetting("captcha_reg") and $_SESSION['captchakey'] != $captchakeyin) {$error=$_lang[ErrorWrongCaptcha];}
else {
if ($promocode) {
$coupon = GetCoupon("promo",$promocode);
if (IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
$promoId = $coupon->id;
$promoSkidka = $coupon->value;
$promoTXT = ", promo-code $promocode";
}
}
if ($type == "h") {
if (($zone == "ru" or $zone == "su") and $domain_reg == "1") {$isRuDomain="&isR=1";}
else if ($domain_reg == "1") {$isDomain="&isD=1";}
if ($server) { $serverid = $server; } else { $serverid = 0; }
if (GetSetting("orderShowServerName") and ($vid == "vds" or $vid == "dedicated")) { $commentAddon = $commentAddon.$_lang[OrderServerName].": $servernamen"; }
if (GetSetting("orderShowAdminPassword") and ($vid == "vds" or $vid == "dedicated")) { $commentAddon = $commentAddon.$_lang[OrderAdminPassword].": $adminpasswordn"; }
if (GetSetting("orderShowRootPassword") and ($vid == "vds" or $vid == "dedicated")) { $commentAddon = $commentAddon.$_lang[OrderRootPassword].": $rootpasswordn"; }
if ($commentAddon) { if ($comment) {$comment = $commentAddon."n".$comment;} else {$comment = $commentAddon;} }
@mysql_query("insert into orders (uid,tarif,domain,domain_reg,addons,orderdate,comment,serverid,testPeriod) values('".$_SESSION['userId']."','$tarif_id','$fulldomain','$domain_reg','$addonsToSave',NOW(),'$comment','$serverid','$testPeriodNeed')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$host_id=mysql_insert_id();
if ($domain_reg == "1") {
$zid=@mysql_query("select * from zones where zone='$zone' and id='$zone_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$zid=mysql_fetch_object($zid); $zid=$zid->id;
@mysql_query("insert into orders_domains (uid,zone_id,host_id,domain,orderdate,profileId) values ('".$_SESSION['userId']."','$zid','$host_id','$fulldomain',NOW(),'$profileId')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$domain_id=mysql_insert_id();
}
if ($promoSkidka) {
$host = round($host-$host/100*$promoSkidka,2);
$dom = round($dom-$dom/100*$promoSkidka,2);
$addonsCost = round($addonsCost-$addonsCost/100*$promoSkidka,2);
}
@mysql_query("insert into bills (uid,host_id,domain_id,host_srok,domain_srok,money_host,money_domain,money_addons,created) values('".$_SESSION['userId']."','$host_id','$domain_id','$hostmonths','$domainminsrok','$host','$dom','$addonsCost',NOW())") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$bill_id=mysql_insert_id();
$sid=sprintf("%04d", $bill_id);
addUserLog($_SESSION['userId'],'order',"$t->name, $hostmonths мес., $fulldomain [".$_newreg[$domain_reg]."]$promoTXT");
AddUsedByToCoupon($promoId,$_SESSION["userId"],$bill_id);
$tpl = GetTpl('email_touser_'.$vid.'_order', $_SESSION["userLang"]);
$subject = $tpl[subject]; $template = $tpl[template];
if ($subject and $template) {
$company_name=GetSetting('company_name');
$company_url=GetSetting('company_url');
$billing_url=GetSetting('billing_url');
$support_url=GetSetting('support_url');
$manager_email=GetSetting('manager_email');
if ($elogin and $epassword and $usertype == "exists") {$tl=strtolower($elogin); $tp=$epassword;}
else if ($login and $password and $usertype == "new") {$tl=strtolower($login); $tp=$password;}
else {$tl=$_SESSION["userLogin"]; $tp='******';}
$template = str_replace('{company_name}',$company_name,$template);
$template = str_replace('{company_url}',$company_url,$template);
$template = str_replace('{billing_url}',$billing_url,$template);
$template = str_replace('{support_url}',$support_url,$template);
$template = str_replace('{tarif}',$t->name,$template);
$template = str_replace('{srok}',$hostmonths,$template);
$template = str_replace('{domain}',$fulldomain,$template);
$template = str_replace('{bonus}',$bonus,$template);
$template = str_replace('{addons}',$addonsToSaveText,$template);
$template = str_replace('{newreg}',$_newreg[$domain_reg],$template);
$template = str_replace('{login}',$tl,$template);
$template = str_replace('{password}',$tp,$template);
$template = str_replace('{schet}',$sid,$template);
$template = str_replace('{hostcost}',round($host*CURK,2)." ".CURS,$template);
$template = str_replace('{domaincost}',round($dom*CURK,2)." ".CURS,$template);
$template = str_replace('{addonscost}',round($addonsCost*CURK,2)." ".CURS,$template);
$template = str_replace('{cost}',round(($host+$dom+$addonsCost)*CURK,2)." ".CURS,$template);
$template = str_replace('{paymethod}','',$template);
if ($comment) { $comment = $_lang[OrderComment].":n".$comment; }
$template = str_replace('{comment}',$comment,$template);
$template = str_replace('{userid}',$_SESSION['userId'],$template);
WriteMailLog($subject,$template,$_SESSION['userId']);
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template);
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template);
$subject = "Duplicate: ".$subject;
$admEmails=GetAdminEmailsWhereTrueParam("sendneworder");
if (count($admEmails) > 0) {
WriteMailLog($subject,$template);
}
while (list($i,$em) = @each($admEmails)) {
sendmail($em,'',$manager_email,$subject,$template);
}
if ($testPeriodNeed) {
$subject = "Заказ тестового периода";
$template = "Клиент $tl заказал тестовый период для заказа ID $host_id, $fulldomain для тарифного плана $t->namernrn--rnRootPanel";
$admEmails=GetAdminEmailsWhereTrueParam("sendneworder");
if (count($admEmails) > 0) {
WriteMailLog($subject,$template);
}
while (list($i,$em) = @each($admEmails)) {
sendmail($em,'',$manager_email,$subject,$template);
}
}
}
if ($isRuDomain) { $isR = 1; $chkProfile = "max"; } else if ($isDomain) { $isD = 1; $chkProfile = "min"; } else { $chkProfile = GetSetting("checkprofiletype"); }
$resCheckProfile = checkProfile($chkProfile, $_SESSION["userId"], $profileId);
if (!$resCheckProfile) {
if (GetSetting("testPeriodEnable") and $t->testPeriod and $testPeriodNeed) {
$testAddon = "&testPeriod=1&testPeriodHostId=$host_id";
}
Header("Location: billing.php?do=profile&fromreg=1&bill_id=$bill_id&profileId=$profileId$testAddon".$isRuDomain.$isDomain);
} else {
if (GetSetting("testPeriodEnable") and $t->testPeriod and $testPeriodNeed) {
if (GetSetting("testPeriodAutoCreate")) {
if (createUser($host_id)) {
$testPeriodCreated = 1;
}
}
$testAddon = "&testPeriod=1&testPeriodCreated=$testPeriodCreated";
}
Header("Location: billing.php?do=pay&fromreg=1&id=$bill_id$testAddon");
}
}
if ($type == "d") {
if ($zone == "ru" or $zone == "su") {$isRuDomain="&isR=1";}
else {$isDomain="&isD=1";}
@mysql_query("insert into orders_domains (uid,zone_id,domain,orderdate,comment,ns1,ns2,ns3,ns4,profileId) values ('".$_SESSION['userId']."','$zid','$fulldomain',NOW(),'$comment','$ns1','$ns2','$ns3','$ns4','$profileId')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$domain_id=mysql_insert_id();
if ($promoSkidka) {
$domainCost = round($domainCost-$domainCost/100*$promoSkidka,2);
}
@mysql_query("insert into bills (uid,domain_id,domain_srok,money_domain,created) values('".$_SESSION['userId']."','$domain_id','$domainMinSrok','$domainCost',NOW())") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$bill_id=mysql_insert_id();
$sid=sprintf("%04d", $bill_id);
addUserLog($_SESSION['userId'],'orderdomain',"$fulldomain, ".(($domainMinSrok/12))." г.$promoTXT");
AddUsedByToCoupon($promoId,$_SESSION["userId"],$bill_id);
$tpl=GetTpl('email_touser_domain_order', $_SESSION["userLang"]);
$subject = $tpl[subject]; $template = $tpl[template];
if ($subject and $template) {
$company_name=GetSetting('company_name');
$company_url=GetSetting('company_url');
$billing_url=GetSetting('billing_url');
$support_url=GetSetting('support_url');
$manager_email=GetSetting('manager_email');
if ($elogin and $epassword and $usertype == "exists") {$tl=strtolower($elogin); $tp=$epassword;}
else if ($login and $password and $usertype == "new") {$tl=strtolower($login); $tp=$password;}
else {$tl=$_SESSION["userLogin"]; $tp='******';}
$template = str_replace('{company_name}',$company_name,$template);
$template = str_replace('{company_url}',$company_url,$template);
$template = str_replace('{billing_url}',$billing_url,$template);
$template = str_replace('{support_url}',$support_url,$template);
$template = str_replace('{domain}',$fulldomain,$template);
$template = str_replace('{login}',$tl,$template);
$template = str_replace('{password}',$tp,$template);
$template = str_replace('{schet}',$sid,$template);
$template = str_replace('{domaincost}',round($domainCost*CURK,2)." ".CURS,$template);
$template = str_replace('{cost}',round($domainCost*CURK,2)." ".CURS,$template);
$template = str_replace('{srok}',($domainMinSrok/12),$template);
$template = str_replace('{paymethod}','',$template);
if ($comment) { $comment = "Комментарий:n".$comment; }
$template = str_replace('{comment}',$comment,$template);
if ($ns1 or $ns2) { $ns = "NS1: $ns1nNS2: $ns2nNS3: $ns3nNS4: $ns4nn"; }
$template = str_replace('{ns}',$ns,$template);
$template = str_replace('{userid}',$_SESSION['userId'],$template);
WriteMailLog($subject,$template,$_SESSION['userId']);
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template);
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template);
$subject = "Duplicate: ".$subject;
$admEmails=GetAdminEmailsWhereTrueParam("sendneworder");
if (count($admEmails) > 0) {
WriteMailLog($subject,$template);
}
while (list($i,$em) = @each($admEmails)) {
sendmail($em,'',$manager_email,$subject,$template);
}
}
if ($isRuDomain) { $isR = 1; $chkProfile = "max"; } else if ($isDomain) { $isD = 1; $chkProfile = "min"; } else { $chkProfile = GetSetting("checkprofiletype"); }
$resCheckProfile = checkProfile($chkProfile, $_SESSION["userId"], $profileId);
if (!$resCheckProfile) {
Header("Location: billing.php?do=profile&fromreg=1&bill_id=$bill_id&profileId=$profileId".$isRuDomain.$isDomain);
} else {
Header("Location: billing.php?do=pay&fromreg=1&id=$bill_id");
}
}
if ($type == "dopt") {
$freedom = @mb_split("rn",$freedomains);
while (list($k,$v) = each($freedom)) {
$arr=""; $res=""; $domain=""; $zone="";
preg_match("/^([^.]+).(.+)$/ui",$v,$arr);
$domain=$arr[1]; $zone=$arr[2];
$domain=strtolower($domain); $fulldomain=strtolower($domain.".".$zone);
if ($dnstype == "each") {
$ns1 = $dns1[$v];
$ns2 = $dns2[$v];
$ns3 = $dns3[$v];
$ns4 = $dns4[$v];
}
if ($profile_id[$v]) { $profileId = $profile_id[$v]; }
if ($zone_id[$v]) {
$zid = $zone_id[$v];
} else {
$zid=@mysql_query("select * from zones where zone='$zone' and active='1' order by isDefault desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$zid=mysql_fetch_object($zid); $zid=$zid->id;
}
@mysql_query("insert into orders_domains (uid,zone_id,domain,orderdate,comment,ns1,ns2,ns3,ns4,profileId) values ('".$_SESSION['userId']."','$zid','$fulldomain',NOW(),'$comment','$ns1','$ns2','$ns3','$ns4','$profileId')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$domain_id=mysql_insert_id();
if ($promoSkidka) {
$domainCostArr[$v] = round($domainCostArr[$v]-$domainCostArr[$v]/100*$promoSkidka,2);
}
@mysql_query("insert into bills (uid,domain_id,domain_srok,money_domain,created) values('".$_SESSION['userId']."','$domain_id','".$domainMinSrokArr[$v]."','".$domainCostArr[$v]."',NOW())") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$bill_id=mysql_insert_id();
addUserLog($_SESSION['userId'],'orderdomain',"$fulldomain, ".(($domainMinSrokArr[$v]/12))." г.$promoTXT");
AddUsedByToCoupon($promoId,$_SESSION["userId"],$bill_id);
$tpl=GetTpl('email_touser_domain_order', $_SESSION["userLang"]);
$subject = $tpl[subject]; $template = $tpl[template];
if ($subject and $template) {
$sid=sprintf("%04d", $bill_id);
$company_name=GetSetting('company_name');
$company_url=GetSetting('company_url');
$billing_url=GetSetting('billing_url');
$support_url=GetSetting('support_url');
$manager_email=GetSetting('manager_email');
if ($elogin and $epassword and $usertype == "exists") {$tl=strtolower($elogin); $tp=$epassword;}
else if ($login and $password and $usertype == "new") {$tl=strtolower($login); $tp=$password;}
else {$tl=$_SESSION["userLogin"]; $tp='******';}
$template = str_replace('{company_name}',$company_name,$template);
$template = str_replace('{company_url}',$company_url,$template);
$template = str_replace('{billing_url}',$billing_url,$template);
$template = str_replace('{support_url}',$support_url,$template);
$template = str_replace('{domain}',$fulldomain,$template);
$template = str_replace('{login}',$tl,$template);
$template = str_replace('{password}',$tp,$template);
$template = str_replace('{schet}',$sid,$template);
$template = str_replace('{domaincost}',round($domainCostArr[$v]*CURK,2)." ".CURS,$template);
$template = str_replace('{cost}',round($domainCostArr[$v]*CURK,2)." ".CURS,$template);
$template = str_replace('{srok}',($domainMinSrokArr[$v]/12),$template);
$template = str_replace('{paymethod}','',$template);
if ($comment) { $comment = $_lang[OrderComment].":n".$comment; }
$template = str_replace('{comment}',$comment,$template);
if ($ns1 or $ns2) { $ns = "NS1: $ns1nNS2: $ns2nNS3: $ns3nNS4: $ns4nn"; }
$template = str_replace('{ns}',$ns,$template);
$template = str_replace('{userid}',$_SESSION['userId'],$template);
WriteMailLog($subject,$template,$_SESSION['userId']);
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template);
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template);
$subject = "Duplicate: ".$subject;
$admEmails=GetAdminEmailsWhereTrueParam("sendneworder");
if (count($admEmails) > 0) {
WriteMailLog($subject,$template);
}
while (list($i,$em) = @each($admEmails)) {
sendmail($em,'',$manager_email,$subject,$template);
}
}
}
Header("Location: billing.php?do=bills");
}
if ($type == "shop") {
@mysql_query("insert into orders_shop (uid,item,orderdate,comment) values('".$_SESSION['userId']."','$item_id',NOW(),'$comment')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$item_id=mysql_insert_id();
if ($promoSkidka) {
$itemcost = round($itemcost-$itemcost/100*$promoSkidka,2);
}
@mysql_query("insert into bills (uid,shop_id,shop_srok,money_shop,created) values('".$_SESSION['userId']."','$item_id','$itemmonths','$itemcost',NOW())") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$bill_id=mysql_insert_id();
$sid=sprintf("%04d", $bill_id);
addUserLog($_SESSION['userId'],'ordershop',"$t->name, $itemmonths мес.$promoTXT");
AddUsedByToCoupon($promoId,$_SESSION["userId"],$bill_id);
$tpl = GetTpl('email_touser_shop_order', $_SESSION["userLang"]);
$subject = $tpl[subject]; $template = $tpl[template];
if ($subject and $template) {
$company_name=GetSetting('company_name');
$company_url=GetSetting('company_url');
$billing_url=GetSetting('billing_url');
$support_url=GetSetting('support_url');
$manager_email=GetSetting('manager_email');
if ($elogin and $epassword and $usertype == "exists") {$tl=strtolower($elogin); $tp=$epassword;}
else if ($login and $password and $usertype == "new") {$tl=strtolower($login); $tp=$password;}
else {$tl=$_SESSION["userLogin"]; $tp='******';}
$template = str_replace('{company_name}',$company_name,$template);
$template = str_replace('{company_url}',$company_url,$template);
$template = str_replace('{billing_url}',$billing_url,$template);
$template = str_replace('{support_url}',$support_url,$template);
$template = str_replace('{item}',$t->name,$template);
$template = str_replace('{srok}',$itemmonths,$template);
$template = str_replace('{login}',$tl,$template);
$template = str_replace('{password}',$tp,$template);
$template = str_replace('{schet}',$sid,$template);
$template = str_replace('{itemcost}',round($itemcost*CURK,2)." ".CURS,$template);
$template = str_replace('{cost}',round($allsumm*CURK,2)." ".CURS,$template);
$template = str_replace('{paymethod}','',$template);
if ($comment) { $comment = $_lang[OrderComment].":n".$comment; }
$template = str_replace('{comment}',$comment,$template);
$template = str_replace('{userid}',$_SESSION['userId'],$template);
WriteMailLog($subject,$template,$_SESSION['userId']);
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template);
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template);
$subject = "Duplicate: ".$subject;
$admEmails=GetAdminEmailsWhereTrueParam("sendneworder");
if (count($admEmails) > 0) {
WriteMailLog($subject,$template);
}
while (list($i,$em) = @each($admEmails)) {
sendmail($em,'',$manager_email,$subject,$template);
}
}
$resCheckProfile = checkProfile(GetSetting("checkprofiletype"), $_SESSION["userId"]);
if (!$resCheckProfile) {
Header("Location: billing.php?do=profile&fromreg=1&bill_id=$bill_id");
} else {
Header("Location: billing.php?do=pay&fromreg=1&id=$bill_id");
}
}
}
}
if ($error) {$step--;}
#################################################
# Вывод формы заказа #
#################################################
if (!($type == "h" or $type == "d" or $type == "dopt" or $type == "partner" or $type == "shop")) {$type="h";}
if ($type == "h") {
if (!($vid == "hosting" or $vid == "reseller" or $vid == "vds" or $vid == "dedicated" or $vid == "vpn") and !$group) {$vid='hosting';}
if ($tarif) {
$r = @mysql_query("select * from tarifs where active=1 and name='$tarif' or id='".intval($tarif)."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($r) > 0) {
$r = mysql_fetch_object($r);
$tarif_id = $r->id;
$tarif_group = $r->tarifsgroup;
$vid = $r->vid;
} else {
$tarif = "";
}
}
}
if ($type == "shop") {
if ($item) {
$r = @mysql_query("select * from shop_items where active=1 and name='$item' or id='".intval($item)."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($r) > 0) {
$r = mysql_fetch_object($r);
$item_id = $r->id;
$item_group = $r->itemgroup;
} else {
$item = "";
}
}
}
if ($orderTableWidth) { $width = $orderTableWidth; } else { $width = "500"; }
if ($type == "partner") {$pageTitle = $_lang[OrderPartnerTitle];}
else {$pageTitle = $_lang[OrderTitle]." (".$_lang[OrderStep]." $step ".$_lang[OrderStepFrom]." $steps)";}
if ($type == "h" and $step == "1") {
$pageTitle = $_lang[OrderTitleType][$vid]." - ".$pageTitle;
} else if ($type == "d" and $step == "1") {
$pageTitle = $_lang[OrderTitleTypeDomain]." - ".$pageTitle;
} else if ($type == "dopt" and $step == "1") {
$pageTitle = $_lang[OrderTitleTypeDomainOpt]." - ".$pageTitle;
} else if ($type == "shop" and $step == "1") {
$pageTitle = $_lang[OrderTitleTypeShop]." - ".$pageTitle;
}
if ($type == "h" and $step > "1") {
$pageTitle = $PAGE_TITLE_ITEMNAME." - ".$pageTitle;
} else if ($type == "d" and $step > "1") {
$pageTitle = $PAGE_TITLE_ITEMNAME." - ".$pageTitle;
} else if ($type == "dopt" and $step > "1") {
$pageTitle = $_lang[OrderTitleTypeDomainOpt]." - ".$pageTitle;
} else if ($type == "shop" and $step > "1") {
$pageTitle = $PAGE_TITLE_ITEMNAME." - ".$pageTitle;
}
head('utf-8',$pageTitle);
?>
<link href="./_style.css" rel="stylesheet" type="text/css">
<script language=javascript type='text/javascript'>function showblankdiv(divid) {if (document.getElementById) {document.getElementById(divid).style.display = 'block';} else {if (document.layers) {document.divid.display = 'block';} else {document.all.divid.style.display = 'block';}}} function hideblankdiv(divid) {if (document.getElementById) {document.getElementById(divid).style.display = 'none';} else {if (document.layers) {document.divid.display = 'none';} else {document.all.divid.style.display = 'none';}}}</script>
<?
print "<H1 class=pagetitle>$pageTitle</H1><hr class=hr>";
print "<form method=post name=order action=order.php>";
print "<input type=hidden name=type value=$type>";
print "<input type=hidden name=step value=$step>";
print "<input type=hidden name=referal value=".$_COOKIE["partnerRootPanelCookie"].">";
print "<input type=hidden name=vid value=$vid>";
if ($step > 1) { print "<input type=hidden name=tarif value=$tarif>"; }
if ($step > 1) { print "<input type=hidden name=item value=$item>"; }
print "<input type=hidden name=one value=$one>";
print "<input type=hidden name=group value=$group>";
print "<input type=hidden name=valuta value=$valuta>";
if ($step > 1 and $type == "dopt") {
print "<input type=hidden name=check value='true'>";
}
if ($step > 1 and $type == "h") {
print "<input type=hidden name=tarif_id value='$tarif_id'>";
print "<input type=hidden name=domain_reg value='$domain_reg'>";
print "<input type=hidden name=otherdomain value='$otherdomain'>";
print "<input type=hidden name=domain value='$domain'>";
print "<input type=hidden name=zone value='$zone'>";
}
if ($step > 1 and $type == "d") {
print "<input type=hidden name=domain value='$domain'>";
print "<input type=hidden name=zone value='$zone'>";
}
if ($step > 1 and $type == "dopt") {
print "<input type=hidden name=domains value='$domains'>";
print "<input type=hidden name=freedomains value='$freedomains'>";
print "<input type=hidden name=dnstype value='$dnstype'>";
}
if ($step > 1 and $type == "shop") {
print "<input type=hidden name=item_id value='$item_id'>";
}
if ($step > 1) {
print "<input type=hidden name=usertype value='$usertype'>";
print "<input type=hidden name=elogin value='$elogin'>";
print "<input type=hidden name=epassword value='$epassword'>";
print "<input type=hidden name=login value='$login'>";
print "<input type=hidden name=password value='$password'>";
print "<input type=hidden name=repassword value='$repassword'>";
print "<input type=hidden name=email value='$email'>";
print "<input type=hidden name=aboutusfromid value='$aboutusfromid'>";
print "<input type=hidden name=rules value='$rules'>";
}
if ($step > 2 and $type == "h") {
print "<input type=hidden name=zone_id value='$zone_id'>";
print "<input type=hidden name=months value='$months'>";
if (@is_array($addons)) {$hiddenAddons=@join(":x:",$addons);} else {$hiddenAddons=$addons;}
print "<input type=hidden name=addons value='$hiddenAddons'>";
print "<input type=hidden name=server value='$server'>";
if ($_SESSION["userId"]) { print "<input type=hidden name=profileId value='$profileId'>"; }
print "<input type=hidden name=testPeriodNeed value='$testPeriodNeed'>";
}
if ($step > 2 and $type == "d") {
print "<input type=hidden name=zone_id value='$zone_id'>";
print "<input type=hidden name=ns1 value='$ns1'>";
print "<input type=hidden name=ns2 value='$ns2'>";
print "<input type=hidden name=ns3 value='$ns3'>";
print "<input type=hidden name=ns4 value='$ns4'>";
if ($_SESSION["userId"]) { print "<input type=hidden name=profileId value='$profileId'>"; }
}
if ($step > 2 and $type == "dopt") {
print "<input type=hidden name=ns1 value='$ns1'>";
print "<input type=hidden name=ns2 value='$ns2'>";
print "<input type=hidden name=ns3 value='$ns3'>";
print "<input type=hidden name=ns4 value='$ns4'>";
if ($_SESSION["userId"]) {
$freedom = @mb_split("rn",$freedomains);
while (list($k,$v) = @each($freedom)) {
print "<input type=hidden name='profile_id[$v]' value='$profile_id[$v]'>";
}
}
$freedom = @mb_split("rn",$freedomains);
while (list($k,$v) = @each($freedom)) {
print "<input type=hidden name='dns1[$v]' value='$dns1[$v]'>";
print "<input type=hidden name='dns2[$v]' value='$dns2[$v]'>";
print "<input type=hidden name='dns3[$v]' value='$dns3[$v]'>";
print "<input type=hidden name='dns4[$v]' value='$dns4[$v]'>";
}
while (list($k,$v) = @each($zone_id)) {
print "<input type=hidden name='zone_id[$k]' value='$v'>";
}
}
if ($step > 2 and $type == "shop") {
print "<input type=hidden name=months value='$months'>";
}
if ($step > 2) {
print "<input type=hidden name=promocode value='$promocode'>";
}
if ($error) { print "<code class=warn>".$_lang[Error].": $error</code><BR><BR>"; }
#################################################
# Вывод форм заказа (Шаг 1) #
#################################################
if ($step == 1 and !$_SESSION['userId']) {
########################## Таблица выбора типа клиента
print "<code class=order_table_title>".$_lang[OrderSelectUserType].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr><td>";
if ($type == "partner") { $usertype = 'new'; }
if ($type != "partner") { ?><input type=radio name=usertype value=exists <? if ($usertype != 'new') {print "checked";} ?> onclick="hideblankdiv('tablereg'); showblankdiv('tablelogin')"> <?=$_lang[OrderRegedUser]?><BR><? }
?><input type=radio name=usertype value=new <? if ($usertype == 'new') {print "checked";} ?> onclick="hideblankdiv('tablelogin'); showblankdiv('tablereg')"> <?=$_lang[OrderNewClient]?><BR><?
print "</td></tr>";
print "</table><BR>";
########################## Таблица аутентификации существующего клиента
if ($usertype != "new") {$style="style='display: block;'";} else {$style="style='display: none;'";}
print "<div id=tablelogin $style>";
print "<code class=order_table_title>".$_lang[OrderEnterLoginAndPassword].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderLogin].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=elogin value='$elogin' maxlength=10 size=30></td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderPassword].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=password name=epassword size=30></td></tr>";
print "</table><BR>";
print "</div>";
########################## Таблица регистрации нового клиента
if ($usertype == "new") {$style="style='display: block;'";} else {$style="style='display: none;'";}
print "<div id=tablereg $style>";
print "<code class=order_table_title>".$_lang[OrderRegData].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderLogin].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=login value='$login' maxlength=10 size=30> ".$_lang[OrderLoginComment]."</td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderPassword].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=password name=password value='$password' size=30> ".$_lang[OrderPasswordComment]."</td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderRePassword].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=password name=repassword value='$repassword' size=30></td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderEmail].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=email value='$email' size=30></td></tr>";
if (GetSetting("usersChangeCurrency")) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[ProfileCurrency].":</td></tr>";
print "<tr class=order_table_tr><td><select class=input name=valuta>";
$r = GetCurrencys();
while ($rr = mysql_fetch_object($r)) {
if ($rr->code == $valuta or $rr->code == CURС) { $selected = "selected"; } else { $selected = ""; }
print "<option value='$rr->code' $selected>$rr->name</option>";
}
print "</select></td></tr>";
}
$r = GetAboutUsFromAll();
if (@mysql_num_rows($r) > 0) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderAboutUsFrom].":</td></tr>";
print "<tr class=order_table_tr><td>"; printAboutUsFromSelect($aboutusfromid); print "</td></tr>";
}
if ($needrules) {
$needrulesurl = GetSetting("needrulesurl");
if ($needrules == "1") { $title=$_lang[OrderRules]; $rulestxt = $_lang[OrderPrefixS]." <A class=rootlink href=$needrulesurl target=_blank>".$_lang[OrderRules2]."</a> ".$_lang[OrderObyazVipolnyat]; } else if ($needrules == "2") { $title=$_lang[OrderDogovorOferta]; $rulestxt = $_lang[OrderSUsloviyami]." <A class=rootlink href=$needrulesurl target=_blank>".$_lang[OrderDogovorOferta2]."</a> ".$_lang[OrderObyazVipolnyat]; }
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> $title:</td></tr>";
if ($rules) {$rulCheck1="checked";}
print "<tr class=order_table_tr><td><input class=input type=checkbox name=rules $rulCheck1> $rulestxt</td></tr>";
}
if (GetSetting("captcha_reg") and $type == "partner") {
print "<tr class=order_table_tr_title><td><code class=warn>*</code> $_lang[Captcha]:</td></tr>";
print "<tr class=order_table_tr><td><img name=captcha src=captcha.php align=left style="margin-right: 10px;"> ".$_lang[CaptchaNeVidno]." <A class=rootlink href="" onclick="document.captcha.src = document.captcha.src + '?' + (new Date()).getTime(); return false;">".$_lang[CaptchaObnovit]."</a></td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=captchakeyin size=30></td></tr>";
}
print "</table><BR>";
print "</div>";
}
if ($step == 1 and $type == "h") {
if ($domain_reg == "") {$domain_reg=1;}
print "<code class=order_table_title>".$_lang[OrderParamsOfOrder].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderTarif].":</td></tr>";
print "<tr class=order_table_tr><td>";
$where = "";
if ($vid) {
$where = $where." and vid='$vid'";
}
if ($one) {
$where = $where." and id='$tarif_id'";
} else {
if ($group) {
$where = $where." and tarifsgroup='$group'";
} else if ($tarif_group) {
$where = $where." and tarifsgroup='$tarif_group'";
}
}
$r=@mysql_query("select * from tarifs where active=1 $where order by cost") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$tarifs_cnt = @mysql_num_rows($r);
while ($rr = mysql_fetch_object($r)) {
if ($_SESSION['userId']) {
$tarifSpecCost = GetSpecialCost($_SESSION['userId'],"tarif",$rr->id);
if ($tarifSpecCost) {
$rr->cost_setup = $tarifSpecCost["cost1"];
$rr->cost = $tarifSpecCost["cost2"];
}
}
$maxDiscount=@mysql_query("select MAX(discount) as maxDiscount from tarifs_sroki where tarif_id='$rr->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($maxDiscount) > 0) {
$maxDiscount = mysql_fetch_object($maxDiscount);
$maxDiscount = $maxDiscount->maxDiscount;
} else {
$maxDiscount = 0;
}
if ($rr->id == $tarif_id or $tarif == $rr->name or $tarifs_cnt == 1) {$addon='checked'; $tarif_id=$rr->id;} else {$addon='';}
if ($rr->cost_setup) {
$tarifCostSetup = $rr->cost_setup;
$addon_cost=" + ".round($tarifCostSetup*CURK,2)." ".CURS." ".$_lang[OrderRazovoZaUstanovku];
} else {
$addon_cost="";
}
if ($maxDiscount > 0) {
$tarifCost = $rr->cost - $rr->cost/100*$maxDiscount;
$tarifCostTxt = $_lang[OrderFrom]." ".round($tarifCost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth].$addon_cost;
} else {
$tarifCostTxt = round($rr->cost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth].$addon_cost;
}
$rr->description = htmlDecode($rr->description);
$rr->description = preg_replace("/n/ui","<br>",$rr->description);
if ($rr->description) { $description = "<img src=./_rootimages/info.gif alt="$rr->description" border=0>"; } else { $description = ""; }
print "<input type=radio name=tarif_id value=$rr->id $addon> $rr->name (".$tarifCostTxt.") $description<BR>";
}
print "</td></tr>";
if (GetSetting("orderNotShowDomainsBlock") and ($vid == "vds" or $vid == "dedicated")) {
print "<input type=hidden name=domain_reg value=2>";
} else {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomain].":</td></tr>";
print "<tr class=order_table_tr><td>";
if ($domain_reg == "1") {$domCheck1="checked";}
if ($domain_reg == "0") {$domCheck2="checked";}
if ($domain_reg == "2") {$domCheck3="checked";}
print "<input type=radio name=domain_reg value=1 $domCheck1 onclick="hideblankdiv('domain0'); showblankdiv('domain1')"> ".$_lang[OrderDomainNew]."<BR>";
print "<input type=radio name=domain_reg value=0 $domCheck2 onclick="hideblankdiv('domain1'); showblankdiv('domain0')"> ".$_lang[OrderDomainExists]."<BR>";
if ($vid == "vds" or $vid == "dedicated" or $vid == "vpn") { print "<input type=radio name=domain_reg value=2 $domCheck3 onclick="hideblankdiv('domain1'); hideblankdiv('domain0')"> ".$_lang[OrderWithoutDomain]."<BR>";}
if ($domain_reg == "0") {$style="style='display: block;'";} else {$style="style='display: none;'";}
print "<div id=domain0 $style class=order_table_tr>";
print "www . <input class=input type=text name=otherdomain value='$otherdomain' size=30> ".$_lang[OrderDomainComment];
print "</div>";
if ($domain_reg == "1") {$style="style='display: block;'";} else {$style="style='display: none;'";}
print "<div id=domain1 $style class=order_table_tr>";
print "www . <input class=input type=text name=domain value='$domain' size=30> <select class=input name=zone><option></option>";
$r=@mysql_query("select * from zones where active=1 group by zone order by zone") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($rr=@mysql_fetch_object($r)) {
$zoneCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$rr->id,1);
if ($rr->zone == $zone) {$addon='selected';} else {$addon='';}
print "<option value=$rr->zone $addon> .$rr->zone [".round($zoneCost*CURK,2)." ".CURS."]</option>";
}
print "</select>";
print "</div>";
print "</td></tr>";
}
print "</table><BR>";
}
if ($step == 1 and $type == "d") {
print "<code class=order_table_title>".$_lang[OrderParamsOfOrder].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomain].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "www . <input class=input type=text name=domain value='$domain' size=30> <select class=input name=zone><option></option>";
$r=@mysql_query("select * from zones where active=1 group by zone order by zone") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($rr=@mysql_fetch_object($r)) {
$zoneCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$rr->id,0);
if ($rr->zone == $zone) {$addon='selected';} else {$addon='';}
print "<option value=$rr->zone $addon> .$rr->zone [".round($zoneCost*CURK,2)." ".CURS."]</option>";
}
print "</select>";
print "</td></tr>";
print "</table><BR>";
}
if ($step == 1 and $type == "dopt") {
print "<code class=order_table_title>".$_lang[OrderParamsOfOrder].":</code>";
print "<table border=0 class=order_table width=$width>";
if ($check) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td colspan=2>".$_lang[OrderResultOfCheck].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td> ".$_lang[OrderDomainSmallOneWord]."</td><td> ".$_lang[OrderDomainStatus]."</td></tr>";
$domain=@mb_split("rn",$domains);
$freedomains=array();
while (list($k,$v) = @each($domain)) {
if ($v) {
$arr=""; $res="";
$v=preg_replace("/^www./ui","",$v);
preg_match("/^([^.]+).(.+)$/ui",$v,$arr);
$dname=strtolower($arr[1]); $dzone=strtolower($arr[2]);
$activeZone = GetActiveZoneByZone($dzone);
if (!$dname or !$dzone) { $res = $_lang[OrderDomainStatusErrorNotCorrect]; $colorStyle = "domainerror"; }
else if (!$activeZone) { $res = $_lang[OrderRegIn]." .$dzone ".$_lang[OrderNotSupported]; $colorStyle = "domainerror"; }
else if (mb_strlen($dname) < $activeZone->minWidth or mb_strlen($dname) > $activeZone->maxWidth) { $res = $_lang[OrderDomainStatusErrorLength]; $colorStyle = "domainerror";$res=str_replace("{minWidth}",$activeZone->minWidth,$res);$res=str_replace("{maxWidth}",$activeZone->maxWidth,$res);}
else if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}$/u",$dname)) { $res = $_lang[OrderDomainStatusErrorSymbols]; $colorStyle = "domainerror";}
else {
$k=@mysql_query("select * from orders_domains where domain='$v' and todate>NOW()") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($k) > 0) { $res=$_lang[OrderDomainStatusErrorOtherUser]; $colorStyle = "domainreged"; }
else {
$dom=new domain($dname.".".$dzone);
if (!$dom->is_available()) { $res=$_lang[OrderDomainStatusNotFree]; $colorStyle = "domainreged"; }
else {
$res = $_lang[OrderDomainStatusFree];
$colorStyle = "domainfree";
$freedomains[]=$v;
}
}
}
print "<tr class=order_subtable_tr><td>"; if ($dname and $dzone) { print "$dname.$dzone"; } else {print "$v";} print "</td><td class='$colorStyle'> $res</td></tr>";
}
}
print "</table>";
print "<input type=hidden name=freedomains value='".@join("rn",$freedomains)."'>";
print "<input type=hidden name=domains value='$domains'><input class=button type=submit name='' value='".$_lang[OrderInputOtherDomains]."'>";
print "</td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDNS].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input type=radio name=dnstype value=one "; if ($dnstype == 'one' or !$dnstype) {print "checked";} print "> ".$_lang[OrderDNSOne]."<BR>";
print "<input type=radio name=dnstype value=each "; if ($dnstype == 'each') {print "checked";} print "> ".$_lang[OrderDNSEach]."<BR><BR>";
print "</td></tr>";
} else {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderAvailZones].":</td></tr>";
print "<tr class=order_table_tr><td>";
$zones=GetZonesActive();
$zones_cnt=@mysql_num_rows($zones);
while ($zone = mysql_fetch_object($zones)) {
$i++;
print ".$zone->zone";
if ($zones_cnt != $i) {print ", ";}
}
print "</td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomains].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<textarea class=input name=domains cols=60 rows=6>$domains</textarea>";
print "<BR>".$_lang[OrderDomainsComment]."<BR>";
print "<input class=button type=submit name=check value='".$_lang[OrderDomainsCheck]."'>";
print "</td></tr>";
$onclick = "onclick="javascript: alert('".$_lang[OrderDomainsCheckAlert]."'); return false;"";
}
print "</table><BR>";
}
if ($step == "1" and $domainNotAvailable) {
if ($type == "h") {$withhost=1;}
else {$withhost=0;}
if (count($checkZones) > 0) {
$resTitle = $_lang[OrderFreeDomainsInSelectedZones];
$allzones = $checkZones;
} else {
$resTitle = $_lang[OrderFreeDomainsInFavoriteZones];
$allzones = GetZonesNamesForWhoisFavorite();
}
if (count($allzones) > 0) {
print "<code class=order_table_title>".$resTitle.":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr><td>";
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td width=70> ".$_lang[OrderSmallOrder]."</td><td> ".$_lang[OrderDomainSmallOneWord]."</td><td> ".$_lang[OrderSrokSmall]."</td><td> ".$_lang[OrderCostSmall]."</td></tr>";
$cnt = 0;
while (list($k, $v) = each($allzones)) {
if ($zone != $v) {
$d = new domain($domain.".".$v);
if ($d->is_available() and !$d->last_error) {
$favoriteZone = GetZoneByZone($v);
$favoriteCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$favoriteZone->id,$withhost);
print "<tr class=order_subtable_tr><Td align=center><input type=radio name=selectedZone value=".$favoriteZone->zone."></td><Td align=left class=domainfree>$domain.".$favoriteZone->zone."</td><td> ".($favoriteZone->minsrok/12)." ".$_lang[OrderSokraschenieGod]."</td><td> ".round($favoriteCost*CURK,2)." ".CURS."</td></tr>";
$cnt++;
}
}
}
if (!$cnt) {
print "<tr class=order_subtable_tr><Td colspan=4 align=center>".$_lang[WhoisNoFreeDomainsInOtherZones]."</td></tr>";
}
print "</table>";
print "</td></tr>";
print "</table><BR>";
}
$zones = GetZonesForWhois();
if (@mysql_num_rows($zones) > 0) {
print "<code class=order_table_title>".$_lang[OrderAvailZones].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr><td>";
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td width=70></td><td> ".$_lang[OrderZoneSmall]."</td><td> ".$_lang[OrderSrokSmall]."</td><td> ".$_lang[OrderCostSmall]."</td></tr>";
while ($zone = mysql_fetch_object($zones)) {
$zoneCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$zone->id,$withhost);
print "<tr class=order_subtable_tr><Td align=center><input type=checkbox name=checkZones[] value='$zone->zone'></td><Td align=left>.".$zone->zone."</td><td> ".($zone->minsrok/12)." ".$_lang[OrderSokraschenieGod]."</td><td> ".round($zoneCost*CURK,2)." ".CURS."</td></tr>";
}
print "<tr class=order_subtable_tr><td colspan=4 align=center><input type=submit class=button name=next value='".$_lang[OrderCheckDomainInSelectedZones]."'></td></tr>";
print "</table>";
print "</td></tr>";
print "</table><BR>";
}
}
if ($step == 1 and $type == "shop") {
print "<code class=order_table_title>".$_lang[OrderParamsOfOrder].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderItem].":</td></tr>";
print "<tr class=order_table_tr><td>";
if ($one) {
$where = $where." and id='$item_id'";
} else {
if ($group) {
$where = $where." and itemgroup='$group'";
} else if ($item_group) {
$where = $where." and itemgroup='$item_group'";
}
}
$r=@mysql_query("select * from shop_items where active=1 $where order by id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$items_cnt = @mysql_num_rows($r);
while ($rr = @mysql_fetch_object($r)) {
if ($_SESSION['userId']) {
$itemSpecCost = GetSpecialCost($_SESSION['userId'],"shop",$rr->id);
if ($itemSpecCost) {
$rr->cost = $itemSpecCost["cost1"];
}
}
if ($rr->id == $item_id or $item == $rr->name or $items_cnt == 1) {$addon='checked'; $item_id=$rr->id;} else {$addon='';}
if ($rr->costtype == "month") { $itemCostTxtAddon = "/".$_lang[OrderSokraschenieMonth];}
else if ($rr->costtype == "year") { $itemCostTxtAddon = "/".$_lang[OrderSokraschenieGod];}
else { $itemCostTxtAddon = " ".$_lang[OrderRazovo]; }
$itemCostTxt = round($rr->cost*CURK,2)." ".CURS.$itemCostTxtAddon;
$rr->description = htmlDecode($rr->description);
$rr->description = preg_replace("/n/ui","<br>",$rr->description);
if ($rr->description) {$description="<img src=./_rootimages/info.gif alt="$rr->description" border=0>";} else {$description="";}
print "<input type=radio name=item_id value=$rr->id $addon> $rr->name (".$itemCostTxt.") $description<BR>";
}
print "</td></tr>";
print "</table><BR>";
}
if ($step == 2 and $type == "h") {
if ($t->cost_setup) {$addon_cost=" + ".round($t->cost_setup*CURK,2)." ".CURS." ".$_lang[OrderRazovoZaUstanovku];} else {$addon_cost="";}
print "<code class=order_table_title>$t->name</code> <code class=order_table_title_cost>(".round($t->cost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth]."$addon_cost)</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderSrokZakaza].":</td></tr>";
print "<tr class=order_table_tr><td>";
$r=@mysql_query("select * from tarifs_sroki where tarif_id='$tarif_id' order by months");
if (@mysql_num_rows($r) > 0) {
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td width=30></td><td> ".$_lang[OrderSrokSmall]."</td><td> ".$_lang[OrderCostSmall]."</td><td> ".$_lang[OrderDiscountSmall]."</td><td> ".$_lang[OrderTotalSmall]."</td><td width=20></td></tr>";
while ($rr = mysql_fetch_object($r)) {
$cost = $t->cost*$rr->months;
$itogo=$cost-($cost/100)*$rr->discount+$t->cost_setup;
if ($rr->discount) {$discount="<B>$rr->discount%</b>";} else {$discount="$rr->discount%";}
if ($months == $rr->months) {$monthCheck='checked';} else {$monthCheck='';}
if ($domain_reg == 1) {
$tfreedomains=@mysql_query("select zone from tarifs_freedomains where tarif_id='$tarif_id' and hostmonths='$rr->months'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($tfreedomains) > 0) {
$freezones="";
while ($tfreedomain = mysql_fetch_object($tfreedomains)) {
$freezones = $freezones.".".$tfreedomain->zone." ";
}
$akciya="<img src='./_rootimages/akciya.gif' alt='<B>".$_lang[OrderAkciyaDomain]."</B><BR>".$_lang[OrderPriZakaze]." <B>$t->name</b> ".$_lang[OrderNaSrok]." <B>$rr->months ".$_lang[OrderSokraschenieMonth]."</b>,<BR> ".$_lang[OrderPoluchaeteVPodarok].":<BR> <B>$freezones</b>'>";
} else { $akciya=""; }
}
print "<tr class=order_subtable_tr><Td align=center><input type=radio name=months value=$rr->months $monthCheck></td><td> $rr->months ".$_lang[OrderSokraschenieMonth]."</td><td> ".round($cost*CURK,2)." ".CURS."</td><td> $discount</td><td> ".round($itogo*CURK,2)." ".CURS."</td><td align=center>$akciya</td></tr>";
}
print "</table>";
} else {
print $_lang[OrderErrorNetSrokovZakaza];
}
print "</td></tr>";
$addonsForTarif=@split(":x:",$t->addons);
$addonsCnt=0;
$osCnt=0;
$panelCnt=0;
$allAddonsCnt=0;
while (list($k,$v) = @each($addonsForTarif)) {
if ($v) {
$oneAddon = GetAddonById($v);
if ($oneAddon->active) {
$allAddonsCnt++;
if ($oneAddon->isOs) {$osCnt++;}
else if ($oneAddon->isPanel) {$panelCnt++;}
else {$addonsCnt++;}
}
}
}
if ($allAddonsCnt > 0) {
if ($prev) {$addons=@split(":x:",$addons);}
if ($osCnt > 0) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderAddonsOs].":</td></tr>";
print "<tr class=order_table_tr><td>";
reset($addonsForTarif);
while (list($k,$v) = @each($addonsForTarif)) {
if ($v) {
$oneAddon = GetAddonById($v);
if ($oneAddon->active and $oneAddon->isOs) {
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$oneAddon->id);
if ($addonSpecCost) {
$oneAddon->cost_start = $addonSpecCost["cost1"];
$oneAddon->cost_monthly = $addonSpecCost["cost2"];
}
$addonMoney = "";
if ($oneAddon->cost_start) {
$addonMoney=round($oneAddon->cost_start*CURK,2)." ".CURS." ".$_lang[OrderRazovo];
if ($oneAddon->cost_monthly) {$addonMoney = $addonMoney." + ";}
}
if ($oneAddon->cost_monthly) {$addonMoney=$addonMoney.round($oneAddon->cost_monthly*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth];}
if (!$addonMoney) { $addonMoney = $_lang[OrderFree]; }
if (@in_array($oneAddon->id,$addons)) {$addCheck="checked";} else {$addCheck="";}
print "<input type=radio $addCheck name=addons[os] value=$oneAddon->id> $oneAddon->name ($addonMoney)<BR>";
}
}
}
print "</td></tr>";
}
if ($panelCnt > 0) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderAddonsPanel].":</td></tr>";
print "<tr class=order_table_tr><td>";
reset($addonsForTarif);
while (list($k,$v) = @each($addonsForTarif)) {
if ($v) {
$oneAddon = GetAddonById($v);
if ($oneAddon->active and $oneAddon->isPanel) {
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$oneAddon->id);
if ($addonSpecCost) {
$oneAddon->cost_start = $addonSpecCost["cost1"];
$oneAddon->cost_monthly = $addonSpecCost["cost2"];
}
$addonMoney = "";
if ($oneAddon->cost_start) {
$addonMoney=round($oneAddon->cost_start*CURK,2)." ".CURS." ".$_lang[OrderRazovo];
if ($oneAddon->cost_monthly) {$addonMoney = $addonMoney." + ";}
}
if ($oneAddon->cost_monthly) {$addonMoney=$addonMoney.round($oneAddon->cost_monthly*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth];}
if (!$addonMoney) { $addonMoney = $_lang[OrderFree]; }
if (@in_array($oneAddon->id,$addons)) {$addCheck="checked";} else {$addCheck="";}
print "<input type=radio $addCheck name=addons[panel] value=$oneAddon->id> $oneAddon->name ($addonMoney)<BR>";
}
}
}
print "</td></tr>";
}
if ($addonsCnt > 0) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderAddons].":</td></tr>";
print "<tr class=order_table_tr><td>";
reset($addonsForTarif);
while (list($k,$v) = @each($addonsForTarif)) {
if ($v) {
$oneAddon = GetAddonById($v);
if ($oneAddon->active and !$oneAddon->isOs and !$oneAddon->isPanel) {
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$oneAddon->id);
if ($addonSpecCost) {
$oneAddon->cost_start = $addonSpecCost["cost1"];
$oneAddon->cost_monthly = $addonSpecCost["cost2"];
}
$addonMoney = "";
if ($oneAddon->cost_start) {
$addonMoney=round($oneAddon->cost_start*CURK,2)." ".CURS." ".$_lang[OrderRazovo];
if ($oneAddon->cost_monthly) {$addonMoney = $addonMoney." + ";}
}
if ($oneAddon->cost_monthly) {$addonMoney=$addonMoney.round($oneAddon->cost_monthly*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth];}
if (!$addonMoney) { $addonMoney = $_lang[OrderFree]; }
if ($oneAddon->textid == "vamshop") { $addVam = "checked onclick="return false;exit;""; } else { $addVam = ""; }
if (@in_array($oneAddon->id,$addons)) {$addCheck="checked";} else {$addCheck="";}
print "<input class=input type=checkbox $addVam $addCheck name=addons[] value=$oneAddon->id> $oneAddon->name ($addonMoney)<BR>";
}
}
}
print "</td></tr>";
}
}
if ($t->serverid) {
$server_main=GetServers($t->serverid);
if ($server_main->id) {
$subserver = mysql_query("select * from servers where parentid='$server_main->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($subserver) > 0) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderServerPlace].":</td></tr>";
print "<tr class=order_table_tr><td>";
if ($server == $server_main->id) {$srvMainCheck='checked';} else {$srvMainCheck='';}
print "<input type=radio name=server value=$server_main->id $srvMainCheck> $server_main->place<BR>";
while ($subserverone = @mysql_fetch_object($subserver)) {
if ($server == $subserverone->id) {$srvSubCheck='checked';} else {$srvSubCheck='';}
print "<input type=radio name=server value=$subserverone->id $srvSubCheck> $subserverone->place<BR>";
}
}
}
}
if (GetSetting("testPeriodEnable") and $t->testPeriod) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderTestPeriod].":</td></tr>";
print "<tr class=order_table_tr><td>";
if ($testPeriodNeed) { $testPcheck = "checked"; } else { $testPcheck = ""; }
print "<input class=input type=checkbox name=testPeriodNeed $testPcheck value=1> ".$_lang[OrderTestPeriodOrder];
print "</td></tr>";
}
print "</table><BR>";
if ($domain_reg == "1") {
print "<code class=order_table_title>$fulldomain</code> <code class=order_table_title_cost>(".round($domainCost*CURK,2)." ".CURS."/".$_lang[OrderYear].")</code>";
print "<table border=0 class=order_table width=$width>";
if ($selectRegistratorFlag) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomainRegistrator].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<select class=input type=text name=zone_id>";
$zones=@mysql_query("select * from zones where zone='$zone' and active='1'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($zz = @mysql_fetch_object($zones)) {
$registrator = GetRegistratorById($zz->autoreg);
$registratorCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$zz->id,1);
if ($registrator->active) {
if ($zz->id == $zone_id) {$selectedAddon = "selected";} else {$selectedAddon = "";}
print "<option value=$zz->id $selectedAddon>".$registrator->name." (".round($registratorCost*CURK,2)." ".CURS.")</option>";
}
}
print "</select>";
}
if ($_SESSION["userId"]) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomainOwner].":</td></tr>";
print "<tr class=order_table_tr><td>";
printProfileSelect($_SESSION["userId"],$profileId);
print "</td></tr>";
}
print "</table><BR>";
}
}
if ($step == 2 and $type == "d") {
print "<code class=order_table_title>$fulldomain</code> <code class=order_table_title_cost>(".round($domainCost*CURK,2)." ".CURS."/".$_lang[OrderYear].")</code>";
print "<table border=0 class=order_table width=$width>";
if ($selectRegistratorFlag) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomainRegistrator].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<select class=input type=text name=zone_id>";
$zones=@mysql_query("select * from zones where zone='$zone' and active='1'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($zz = @mysql_fetch_object($zones)) {
$registrator = GetRegistratorById($zz->autoreg);
$registratorCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$zz->id,0);
if ($registrator->active) {
if ($zz->id == $zone_id) {$selectedAddon = "selected";} else {$selectedAddon = "";}
print "<option value=$zz->id $selectedAddon>".$registrator->name." (".round($registratorCost*CURK,2)." ".CURS.")</option>";
}
}
print "</select>";
print "</td></tr>";
}
if ($_SESSION["userId"]) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomainOwner].":</td></tr>";
print "<tr class=order_table_tr><td>";
printProfileSelect($_SESSION["userId"],$profileId);
print "</td></tr>";
}
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderNS1].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=ns1 value='$ns1' size=30> ".$_lang[OrderNS1Comment];
print "</td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderNS2].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=ns2 value='$ns2' size=30> ".$_lang[OrderNS2Comment];
print "</td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderNS3].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=ns3 value='$ns3' size=30>";
print "</td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderNS4].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=ns4 value='$ns4' size=30>";
print "</td></tr>";
print "</table><BR>";
}
if ($step == 2 and $type == "dopt") {
print "<code class=order_table_title>".$_lang[OrderDNS].":</code>";
print "<table border=0 class=order_table width=$width>";
if ($dnstype == "one") {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderNS1].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=ns1 value='$ns1' size=30> ".$_lang[OrderNS1Comment];
print "</td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderNS2].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=ns2 value='$ns2' size=30> ".$_lang[OrderNS2Comment];
print "</td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderNS3].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=ns3 value='$ns3' size=30>";
print "</td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderNS4].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=ns4 value='$ns4' size=30>";
print "</td></tr>";
} else if ($dnstype == "each") {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr><td>";
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td> ".$_lang[OrderDomainSmallOneWord]."</td><td> ".$_lang[OrderNS1]."</td><td> ".$_lang[OrderNS2]."</td><td> ".$_lang[OrderNS3]."</td><td> ".$_lang[OrderNS4]."</td></tr>";
$freedomains = @mb_split("rn",$freedomains);
while (list($k,$v) = each($freedomains)) {
print "<tr class=order_subtable_tr><td>$v</td><Td><input class=input type=text name=dns1[$v] value='".$dns1[$v]."' size=8></td><td><input type=text class=input name=dns2[$v] value='".$dns2[$v]."' size=8></td><td><input type=text class=input name=dns3[$v] value='".$dns3[$v]."' size=8></td><td><input type=text class=input name=dns4[$v] value='".$dns4[$v]."' size=8></td></tr>";
}
print "</table>";
print "</td></tr>";
}
print "</table><BR>";
if (!is_array($freedomains)) {$freedomains = @mb_split("rn",$freedomains);}
reset($freedomains);
while (list($k,$v) = each($freedomains)) {
$zone=GetZoneByNonExistsDomain($v);
$zones=@mysql_query("select * from zones where zone='$zone->zone' and active='1'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($zones) > 1) {
$selectRegistratorFlag = 1;
}
}
if ($selectRegistratorFlag) {
print "<code class=order_table_title>".$_lang[OrderDomainRegistrator].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr><td>";
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td> ".$_lang[OrderDomainSmallOneWord]."</td><td> ".$_lang[OrderDomainRegistratorSmallOneWord]."</td></tr>";
reset($freedomains);
while (list($k,$v) = each($freedomains)) {
$zone=GetZoneByNonExistsDomain($v);
$zones=@mysql_query("select * from zones where zone='$zone->zone' and active='1' order by isDefault desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($zones) > 1) {
print "<tr class=order_subtable_tr><td>$v</td><Td><select class=input name=zone_id[$v]>";
while ($zz = @mysql_fetch_object($zones)) {
$registrator = GetRegistratorById($zz->autoreg);
$registratorCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$zz->id,0);
if ($registrator->active) {
if ($zz->id == $zone_id[$v]) {$selectedAddon = "selected";} else {$selectedAddon = "";}
print "<option value=$zz->id $selectedAddon>".$registrator->name." (".round($registratorCost*CURK,2)." ".CURS.")</option>";
}
}
print "</select></td></tr>";
}
}
print "</table>";
print "</td></tr>";
print "</table><BR>";
}
if ($_SESSION["userId"]) {
print "<code class=order_table_title>".$_lang[OrderDomainOwner].":</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr><td>";
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td> ".$_lang[OrderDomainSmallOneWord]."</td><td> ".$_lang[OrderDomainOwnerSmallOneWord]."</td></tr>";
reset($freedomains);
while (list($k,$v) = each($freedomains)) {
print "<tr class=order_subtable_tr><td>$v</td><Td>";
printProfileSelect($_SESSION["userId"],$profile_id[$v],0,"profile_id[$v]");
print "</td></tr>";
}
print "</table>";
print "</td></tr>";
print "</table><BR>";
}
}
if ($step == 2 and $type == "shop") {
if ($t->costtype == "month") { $itemCostTxtAddon = "/".$_lang[OrderSokraschenieMonth];}
else if ($t->costtype == "year") { $itemCostTxtAddon = "/".$_lang[OrderSokraschenieGod];}
else { $itemCostTxtAddon = " ".$_lang[OrderRazovo]; }
print "<code class=order_table_title>$t->name</code> <code class=order_table_title_cost>(".round($t->cost*CURK,2)." ".CURS.$itemCostTxtAddon.")</code>";
print "<table border=0 class=order_table width=$width>";
if ($t->costtype != "one") {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderSrokZakaza].":</td></tr>";
print "<tr class=order_table_tr><td>";
$r=@mysql_query("select * from shop_items where id='$item_id'");
$rr = mysql_fetch_object($r);
$m = $rr->minsrok;
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td width=30></td><td> ".$_lang[OrderSrokSmall]."</td><td> ".$_lang[OrderTotalSmall]."</td></tr>";
while ($m <= $rr->maxsrok) {
if ($t->costtype == "month") { $itogo = $t->cost*$m; }
else if ($t->costtype == "year") { $itogo = $t->cost*($m/12); }
if ($months == $m) {$monthCheck='checked';} else {$monthCheck='';}
if ($t->costtype == "month") {$msrok = $m." ".$_lang[OrderSokraschenieMonth]; }
else if ($t->costtype == "year") {$msrok = ($m/12)." ".$_lang[OrderSokraschenieGod];}
print "<tr class=order_subtable_tr><Td align=center><input type=radio name=months value=$m $monthCheck></td><td> ".$msrok."</td><td> ".round($itogo*CURK,2)." ".CURS."</td></tr>";
if ($t->costtype == "month") {$m = $m+1;}
else if ($t->costtype == "year") {$m = $m+12;}
}
print "</table>";
print "</td></tr>";
}
print "</table><BR>";
}
if ($step == "2") {
if (GetCouponActiveCount("promo") > 0) {
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderPromoCode].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=promocode size=30></td></tr>";
print "</table><BR>";
}
}
if ($step == 3) {
print "<code class=order_table_title>".$_lang[OrderYourOrder]."</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr><td>";
print "<table class=order_subtable width=100%>";
print "<tr class=order_subtable_tr_title><td> ".$_lang[OrderUsluga]."</td><td width=120> ".$_lang[OrderSumma]."</td></tr>";
if ($type == "h") {
if ($tarif_id) { print "<tr class=order_subtable_tr></td><td> ".$_lang[OrderTarif]." <B>$t->name</B> ".$_lang[OrderPrefixNa]." <B>$months ".$_lang[OrderSokraschenieMonth]."</B></td><td> ".round($host*CURK,2)." ".CURS."</td></tr>"; }
if ($domain_reg == "1") { print "<tr class=order_subtable_tr></td><td> ".$_lang[OrderDomain]." <B>$fulldomain</B> ".$_lang[OrderPrefixNa]." <B>".($domainminsrok/12)." ".$_lang[OrderSokraschenieGod]."</B></td><td> ".round($dom*CURK,2)." ".CURS."</td></tr>"; }
if ($addons) { print "<tr class=order_subtable_tr></td><td> ".$_lang[OrderAddons]." ($addonsToSaveText)</td><td> ".round($addonsCost*CURK,2)." ".CURS."</td></tr>"; }
}
if ($type == "d") {
print "<tr class=order_subtable_tr></td><td> ".$_lang[OrderDomain]." <B>$fulldomain</B> ".$_lang[OrderPrefixNa]." <B>".($domainMinSrok/12)." ".$_lang[OrderSokraschenieGod]."</B></td><td> ".round($domainCost*CURK,2)." ".CURS."</td></tr>";
}
if ($type == "dopt") {
$freedomains = @mb_split("rn",$freedomains);
while (list($k,$v) = each($freedomains)) {
print "<tr class=order_subtable_tr></td><td> ".$_lang[OrderDomain]." <B>$v</B> ".$_lang[OrderPrefixNa]." <B>".($domainMinSrokArr[$v]/12)." ".$_lang[OrderSokraschenieGod]."</B></td><td> ".round($domainCostArr[$v]*CURK,2)." ".CURS."</td></tr>";
}
}
if ($type == "shop") {
if ($t->costtype == "month") { $shopTXT = $_lang[OrderPrefixNa]." <B>$months ".$_lang[OrderSokraschenieMonth]; }
else if ($t->costtype == "year") { $shopTXT = $_lang[OrderPrefixNa]." <B>".($months/12)." ".$_lang[OrderSokraschenieGod]; }
else { $shopTXT = "";}
if ($item_id) { print "<tr class=order_subtable_tr></td><td> ".$_lang[OrderItem]." <B>$t->name</B> $shopTXT</B></td><td> ".round($itemcost*CURK,2)." ".CURS."</td></tr>"; }
}
if ($promocode) {
$coupon = GetCoupon("promo",$promocode);
if (IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
print "<tr class=order_subtable_tr></td><td> ".$_lang[OrderSkidkaByPromo]." $promocode</td><td> $coupon->value %</td></tr>";
$allsumm = $allsumm - $allsumm/100*$coupon->value;
}
}
print "<tr class=order_subtable_tr></td><td align=right><B>".$_lang[OrderTotal].":</b> </td><td> ".round(($allsumm)*CURK,2)." ".CURS."</td></tr>";
print "</table>";
print "</td></tr>";
print "</table><BR>";
print "<code class=order_table_title>".$_lang[OrderDopolnitelno]."</code>";
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
if (GetSetting("orderShowServerName") and ($vid == "vds" or $vid == "dedicated")) {
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderServerName].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=servername value='$servername' size=30></td></tr>";
}
if (GetSetting("orderShowAdminPassword") and ($vid == "vds" or $vid == "dedicated")) {
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderAdminPassword].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=password name=adminpassword value='$adminpassword' size=30></td></tr>";
}
if (GetSetting("orderShowRootPassword") and ($vid == "vds" or $vid == "dedicated")) {
print "<tr class=order_table_tr_title><td>".$_lang[OrderRootPassword].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=password name=rootpassword value='$rootpassword' size=30></td></tr>";
}
# print "<tr class=order_table_tr_title><td>".$_lang[OrderPayMethod].":</td></tr>";
# print "<tr class=order_table_tr><td>"; printPayMethodsSelect(); print "</td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderComment].":</td></tr>";
print "<tr class=order_table_tr><td><textarea class=input name=comment cols=60 rows=3>$comment</textarea></td></tr>";
if (GetSetting("captcha_reg")) {
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[Captcha].":</td></tr>";
print "<tr class=order_table_tr><td><img name=captcha src=captcha.php align=left style="margin-right: 10px;"> ".$_lang[CaptchaNeVidno]." <A class=rootlink href="" onclick="document.captcha.src = document.captcha.src + '?' + (new Date()).getTime(); return false;">".$_lang[CaptchaObnovit]."</a></td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=captchakeyin size=30></td></tr>";
}
print "</table><BR>";
}
if (!($type == "partner" and $_SESSION[userId])) {
print "<table border=0 class=order_table width=$width>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td align=center width=50%>";
if ($step > 1) { print "<input class=button type=submit name=prev value='".$_lang[Prev]."'>"; }
print "</td><td align=center width=50%>";
if ($step < $steps) {$nexttitle=$_lang[Next];} else {$nexttitle=$_lang[OrderButtonOrder];}
print "<input class=button type=submit name=next $disabled $onclick value='$nexttitle'></td></tr>";
print "</table><BR>";
print "<code class=warn>*</code> - ".$_lang[Required];
} else {
print $_lang[OrderErrorAlreadyReged];
}
print "</form>";
foot('utf-8');
mclose();
?>