Файл: order.php
Строк: 6775
<?
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");
$needpersonalinfo = GetSetting("needpersonalinfo");
$attachPDFtoBill = GetSetting("attachPDFtoBill");
$registerNeedMobile = GetSetting("registerNeedMobile");
$registerNeedMobileVerification = GetSetting("registerNeedMobileVerification");
$registerNeedFIO = GetSetting("registerNeedFIO");
$noIdenticalMobile = GetSetting("noIdenticalMobile");
$orderShowTarifMinCost = GetSetting("orderShowTarifMinCost");
$partnerEnable = GetSetting("partnerEnable");
$partnerEnableOrderReferalLogin = GetSetting("partnerEnableOrderReferalLogin");
$domainFreeLimit = GetSetting("domainFreeLimit");
if ($step == 2 and $next and $phone[0] and $phone[1] and $phone[2]) { $phone[0] = preg_replace("/+/ui","",$phone[0]); $phone = "+".$phone[0]." ".$phone[1]." ".$phone[2]; } else if ($step == 2 and $next) { $phone = ""; }
if ($step == 2 and $next and $mobile[0] and $mobile[1] and $mobile[2]) { $mobile[0] = preg_replace("/+/ui","",$mobile[0]); $mobile = "+".$mobile[0]." ".$mobile[1]." ".$mobile[2]; } else if ($step == 2 and $next) { $mobile = ""; }
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=mb_strtolower($login);
$email=mb_strtolower($email);
if ($noIdenticalMobile and $mobile) {
$mobileNumberDB = @mysql_query("select id from users WHERE mobile='$mobile'");
$mobileNumberDB = @mysql_num_rows($mobileNumberDB);
}
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,$VALID_EMAIL_CHECKMX)) {$error=$_lang[OrderErrorWrongEmail];}
else if (IsEmailUsed($email)) {$error=$_lang[OrderErrorEmailExists];}
else if ($noIdenticalMobile and $mobile and $mobileNumberDB > 0) { $error=$_lang[OrderErrorMobileExists]; }
else if ((($registerNeedMobile == "1" and $mobile) or $registerNeedMobile == "2") and (!preg_match("/^+d+s{1}d+s{1}d+$/u",$mobile) or strlen($mobile) < 8)) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileMobile];}
else if ($org != 3 and (($registerNeedFIO == "1" and $surname) or $registerNeedFIO == "2") and mb_strlen($surname) < 3) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileSurname];}
else if ($org != 3 and (($registerNeedFIO == "1" and $name) or $registerNeedFIO == "2") and mb_strlen($name) < 2) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileName];}
else if ($org != 3 and (($registerNeedFIO == "1" and $otchestvo) or $registerNeedFIO == "2") and mb_strlen($otchestvo) < 3) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileOtchestvo];}
else if ($type != "partner" and $attachPDFtoBill and $org == "") {$error = $_lang[OrderErrorNoOrg];}
else if ($type != "partner" and $attachPDFtoBill and !$country) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileCountry];}
else if ($type != "partner" and $attachPDFtoBill and ($org == "1" or $org == "2") and !$surname) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileSurname];}
else if ($type != "partner" and $attachPDFtoBill and ($org == "1" or $org == "2") and !$name) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileName];}
else if ($type != "partner" and $attachPDFtoBill and ($org == "1" or $org == "2") and !$otchestvo) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileOtchestvo];}
else if ($type != "partner" and $attachPDFtoBill and $org == "3" and !$firma) {$error=$_lang[OrderErrorField]." ".$_lang[ProfileOrg];}
else if ($type != "partner" and $attachPDFtoBill and (!preg_match("/^+d+s{1}d+s{1}d+$/u",$phone) or strlen($phone) < 8)) {$error=$_lang[OrderErrorField]." ".$_lang[ProfilePhone];}
else if ($needrules and !$rules) {$error=$_lang[OrderErrorNoRules];}
else if ($type == "partner" and $needpersonalinfo and !$personalinfo) {$error=$_lang[OrderErrorNoPersonalInfo];}
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"];}
if ($referalLogin) {
$referal = GetUserByLogin($referalLogin);
$referal = $referal->id;
}
if ($referal and $partnerEnable) {
$refUser = GetUserById($referal);
if ($refUser->id) {
$partnerMaxReferals = GetSetting("partnerMaxReferals");
$refsCount = GetUserReferalsCount($refUser->id);
if ($refUser->partnerMaxReferals > 0 and $refsCount >= $refUser->partnerMaxReferals) { $referal = ""; }
else if ($partnerMaxReferals > 0 and $refsCount >= $partnerMaxReferals) { $referal = ""; }
else {
@mysql_query("update users SET isPartner='1' where id='$refUser->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
} else { $referal = ""; }
} else { $referal = ""; }
@mysql_query("insert into users (login,password,email,datareg,referal,aboutusfromid,currency,lang,mobile,surname,name,otchestvo) values('$login','".crypt($password)."','$email',NOW(),'$referal','$aboutusfromid','".strtoupper($valuta)."','$user_lng','$mobile','$surname','$name','$otchestvo')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
userLogOn("$login","$password");
@mysql_query("insert into users_profile (uid,email,org,country,surname,name,otchestvo,phone,firma,mobile) values('".$_SESSION["userId"]."','$email','$org','$country','$surname','$name','$otchestvo','$phone','$firma','$mobile')") 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 ($_SESSION['userId']) { $user = GetUserById($_SESSION['userId']); }
else if ($_SESSION['userLogin']) { $user = GetUserByLogin($_SESSION['userLogin']); }
if (!$error and $type == "h") {
$t = GetTarifById($tarif_id);
if ($costId) {
$tc = GetTarifsCostById($costId);
$t->cost = $tc->cost / GetCurrencyKoeficientByCode($tc->costCurrency);
$t->cost_setup = $tc->cost_setup / GetCurrencyKoeficientByCode($tc->cost_setupCurrency);
} else {
$t->cost = $t->cost / GetCurrencyKoeficientByCode($t->costCurrency);
$t->cost_setup = $t->cost_setup / GetCurrencyKoeficientByCode($t->cost_setupCurrency);
}
if ($t->enableSlots and $slotsCount > 0) {
$t->cost = $t->cost*$slotsCount;
}
$PAGE_TITLE_ITEMNAME = $t->name;
if ($selectedZone) {$zone = $selectedZone;}
if ($domain and $zone) {
$domain=mb_strtolower(trim($domain)); $fulldomain=mb_strtolower(trim($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;
if ($step == 2 and $selectRegistratorFlag) {
while ($zz = @mysql_fetch_object($zones)) {
$idnArr[] = $zz->idn;
}
if ($tzones->idn == "no" and (in_array("yes", $idnArr) or in_array("only", $idnArr))) { $tzones->idn = "yes"; }
else if ($tzones->idn == "only" and (in_array("yes", $idnArr) or in_array("no", $idnArr))) { $tzones->idn = "yes"; }
}
$warning = $tzones->warning;
$domainMinSrok=$tzones->minsrok;
if ($domain_reg == "3") {$isTransfer = 1;} else {$isTransfer = 0;}
$domainCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,1,$isTransfer) * ($domainMinSrok/12);
}
else {
$fulldomain=mb_strtolower(trim($otherdomain));
$fulldomain=preg_replace("/^www./ui","",$fulldomain);
}
if ($fulldomain) {
$dom=new domain($fulldomain);
$r=@mysql_query("select * from orders where archived=0 and domain='$fulldomain' and startdate<>'0000-00-00'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$k=@mysql_query("select * from orders_domains where domain='$fulldomain' and startdate<>'0000-00-00'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
if (!$tarif_id) {$error=$_lang[OrderErrorNoTarif];}
else if ($costId and $tc->tarif_id != $t->id) {$costId=""; $error=$_lang[OrderErrorCostsVariant];}
else if ($t->enableSlots and !$slotsCount) {$error=$_lang[OrderErrorNoSlots];}
else if ($t->enableSlots and $t->minSlots and $slotsCount < $t->minSlots) {$error=$_lang[OrderErrorMinSlots]." ".$t->minSlots;}
else if ($t->enableSlots and $t->maxSlots and $slotsCount > $t->maxSlots) {$error=$_lang[OrderErrorMaxSlots]." ".$t->maxSlots;}
else if ($domain_reg == '') {$error=$_lang[OrderErrorNoDomainReg];}
else if (((!$domain or !$zone) and ($domain_reg == "1" or $domain_reg == "3")) or (!$otherdomain and $domain_reg == "0") or (!preg_match("/./ui",$otherdomain) and $domain_reg == "0") or (preg_match("/.$/ui",$otherdomain) and $domain_reg == "0") or (preg_match("/^./ui",$otherdomain) and $domain_reg == "0")) {$error=$_lang[OrderErrorNoDomain];}
else if (($domain_reg == "1" or $domain_reg == "3") 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 == "1" or $domain_reg == "3") 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" or $domain_reg == "3") and $tzones->idn == "no" and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}$/u",$domain)) { $error = $_lang[OrderErrorDomainSymbolsNoIDN];}
else if (($domain_reg == "1" or $domain_reg == "3") and $tzones->idn == "yes" 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" or $domain_reg == "3") and $tzones->idn == "only" and !preg_match("/^[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9-]*[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}$/u",$domain)) { $error = $_lang[OrderErrorDomainSymbolsOnlyIDN];}
else if ($domain_reg == "3" and !$tzones->transferAllow) { $error=$_lang[OrderErrorDomainNoTransferSupport]; }
else if ($domain_reg == "1" and !$dom->is_available()) {$error=$_lang[OrderErrorDomainRegistered]; $domainNotAvailable=1;}
else if ($domain_reg == "3" and $dom->is_available()) {$error=$_lang[OrderErrorDomainNotRegistered];}
else if (@mysql_num_rows($r) > 0) {$error=$_lang[OrderErrorTarifForDomainOrderByAnotherUser];}
else if (($domain_reg == "1" or $domain_reg == "3") and @mysql_num_rows($k) > 0) {$error=$_lang[OrderErrorDomainOrderByAnotherUser];}
else if (($domain_reg == "1" or $domain_reg == "3") and $tzones->free and $_SESSION['userId'] and $domainFreeLimit > 0 and GetDomainsFreeCountTodayByUserId($_SESSION['userId']) >= $domainFreeLimit) {$error=$_lang[OrderErrorDomainFreeLimit]." ($domainFreeLimit)";}
else if ($_SESSION['userId']) {
$tarifSpecCost = GetSpecialCost($_SESSION['userId'],"tarif",$t->id);
if ($tarifSpecCost and !$costId) {
$t->cost_setup = $tarifSpecCost["cost1"];
$t->cost = $tarifSpecCost["cost2"];
if ($t->enableSlots and $slotsCount > 0) {
$t->cost = $t->cost*$slotsCount;
}
}
$domainCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,1);
$domainCost=$domainCost*($domainMinSrok/12);
}
if ($domain_reg == "3" and !$tzones->transferRenew and !$tzones->transferCost) {
$domainCost = 0;
$domainMinSrok = 0;
}
if ($server) { $serverid = $server; } else if ($t->serverid) { $serverid = $t->serverid; } else { $serverid = 0; }
if ($serverid) {
$srv = GetServers($serverid);
if ($srv->nacenka) { $srvNacenka = $srv->nacenka; }
}
if ($srvNacenka) {
$t->cost=$t->cost+($t->cost/100)*$srvNacenka;
}
}
if (!$error and $type == "d") {
if ($selectedZone) {$zone = $selectedZone;}
$domain=mb_strtolower(trim($domain)); $fulldomain=mb_strtolower(trim($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;
if ($step == 2 and $selectRegistratorFlag) {
while ($zz = @mysql_fetch_object($zones)) {
$idnArr[] = $zz->idn;
}
if ($tzones->idn == "no" and (in_array("yes", $idnArr) or in_array("only", $idnArr))) { $tzones->idn = "yes"; }
else if ($tzones->idn == "only" and (in_array("yes", $idnArr) or in_array("no", $idnArr))) { $tzones->idn = "yes"; }
}
$warning = $tzones->warning;
$domainMinSrok=$tzones->minsrok;
if ($domain_reg == "3") {$isTransfer = 1;} else {$isTransfer = 0;}
$domainCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,0,$isTransfer) * ($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 ($tzones->idn == "no" and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}$/u",$domain)) { $error = $_lang[OrderErrorDomainSymbolsNoIDN];}
else if ($tzones->idn == "yes" and !preg_match("/^[a-zа-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}[a-zа-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9-]*[a-zа-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}$/u",$domain)) { $error = $_lang[OrderErrorDomainSymbols];}
else if ($tzones->idn == "only" and !preg_match("/^[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9-]*[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}$/u",$domain)) { $error = $_lang[OrderErrorDomainSymbolsOnlyIDN];}
else if ($domain_reg == "3" and !$tzones->transferAllow) { $error=$_lang[OrderErrorDomainNoTransferSupport]; }
else if ($domain_reg == "1" and !$dom->is_available()) {$error=$_lang[OrderErrorDomainRegistered]; $domainNotAvailable=1;}
else if ($domain_reg == "3" and $dom->is_available()) {$error=$_lang[OrderErrorDomainNotRegistered];}
else if (@mysql_num_rows($k) > 0) {$error=$_lang[OrderErrorDomainOrderByAnotherUser];}
else if ($tzones->free and $_SESSION['userId'] and $domainFreeLimit > 0 and GetDomainsFreeCountTodayByUserId($_SESSION['userId']) >= $domainFreeLimit) {$error=$_lang[OrderErrorDomainFreeLimit]." ($domainFreeLimit)";}
else if ($_SESSION['userId']) {
if ($domain_reg == "3") {$isTransfer = 1;} else {$isTransfer = 0;}
$domainCost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,0,$isTransfer);
$domainCost=$domainCost*($domainMinSrok/12);
}
if ($domain_reg == "3" and !$tzones->transferRenew and !$tzones->transferCost) {
$domainCost = 0;
$domainMinSrok = 0;
}
}
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 = $itemSpecCost["cost1"];
}
}
}
if (!$error and $type == "partner") {
$chkProfile = GetSetting("checkprofiletype");
$resCheckProfile = checkProfile($chkProfile, $_SESSION["userId"]);
if (!$resCheckProfile) {
Header("Location: billing.php?do=profile"); exit;
} else {
Header("Location: billing.php?do=partner"); exit;
}
}
}
if ($step > 2 and !$error) {
if (!$promocode) {
$currentUser = GetUserById($_SESSION["userId"]);
if ($currentUser->specialPromoCode and $currentUser->specialPromoCodeForUser) {
$promocode = $currentUser->specialPromoCode;
}
else if ($currentUser->referal or (!$_SESSION["userId"] and $referal)) {
if ($currentUser->referal) { $referal = $currentUser->referal; }
$referalUser = GetUserById($referal);
if ($referalUser->specialPromoCode and $referalUser->specialPromoCodeForReferals) {
$promocode = $referalUser->specialPromoCode;
}
}
}
}
if ($step > 2 and !$error and $type == "h") {
$months=@intval($months);
if (@is_array($addons)) {$selectedAddons=$addons;} else {$selectedAddons=@mb_split(":x:",$addons);}
if (@is_array($addonsInputCnt)) {$selectedAddonsInputCnt=$addonsInputCnt;} else {$selectedAddonsInputCnt=parseRPStrArray($addonsInputCnt,":x:",":");}
while (list($k,$v) = @each($selectedAddons)) {
if ($v) {
$selectedAddon = GetAddonById($v);
if ($selectedAddon->isOs or $selectedAddon->isPanel) { $selectedAddonsInputCnt[$v] = 1; }
if ($selectedAddonsInputCnt[$v] < 0) { $selectedAddonsInputCnt[$v] = -1 * $selectedAddonsInputCnt[$v]; }
if ($selectedAddon->cntforoneorder and $selectedAddonsInputCnt[$v] > $selectedAddon->cntforoneorder) { $addonsCntError = $_lang[OrderErrorAddonsCntWrong]." ".$selectedAddon->name.": ".$selectedAddon->cntforoneorder." ".$_lang[FakturaSokraschenieShtuka]; break; }
}
}
if (!$months or $months <= 0) {$error=$_lang[OrderErrorNoSrokZakaza];}
else if (($domain_reg == "1" or $domain_reg == "3") and !$license and ($tzones->licenseRequired == "yes" or ($tzones->licenseRequired == "idn" and preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]+/u",$domain)))) {$error=$_lang[OrderErrorNoLicense];}
else if ($domain_reg == "3" and $tzones->transferNeedAuth and !$transferAuth) {$error=$_lang[OrderErrorNoTransferAuth];}
else if ($addonsCntError) { $error = $addonsCntError; }
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' and `order`='1'") 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');
}
$addonsCost=0;
$addonsToSave="";
$addonsToSaveText="";
reset($selectedAddons);
while (list($k,$v) = @each($selectedAddons)) {
if ($v) {
$selectedAddon = GetAddonById($v);
if ($selectedAddon->isOs or $selectedAddon->isPanel) { $selectedAddonsInputCnt[$v] = 1; }
if ($selectedAddonsInputCnt[$v] < 0) { $selectedAddonsInputCnt[$v] = -1 * $selectedAddonsInputCnt[$v]; }
if ($addonsToSaveText) {
$addonsToSaveText = $addonsToSaveText.", ".$selectedAddon->name." - ".intval($selectedAddonsInputCnt[$v])." ".$_lang[FakturaSokraschenieShtuka];
} else {
$addonsToSaveText = $selectedAddon->name." - ".intval($selectedAddonsInputCnt[$v])." ".$_lang[FakturaSokraschenieShtuka];
}
# if ($addonsToSave) {
$zz = 0;
while ($zz < intval($selectedAddonsInputCnt[$v])) {
$zz++;
$addonsToSave = $addonsToSave.":x:$selectedAddon->id";
}
# } else {
# $addonsToSave = $selectedAddon->id;
# }
#Устанавливаем спец. цену, если она указана для данной доп. услуги и данного пользователя
#
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$selectedAddon->id);
if ($addonSpecCost) {
$currCost = $addonSpecCost["cost1"]*intval($selectedAddonsInputCnt[$v]) + $addonSpecCost["cost2"]*$hostmonths*intval($selectedAddonsInputCnt[$v]);
} else {
$selectedAddon->cost_start = $selectedAddon->cost_start / GetCurrencyKoeficientByCode($selectedAddon->cost_startCurrency);
$selectedAddon->cost_monthly = $selectedAddon->cost_monthly / GetCurrencyKoeficientByCode($selectedAddon->cost_monthlyCurrency);
$currCost = $selectedAddon->cost_start*intval($selectedAddonsInputCnt[$v]) + $selectedAddon->cost_monthly*$hostmonths*intval($selectedAddonsInputCnt[$v]);
}
if ($promocode and $currCost > 0) {
$coupon = GetCoupon("promo",$promocode,0,"addon",$selectedAddon->id);
if (IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
$promoIds[] = $coupon->id;
$promoSkidkaAddon = $coupon->value;
$promoMaxSrokAddon = $coupon->addonsMaxSrok;
$promoTXT = ", promo-code $promocode";
$promoCodeTXT = $promocode;
$calcRes = calculatePromoDiscountWithMaxSrok($currCost, $hostmonths, $promoMaxSrokAddon, $promoSkidkaAddon);
$promoTotal += $calcRes[summDiscount];
$currCost = $calcRes[totalSummWithDiscount];
}
}
$addonsCost += $currCost;
}
}
if (!$addonsToSaveText) { $addonsToSaveText=$_lang[No]; }
# Учитываем скидку на доп. услуги при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $addonsCost > 0) {
$addonsCost=$addonsCost-($addonsCost/100)*GetAboutUsFromDiscount($aboutusfromid,'addon');
}
$dom=0;
if ($domain_reg == "1" or $domain_reg == "3") {
if ($domain_reg == "3") {$isTransfer = 1;} else {$isTransfer = 0;}
$domaincost = GetDomainCostForUserByZoneId($_SESSION["userId"],$tzones->id,1,$isTransfer);
$domainminsrok=$tzones->minsrok;
if ($domain_reg == "3" and !$tzones->transferRenew and !$tzones->transferCost) {
$domaincost = 0;
$domainminsrok = 0;
}
$dom=$domaincost*($domainminsrok/12);
# Учитываем скидку на домен при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $dom > 0) {
$dom=$dom-($dom/100)*GetAboutUsFromDiscount($aboutusfromid,'domain');
}
if ($certOrder) {
$certCost = GetSetting("sertificateCost");
} else {
$certCost = 0;
}
$pr = GetUserProfileByUserId($_SESSION['userId'],$profileId);
if ($tzones->privacy == "person" and $pr->org == "3") { $privacyOrder = 0; $privacyCost = 0; }
else if ($tzones->privacy and $tzones->privacy_required and !$privacyOrder) { $privacyOrder = 1; }
if ($privacyOrder) {
$privacyCost = $tzones->privacy_cost;
} else {
$privacyCost = 0;
}
if ($localContactOrder) {
$localContactCost = $tzones->localContact_cost;
} else {
$localContactCost = 0;
}
$allsumm = $host+$dom+$certCost+$addonsCost+$privacyCost+$localContactCost;
$domainfree = 0;
$tfreedomains=@mysql_query("select * from tarifs_freedomains where tarif_id='$tarif_id' and zone='$zone' and hostmonths='$hostmonths' and renew='0'") 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 and renew='0'") 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";}
}
if ($promocode and $host > 0) {
$coupon = GetCoupon("promo",$promocode,0,"tarif",$tarif_id);
if (IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
$promoIds[] = $coupon->id;
$promoSkidkaTarif = $coupon->value;
$promoMaxSrokTarif = $coupon->tarifsMaxSrok;
$promoTXT = ", promo-code $promocode";
$promoCodeTXT = $promocode;
}
}
if ($promocode and $dom > 0) {
$coupon = GetCoupon("promo",$promocode,0,"zone",$zid);
if (IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
$promoIds[] = $coupon->id;
$promoSkidkaZone = $coupon->value;
$promoMaxSrokZone = $coupon->zonesMaxSrok;
$promoTXT = ", promo-code $promocode";
$promoCodeTXT = $promocode;
}
}
if ($promoSkidkaTarif) {
$calcRes = calculatePromoDiscountWithMaxSrok($host, $hostmonths, $promoMaxSrokTarif, $promoSkidkaTarif);
$promoTotal += $calcRes[summDiscount];
$host = $calcRes[totalSummWithDiscount];
}
$host = round($host,2);
$addonsCost=round($addonsCost,2);
if ($promoSkidkaZone) {
$calcRes = calculatePromoDiscountWithMaxSrok($dom, $domainminsrok, $promoMaxSrokZone, $promoSkidkaZone);
$promoTotal += $calcRes[summDiscount];
$dom = $calcRes[totalSummWithDiscount];
}
$dom = round($dom+$certCost+$privacyCost+$localContactCost,2);
$allsumm = $host+$addonsCost+$dom;
}
}
if ($step > 2 and !$error and $type == "d") {
if ($useDefaultNS) {
$ns1 = $tzones->defaultNS1;
$ns2 = $tzones->defaultNS2;
$ns3 = $tzones->defaultNS3;
$ns4 = $tzones->defaultNS4;
}
$ns1=trim(mb_strtolower($ns1)); $ns1 = preg_replace("/.$/ui","",$ns1);
$ns2=trim(mb_strtolower($ns2)); $ns2 = preg_replace("/.$/ui","",$ns2);
$ns3=trim(mb_strtolower($ns3)); $ns3 = preg_replace("/.$/ui","",$ns3);
$ns4=trim(mb_strtolower($ns4)); $ns4 = preg_replace("/.$/ui","",$ns4);
$ns1ip=trim($ns1ip); if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns1ip)) { $ns1ip = ""; }
$ns2ip=trim($ns2ip); if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns2ip)) { $ns2ip = ""; }
$ns3ip=trim($ns3ip); if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns3ip)) { $ns3ip = ""; } if (!$ns3) { $ns3ip = ""; }
$ns4ip=trim($ns4ip); if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns4ip)) { $ns4ip = ""; } if (!$ns4) { $ns4ip = ""; }
if (!$ns1) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns1)) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if (preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns1)) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if (preg_match("/.$fulldomain$/u",$ns1) and !$ns1ip) {$error=$_lang[OrderErrorOwnNS1];}
else if ($ns1ip and !preg_match("/.$fulldomain$/u",$ns1)) {$error=$_lang[OrderErrorOwnNSIP];}
else if (!$ns2) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns2)) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if (preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns2)) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if (preg_match("/.$fulldomain$/u",$ns2) and !$ns2ip) {$error=$_lang[OrderErrorOwnNS2];}
else if ($ns2ip and !preg_match("/.$fulldomain$/u",$ns2)) {$error=$_lang[OrderErrorOwnNSIP];}
else if ($ns3 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns3)) {$error=$_lang[OrderErrorNoThirdNS];}
else if (preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns3)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($ns3 and preg_match("/.$fulldomain$/u",$ns3) and !$ns3ip) {$error=$_lang[OrderErrorOwnNS3];}
else if ($ns3ip and !preg_match("/.$fulldomain$/u",$ns3)) {$error=$_lang[OrderErrorOwnNSIP];}
else if ($ns4 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns4)) {$error=$_lang[OrderErrorNoFourNS];}
else if (preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns4)) {$error=$_lang[OrderErrorNoFourNS];}
else if ($ns4 and preg_match("/.$fulldomain$/u",$ns4) and !$ns4ip) {$error=$_lang[OrderErrorOwnNS4];}
else if ($ns4ip and !preg_match("/.$fulldomain$/u",$ns4)) {$error=$_lang[OrderErrorOwnNSIP];}
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 ($ns2ip and $ns1ip == $ns2ip) {$error=$_lang[OrderErrorOwnNS2];}
else if ($ns3ip and ($ns3ip == $ns1ip or $ns3ip == $ns2ip)) {$error=$_lang[OrderErrorOwnNS3];}
else if ($ns4ip and ($ns4ip == $ns1ip or $ns4ip == $ns2ip or $ns4ip == $ns3ip)) {$error=$_lang[OrderErrorOwnNS4];}
else if ($domain_reg == "3" and $tzones->transferNeedAuth and !$transferAuth) {$error=$_lang[OrderErrorNoTransferAuth];}
else if (!$useDefaultNS and $tzones->enableCheckNS and !checkDNS($fulldomain, $tzones->id, $ns1, $ns2, $ns3, $ns4)) {$error=$GLOBALerror;}
else if (!$license and ($tzones->licenseRequired == "yes" or ($tzones->licenseRequired == "idn" and preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]+/u",$domain)))) {$error=$_lang[OrderErrorNoLicense];}
else {
# Учитываем скидку на домен при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $domainCost > 0) {
$domainCost=$domainCost-($domainCost/100)*GetAboutUsFromDiscount($aboutusfromid,'domain');
}
if ($certOrder) {
$certCost = GetSetting("sertificateCost");
} else {
$certCost = 0;
}
$pr = GetUserProfileByUserId($_SESSION['userId'],$profileId);
if ($tzones->privacy == "person" and $pr->org == "3") { $privacyOrder = 0; $privacyCost = 0; }
else if ($tzones->privacy and $tzones->privacy_required and !$privacyOrder) { $privacyOrder = 1; }
if ($privacyOrder) {
$privacyCost = $tzones->privacy_cost;
} else {
$privacyCost = 0;
}
if ($localContactOrder) {
$localContactCost = $tzones->localContact_cost;
} else {
$localContactCost = 0;
}
if ($promocode and $domainCost > 0) {
$coupon = GetCoupon("promo",$promocode,0,"zone",$zid);
if (IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
$promoId = $coupon->id;
$promoSkidka = $coupon->value;
$promoMaxSrok = $coupon->zonesMaxSrok;
$promoTXT = ", promo-code $promocode";
$promoCodeTXT = $promocode;
}
}
if ($promoSkidka) {
$calcRes = calculatePromoDiscountWithMaxSrok($domainCost, $tzones->minsrok, $promoMaxSrok, $promoSkidka);
$promoTotal += $calcRes[summDiscount];
$domainCost = $calcRes[totalSummWithDiscount];
}
$domainCost=round($domainCost+$certCost+$privacyCost+$localContactCost,2);
$allsumm = $domainCost;
}
}
if ($step > 2 and !$error and $type == "dopt") {
if ($dnstype == "each") {
$nodnsflag=false;
$noipdnsflag=false;
$nonsipdnsflag=false;
$freedom = @mb_split("rn",$freedomains);
while (list($k,$v) = @each($freedom)) {
$dns1[$v]=trim(mb_strtolower($dns1[$v])); $dns1[$v] = preg_replace("/.$/ui","",$dns1[$v]);
$dns2[$v]=trim(mb_strtolower($dns2[$v])); $dns2[$v] = preg_replace("/.$/ui","",$dns2[$v]);
$dns3[$v]=trim(mb_strtolower($dns3[$v])); $dns3[$v] = preg_replace("/.$/ui","",$dns3[$v]);
$dns4[$v]=trim(mb_strtolower($dns4[$v])); $dns4[$v] = preg_replace("/.$/ui","",$dns4[$v]);
$dns1ip[$v]=trim($dns1ip[$v]); if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$dns1ip[$v])) { $dns1ip[$v] = ""; }
$dns2ip[$v]=trim($dns2ip[$v]); if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$dns2ip[$v])) { $dns2ip[$v] = ""; }
$dns3ip[$v]=trim($dns3ip[$v]); if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$dns3ip[$v])) { $dns3ip[$v] = ""; } if (!$dns3[$v]) { $dns3ip[$v] = ""; }
$dns4ip[$v]=trim($dns4ip[$v]); if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$dns3ip[$v])) { $dns3ip[$v] = ""; } if (!$dns4[$v]) { $dns4ip[$v] = ""; }
if (!$dns1[$v] or !$dns2[$v]) {$nodnsflag=true;}
if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*.[a-z0-9-.]*[a-z0-9]{1}$/u",$dns1[$v]) or !preg_match("/^[a-z0-9]{1}[a-z0-9-]*.[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-.]*[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-.]*[a-z0-9]{1}$/u",$dns4[$v])) {$nodnsflag=true;}
if (preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$dns1[$v])) {$nodnsflag=true;}
if (preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$dns2[$v])) {$nodnsflag=true;}
if ($dns3[$v] and preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$dns3[$v])) {$nodnsflag=true;}
if ($dns4[$v] and preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$dns4[$v])) {$nodnsflag=true;}
if (preg_match("/.$v$/u",$dns1[$v]) and !$dns1ip[$v]) {$noipdnsflag=true;}
if (preg_match("/.$v$/u",$dns2[$v]) and !$dns2ip[$v]) {$noipdnsflag=true;}
if ($dns3[$v] and preg_match("/.$v$/u",$dns3[$v]) and !$dns3ip[$v]) {$noipdnsflag=true;}
if ($dns4[$v] and preg_match("/.$v$/u",$dns4[$v]) and !$dns4ip[$v]) {$noipdnsflag=true;}
if ($dns1ip[$v] and !preg_match("/.$v$/u",$dns1[$v])) {$nonsipdnsflag=true;}
if ($dns2ip[$v] and !preg_match("/.$v$/u",$dns2[$v])) {$nonsipdnsflag=true;}
if ($dns3ip[$v] and !preg_match("/.$v$/u",$dns3[$v])) {$nonsipdnsflag=true;}
if ($dns4ip[$v] and !preg_match("/.$v$/u",$dns4[$v])) {$nonsipdnsflag=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;}
if ($dns2ip[$v] and $dns2ip[$v] == $dns1ip[$v]) {$noipdnsflag=true;}
if ($dns3ip[$v] and ($dns3ip[$v] == $dns1ip[$v] or $dns3ip[$v] == $dns2ip[$v])) {$noipdnsflag=true;}
if ($dns4ip[$v] and ($dns4ip[$v] == $dns1ip[$v] or $dns4ip[$v] == $dns2ip[$v] or $dns4ip[$v] == $dns3ip[$v])) {$noipdnsflag=true;}
}
} else if ($dnstype == "one") {
$ns1=trim(mb_strtolower($ns1)); $ns1 = preg_replace("/.$/ui","",$ns1);
$ns2=trim(mb_strtolower($ns2)); $ns2 = preg_replace("/.$/ui","",$ns2);
$ns3=trim(mb_strtolower($ns3)); $ns3 = preg_replace("/.$/ui","",$ns3);
$ns4=trim(mb_strtolower($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;}
}
}
$nolicenseflag=false;
$freedom = @mb_split("rn",$freedomains);
while (list($k,$v) = @each($freedom)) {
$zone=GetZoneByNonExistsDomain($v);
if (!$license[$v] and ($zone->licenseRequired == "yes" or ($zone->licenseRequired == "idn" and preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]+/u",$v)))) { $nolicenseflag = 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-.]*[a-z0-9]{1}$/u",$ns1)) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if ($dnstype == "one" and preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/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-.]*[a-z0-9]{1}$/u",$ns2)) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if ($dnstype == "one" and preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns2)) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if ($dnstype == "one" and $ns3 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns3)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($dnstype == "one" and $ns3 and preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/u",$ns3)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($dnstype == "one" and $ns4 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns4)) {$error=$_lang[OrderErrorNoFourNS];}
else if ($dnstype == "one" and $ns4 and preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/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[OrderErrorNoOwnNSForOptAndOne];}
else if ($noipdnsflag) {$error=$_lang[OrderErrorOwnNSOpt];}
else if ($nonsipdnsflag) {$error=$_lang[OrderErrorOwnNSIP];}
else if ($nolicenseflag) {$error=$_lang[OrderErrorNoLicense];}
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=mb_strtolower($domain); $fulldomain=mb_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);
$domainMinSrok=$tzones->minsrok;
$domainCost=$domainCost*($domainMinSrok/12);
# Учитываем скидку на домен при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid) {
$domainCost=$domainCost-($domainCost/100)*GetAboutUsFromDiscount($aboutusfromid,'domain');
}
if ($certOrder[$v]) {
$certCost = GetSetting("sertificateCost");
} else {
$certCost = 0;
}
$pr = GetUserProfileByUserId($_SESSION['userId'],$profile_id[$v]);
if ($tzones->privacy == "person" and $pr->org == "3") { $privacyOrder[$v] = 0; $privacyCost = 0; }
else if ($tzones->privacy and $tzones->privacy_required and !$privacyOrder) { $privacyOrder[$v] = 1; }
if ($privacyOrder[$v]) {
$privacyCost = $tzones->privacy_cost;
} else {
$privacyCost = 0;
}
if ($localContactOrder[$v]) {
$localContactCost = $tzones->localContact_cost;
} else {
$localContactCost = 0;
}
if ($promocode and $domainCost > 0) {
$coupon = GetCoupon("promo",$promocode,0,"zone",$zid);
if (IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
$promoId = $coupon->id;
$promoSkidka = $coupon->value;
$promoMaxSrok = $coupon->zonesMaxSrok;
$promoTXT = ", promo-code $promocode";
$promoCodeTXT = $promocode;
}
}
if ($promoSkidka) {
$calcRes = calculatePromoDiscountWithMaxSrok($domainCost, $tzones->minsrok, $promoMaxSrok, $promoSkidka);
$promoTotal += $calcRes[summDiscount];
$domainCost = $calcRes[totalSummWithDiscount];
}
$domainCost=round($domainCost+$certCost+$privacyCost+$localContactCost,2);
$domainCostArr[$v] = $domainCost;
$domainMinSrokArr[$v] = $domainMinSrok;
$allsumm = $allsumm + $domainCost;
}
}
}
if ($step > 2 and !$error and $type == "shop") {
$months=@intval($months);
if ($t->costtype != "one" and (!$months or $months <= 0)) {$error=$_lang[OrderErrorNoSrokZakaza];}
else if ($t->type == "ispmanagerlite" or $t->type == "ispmanagerlitefull" or $t->type == "ispmanagerlitetrial" or $t->type == "ispmanagerpro" or $t->type == "ispmanagerprofull" or $t->type == "ispmanagerprotrial" or $t->type == "vdsmanagerlinux" or $t->type == "vdsmanagerlinuxfull" or $t->type == "vdsmanagerfreebsd" or $t->type == "vdsmanagerfreebsdfull" or $t->type == "billmanagerstandart" or $t->type == "billmanageradvanced" or $t->type == "billmanagercorporate" or $t->type == "dsmanager" or $t->type == "dsmanagerfull" or $t->type == "dnsmanagerfull" or $t->type == "ipmanagerfull") {
if (!$licenseName) {$error=$_lang[OrderErrorNoLicenseName];}
else if (!$licenseIP) {$error=$_lang[OrderErrorNoLicenseIP];}
else if (!preg_match("/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/",$licenseIP)) {$error=$_lang[OrderErrorNoLicenseIP];}
}
if (!$error) {
$itemmonths = $months;
$itemcost = $t->cost;
if ($t->costtype == "month") {
$itemcost=$itemcost*$itemmonths;
} else if ($t->costtype == "year") {
$itemcost=$itemcost*($itemmonths/12);
}
$tsroki=@mysql_query("select discount from shop_sroki where item='$item_id' and months='$itemmonths' and `order`='1'") 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;
}
$itemcost=$itemcost-($itemcost/100)*$srokDiscount;
# Учитываем скидку на товары при регистрации клиента с указанием источника имеющего скидку
#
if ($aboutusfromid and $itemcost > 0) {
$itemcost=$itemcost-($itemcost/100)*GetAboutUsFromDiscount($aboutusfromid,'shop');
}
if ($promocode and $itemcost > 0) {
$coupon = GetCoupon("promo",$promocode,0,"shopitem",$item_id);
if (IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
$promoId = $coupon->id;
$promoSkidka = $coupon->value;
$promoMaxSrok = $coupon->shopItemsMaxSrok;
$promoTXT = ", promo-code $promocode";
$promoCodeTXT = $promocode;
}
}
if ($promoSkidka) {
$calcRes = calculatePromoDiscountWithMaxSrok($itemcost, $itemmonths, $promoMaxSrok, $promoSkidka);
$promoTotal += $calcRes[summDiscount];
$itemcost = $calcRes[totalSummWithDiscount];
}
$itemcost=round($itemcost,2);
$allsumm = $itemcost;
}
}
if ($step > 3 and !$error) {
if (GetSetting("orderShowSSHLogin") and ($vid == "ssh") and $serverLogin) {
$sshlogincheck = @mysql_query("select * from orders where archived=0 and serverlogin='$serverLogin'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
if (GetSetting("orderShowServerName") and ($vid == "vds" or $vid == "dedicated") and !$servername) {$error=$_lang[OrderErrorServerName];}
else if (GetSetting("orderShowServerName") and ($vid == "vds" or $vid == "dedicated") and preg_match("/[^a-z0-9.-]/i",$servername)) {$error=$_lang[OrderErrorServerNameSymbols];}
else if (GetSetting("orderShowAdminPassword") and ($vid == "vds" or $vid == "dedicated") and !$adminpassword) {$error=$_lang[OrderErrorAdminPassword];}
else if (GetSetting("orderShowPurposeOfUse") and ($vid == "vds" or $vid == "dedicated") and !$purposeofuse) {$error=$_lang[OrderErrorPurposeOfUse];}
else if (GetSetting("orderShowSSHLogin") and ($vid == "ssh") and !$serverLogin) {$error=$_lang[OrderErrorSSHLogin];}
else if (GetSetting("orderShowSSHLogin") and ($vid == "ssh") and preg_match("/[^a-z0-9]/i",$serverLogin)) {$error=$_lang[OrderErrorSSHLoginSymbols];}
else if (GetSetting("orderShowSSHLogin") and ($vid == "ssh") and $serverLogin and @mysql_num_rows($sshlogincheck) > 0) {$error=$_lang[OrderErrorSSHLoginExists];}
else if (GetSetting("orderShowSSHPassword") and ($vid == "ssh") and !$serverPassword) {$error=$_lang[OrderErrorSSHPassword];}
else if (GetSetting("orderShowSSHPassword") and ($vid == "ssh") and preg_match("/[^a-z0-9_-]/i",$serverPassword)) {$error=$_lang[OrderErrorSSHPasswordSymbols];}
else if ($needpersonalinfo and !$personalinfo) {$error=$_lang[OrderErrorNoPersonalInfo];}
else if (GetSetting("captcha_reg") and $_SESSION['captchakey'] != $captchakeyin) {$error=$_lang[ErrorWrongCaptcha];}
else {
if ($type == "h") {
if (preg_match("/.{0,1}[ru|su|рф]$/ui",$zone) and ($domain_reg == "1" or $domain_reg == "3")) {
$isRuDomain="&isR=1";
}
else if (($domain_reg == "1" or $domain_reg == "3")) {
$isDomain="&isD=1";
if ($zone == "pp.ua") { $isPPUADomain = "&isPPUA=1"; }
}
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 $rootpassword and ($vid == "vds" or $vid == "dedicated")) { $commentAddon = $commentAddon.$_lang[OrderRootPassword].": $rootpasswordn"; $serverPassword = $rootpassword; }
if (GetSetting("orderShowPurposeOfUse") and $purposeofuse and ($vid == "vds" or $vid == "dedicated")) { $commentAddon = $commentAddon.$_lang[OrderPurposeOfUse].": $purposeofusen";}
if ($commentAddon) { if ($comment) {$comment = $commentAddon."n".$comment;} else {$comment = $commentAddon;} }
$history = "<B>Тариф:</B> $t->name";
if ($fulldomain) { $history .= ", <B>домен:</b> $fulldomain"; }
@mysql_query("insert into orders (uid,tarif,costId,domain,domain_reg,addons,orderdate,comment,serverid,testPeriod,slots,serverlogin,serverpassword,history,servername) values('".$_SESSION['userId']."','$tarif_id','$costId','$fulldomain','$domain_reg','$addonsToSave',NOW(),'$comment','$server','$testPeriodNeed','$slotsCount','$serverLogin','".encodePwd($serverPassword)."','$history','$servername')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$host_id=mysql_insert_id();
if ($domain_reg == "1" or $domain_reg == "3") {
$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;
if ($domain_reg == "3") {
$transfer = 1; $transferTxt = " (".$_lang[DomainTransferMin].")";
} else {
$transfer = 0; $transferTxt = "";
}
@mysql_query("insert into orders_domains (uid,zone_id,host_id,domain,orderdate,profileId,privacy,license,transfer,transferAuth,localContact) values ('".$_SESSION['userId']."','$zid','$host_id','$fulldomain',NOW(),'$profileId','$privacyOrder','$license','$transfer','$transferAuth','$localContactOrder')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$domain_id=mysql_insert_id();
if ($tzones->free) {
$domFreeCnt = GetDomainsFreeCountTodayByUserId($_SESSION['userId']);
if ($domFreeCnt > 0) {
@mysql_query("update users set freeDomainCount=freeDomainCount+1 where id='".$_SESSION['userId']."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
} else {
@mysql_query("update users set freeDomainCount=1,freeDomainDay=NOW() where id='".$_SESSION['userId']."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
}
if ($certOrder) {
@mysql_query("insert into orders_domainscert (uid,domain_id,order_date) values ('".$_SESSION['userId']."','$domain_id',NOW())") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
}
$history = "Тариф: $t->name, $hostmonths мес.";
if ($domain_id) {
$history .= " + домен <B>$fulldomain</B>, ".($domainminsrok/12)." г.";
if ($transfer) { $history .= " (трансфер)";}
if ($certOrder) { $history .= " + <B>".$_lang[OrderCert]."</B>"; }
if ($privacyOrder) { $history .= " + <B>".$_lang[OrderPrivacy]."</B>"; }
if ($localContactOrder) { $history .= " + <B>".$_lang[OrderLocalContact]."</B>"; }
}
if ($addonsToSaveText and $addonsToSaveText != $_lang[No]) { $history .= " + $addonsToSaveText";}
@mysql_query("insert into bills (uid,tarif,host_id,domain_id,host_srok,domain_srok,money_host,money_domain,money_addons,created,history,transfer,promocode) values('".$_SESSION['userId']."','$t->id','$host_id','$domain_id','$hostmonths','$domainminsrok','$host','$dom','$addonsCost',NOW(),'$history','$transfer','$promoCodeTXT')") 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");
$promoOk = array();
while (list($k,$pr) = @each($promoIds)) {
if (!@in_array("$pr",$promoOk)) {
AddUsedByToCoupon($pr,$_SESSION["userId"],$bill_id);
$promoOk[] = $pr;
}
}
$tpl = GetTpl('email_touser_'.$vid.'_order', $_SESSION["userLang"]);
$subject = $tpl[subject]; $template = $tpl[template];
if ($subject and $template) {
if ($attachPDFtoBill) {
if ($org == "3" or $org == "2") {
$attachFile = createFaktura('', $bill_id, 2);
$attachFile2 = "";
} else if ($org == "1") {
$attachFile = createKvitanciya('', $bill_id, 2);
$attachFile2 = createFaktura('', $bill_id, 2);
}
if (!$attachFile) {$attachFile="";}
if (!$attachFile2) {$attachFile2="";}
}
$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=mb_strtolower($elogin); $tp=$epassword;}
else if ($login and $password and $usertype == "new") {$tl=mb_strtolower($login); $tp=$password;}
else {$tl=$_SESSION["userLogin"]; $tp='******';}
if ($certOrder) { $certAddon = " + ".$_lang[OrderCert]; }
if ($privacyOrder) { $privacyAddon = " + ".$_lang[OrderPrivacy]; }
if ($localContactOrder) { $localContactAddon = " + ".$_lang[OrderLocalContact]; }
$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.$certAddon.$privacyAddon.$localContactAddon,$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);
$template = str_replace('{slots}',$slotsCount,$template);
$template = str_replace('{promocode}',$promoCodeTXT,$template);
$subject = str_replace('{login}',$tl,$subject);
WriteMailLog($subject,$template,$_SESSION['userId']);
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template,$attachFile,$attachFile2,$tpl[type]);
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template,$attachFile,$attachFile2,$tpl[type]);
$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,$attachFile,$attachFile2,$tpl[type]);
}
@unlink($attachFile);
@unlink($attachFile2);
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";
if ($isPPUADomain) { $rF[] = "mobile"; }
} 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.$isPPUADomain); exit;
} else {
if (GetSetting("testPeriodEnable") and $t->testPeriod and $testPeriodNeed) {
if (GetSetting("testPeriodAutoCreate")) {
if (!checkMobile()) {
$testAddon = "&testPeriodHostId=$host_id";
} else {
if (GetSetting("orderProcessTypeHost")) {
AddBillToQueue($bill_id, 1);
} else {
if (createUser($host_id)) {
$testAddon = "&testPeriodCreated=1";
}
}
}
}
$testAddon .= "&testPeriod=1";
}
Header("Location: billing.php?do=pay&fromreg=1&id=$bill_id$testAddon"); exit;
}
}
if ($type == "d") {
if (preg_match("/.{0,1}[ru|su|рф]$/ui",$zone)) {
$isRuDomain="&isR=1";
}
else {
$isDomain="&isD=1";
if ($zone == "pp.ua") { $isPPUADomain = "&isPPUA=1"; }
}
if ($domain_reg == "3") {
$transfer = 1; $transferTxt = " (".$_lang[DomainTransferMin].")";
} else {
$transfer = 0; $transferTxt = "";
}
@mysql_query("insert into orders_domains (uid,zone_id,domain,orderdate,comment,ns1,ns2,ns3,ns4,ns1ip,ns2ip,ns3ip,ns4ip,profileId,defaultNSFlag,privacy,license,transfer,transferAuth,localContact) values ('".$_SESSION['userId']."','$zid','$fulldomain',NOW(),'$comment','$ns1','$ns2','$ns3','$ns4','$ns1ip','$ns2ip','$ns3ip','$ns4ip','$profileId','$useDefaultNS','$privacyOrder','$license','$transfer','$transferAuth','$localContactOrder')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$domain_id=mysql_insert_id();
if ($tzones->free) {
$domFreeCnt = GetDomainsFreeCountTodayByUserId($_SESSION['userId']);
if ($domFreeCnt > 0) {
@mysql_query("update users set freeDomainCount=freeDomainCount+1 where id='".$_SESSION['userId']."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
} else {
@mysql_query("update users set freeDomainCount=1,freeDomainDay=NOW() where id='".$_SESSION['userId']."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
}
if ($certOrder) {
@mysql_query("insert into orders_domainscert (uid,domain_id,order_date) values ('".$_SESSION['userId']."','$domain_id',NOW())") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
$history = "Домен: <B>$fulldomain</B>, ".($domainMinSrok/12)." г.";
if ($transfer) { $history .= " (трансфер)";}
if ($certOrder) { $history .= " + ".$_lang[OrderCert]; }
if ($privacyOrder) { $history .= " + ".$_lang[OrderPrivacy]; }
if ($localContactOrder) { $history .= " + ".$_lang[OrderLocalContact]; }
@mysql_query("insert into bills (uid,domain_id,domain_srok,money_domain,created,history,transfer,promocode) values('".$_SESSION['userId']."','$domain_id','$domainMinSrok','$domainCost',NOW(),'$history','$transfer','$promoCodeTXT')") 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))." г.$transferTxt$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) {
if ($attachPDFtoBill) {
if ($org == "3" or $org == "2") {
$attachFile = createFaktura('', $bill_id, 2);
$attachFile2 = "";
} else if ($org == "1") {
$attachFile = createKvitanciya('', $bill_id, 2);
$attachFile2 = createFaktura('', $bill_id, 2);
}
if (!$attachFile) {$attachFile="";}
if (!$attachFile2) {$attachFile2="";}
}
$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=mb_strtolower($elogin); $tp=$epassword;}
else if ($login and $password and $usertype == "new") {$tl=mb_strtolower($login); $tp=$password;}
else {$tl=$_SESSION["userLogin"]; $tp='******';}
if ($certOrder) { $certAddon = " + ".$_lang[OrderCert]; }
if ($privacyOrder) { $privacyAddon = " + ".$_lang[OrderPrivacy]; }
if ($localContactOrder) { $localContactAddon = " + ".$_lang[OrderLocalContact]; }
$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.$transferTxt.$certAddon.$privacyAddon.$localContactAddon,$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);
$template = str_replace('{promocode}',$promoCodeTXT,$template);
$subject = str_replace('{login}',$tl,$subject);
WriteMailLog($subject,$template,$_SESSION['userId']);
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template,$attachFile,$attachFile2,$tpl[type]);
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template,$attachFile,$attachFile2,$tpl[type]);
$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,$attachFile,$attachFile2,$tpl[type]);
}
@unlink($attachFile);
@unlink($attachFile2);
}
if ($isRuDomain) {
$isR = 1;
$chkProfile = "max";
} else if ($isDomain) {
$isD = 1;
$chkProfile = "min";
if ($isPPUADomain) { $isPPUA = 1; $rF[] = "mobile"; }
} 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.$isPPUADomain); exit;
} else {
Header("Location: billing.php?do=pay&fromreg=1&id=$bill_id"); exit;
}
}
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=mb_strtolower($domain); $fulldomain=mb_strtolower($domain.".".$zone);
if ($dnstype == "each") {
$ns1 = $dns1[$v];
$ns2 = $dns2[$v];
$ns3 = $dns3[$v];
$ns4 = $dns4[$v];
$ns1ip = $dns1ip[$v];
$ns2ip = $dns2ip[$v];
$ns3ip = $dns3ip[$v];
$ns4ip = $dns4ip[$v];
}
if ($profile_id[$v]) { $profileId = $profile_id[$v]; } else { $profileId = ""; }
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,ns1ip,ns2ip,ns3ip,ns4ip,profileId,privacy,license,localContact) values ('".$_SESSION['userId']."','$zid','$fulldomain',NOW(),'$comment','$ns1','$ns2','$ns3','$ns4','$ns1ip','$ns2ip','$ns3ip','$ns4ip','$profileId','$privacyOrder[$v]','$license[$v]','$localContactOrder[$v]')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$domain_id=mysql_insert_id();
$domZone = GetZoneById($zid);
if ($domZone->free) {
$domFreeCnt = GetDomainsFreeCountTodayByUserId($_SESSION['userId']);
if ($domFreeCnt > 0) {
@mysql_query("update users set freeDomainCount=freeDomainCount+1 where id='".$_SESSION['userId']."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
} else {
@mysql_query("update users set freeDomainCount=1,freeDomainDay=NOW() where id='".$_SESSION['userId']."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
}
if ($certOrder[$v]) {
@mysql_query("insert into orders_domainscert (uid,domain_id,order_date) values ('".$_SESSION['userId']."','$domain_id',NOW())") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
$history = "Домен: <B>$fulldomain</B>, ".($domainMinSrokArr[$v]/12)." г.";
if ($certOrder[$v]) { $history .= " + ".$_lang[OrderCert]; }
if ($privacyOrder[$v]) { $history .= " + ".$_lang[OrderPrivacy]; }
if ($localContactOrder[$v]) { $history .= " + ".$_lang[OrderLocalContact]; }
@mysql_query("insert into bills (uid,domain_id,domain_srok,money_domain,created,history,promocode) values('".$_SESSION['userId']."','$domain_id','".$domainMinSrokArr[$v]."','".$domainCostArr[$v]."',NOW(),'$history','$promoCodeTXT')") 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) {
if ($attachPDFtoBill) {
if ($org == "3" or $org == "2") {
$attachFile = createFaktura('', $bill_id, 2);
$attachFile2 = "";
} else if ($org == "1") {
$attachFile = createKvitanciya('', $bill_id, 2);
$attachFile2 = createFaktura('', $bill_id, 2);
}
if (!$attachFile) {$attachFile="";}
if (!$attachFile2) {$attachFile2="";}
}
$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=mb_strtolower($elogin); $tp=$epassword;}
else if ($login and $password and $usertype == "new") {$tl=mb_strtolower($login); $tp=$password;}
else {$tl=$_SESSION["userLogin"]; $tp='******';}
if ($certOrder[$v]) { $certAddon = " + ".$_lang[OrderCert]; } else { $certAddon = ""; }
if ($privacyOrder[$v]) { $privacyAddon = " + ".$_lang[OrderPrivacy]; } else { $privacyAddon = ""; }
if ($localContactOrder[$v]) { $localContactAddon = " + ".$_lang[OrderLocalContact]; } else { $localContactAddon = ""; }
$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.$certAddon.$privacyAddon.$localContactAddon,$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);
$template = str_replace('{promocode}',$promoCodeTXT,$template);
$subject = str_replace('{login}',$tl,$subject);
WriteMailLog($subject,$template,$_SESSION['userId']);
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template,$attachFile,$attachFile2,$tpl[type]);
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template,$attachFile,$attachFile2,$tpl[type]);
$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,$attachFile,$attachFile2,$tpl[type]);
}
@unlink($attachFile);
@unlink($attachFile2);
}
}
Header("Location: billing.php?do=bills"); exit;
}
if ($type == "shop") {
@mysql_query("insert into orders_shop (uid,item,orderdate,comment,field1,field2) values('".$_SESSION['userId']."','$item_id',NOW(),'$comment','$licenseName','$licenseIP')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$item_id=mysql_insert_id();
$history = "Товар: <B>$t->name</B>";
if ($t->costtype == "month") { $history .= ", $itemmonths мес."; }
else if ($t->costtype == "year") { $history .= ", ".($itemmonths/12)." г."; }
@mysql_query("insert into bills (uid,shop_id,shop_srok,money_shop,created,history,promocode) values('".$_SESSION['userId']."','$item_id','$itemmonths','$itemcost',NOW(),'$history','$promoCodeTXT')") 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) {
if ($attachPDFtoBill) {
if ($org == "3" or $org == "2") {
$attachFile = createFaktura('', $bill_id, 2);
$attachFile2 = "";
} else if ($org == "1") {
$attachFile = createKvitanciya('', $bill_id, 2);
$attachFile2 = createFaktura('', $bill_id, 2);
}
if (!$attachFile) {$attachFile="";}
if (!$attachFile2) {$attachFile2="";}
}
$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=mb_strtolower($elogin); $tp=$epassword;}
else if ($login and $password and $usertype == "new") {$tl=mb_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);
$template = str_replace('{promocode}',$promoCodeTXT,$template);
$subject = str_replace('{login}',$tl,$subject);
WriteMailLog($subject,$template,$_SESSION['userId']);
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template,$attachFile,$attachFile2,$tpl[type]);
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template,$attachFile,$attachFile2,$tpl[type]);
$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,$attachFile,$attachFile2,$tpl[type]);
}
@unlink($attachFile);
@unlink($attachFile2);
}
$resCheckProfile = checkProfile(GetSetting("checkprofiletype"), $_SESSION["userId"]);
if (!$resCheckProfile) {
Header("Location: billing.php?do=profile&fromreg=1&bill_id=$bill_id"); exit;
} else {
Header("Location: billing.php?do=pay&fromreg=1&id=$bill_id"); exit;
}
}
}
}
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" or $vid == "ssh") 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 = "550"; }
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;
}
if ($_SESSION["userId"] and !checkMobile()) { Header("Location: billing.php"); exit; }
head('utf-8',$pageTitle);
?><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 id=orderForm action=order.php>";
print "<input type=hidden name=subm value=''>";
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=costId value='$costId'>";
print "<input type=hidden name=slotsCount value='$slotsCount'>";
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'>";
print "<input type=hidden name=domain_reg value='$domain_reg'>";
}
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'>";
print "<input type=hidden name=referalLogin value='$referalLogin'>";
if ($attachPDFtoBill or $registerNeedFIO) {
if ($attachPDFtoBill) {
print "<input type=hidden name=org value='$org'>";
print "<input type=hidden name=country value='$country'>";
print "<input type=hidden name=firma value='$firma'>";
print "<input type=hidden name=phone value='$phone'>";
}
print "<input type=hidden name=surname value='$surname'>";
print "<input type=hidden name=name value='$name'>";
print "<input type=hidden name=otchestvo value='$otchestvo'>";
}
if ($registerNeedMobile) {
print "<input type=hidden name=mobile value='$mobile'>";
}
}
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'>";
if (@is_array($addonsInputCnt)) {$hiddenAddonsInputCnt=parseRPArrayStr($addonsInputCnt,":x:",":");} else {$hiddenAddonsInputCnt=$addonsInputCnt;}
print "<input type=hidden name=addonsInputCnt value='$hiddenAddonsInputCnt'>";
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'>";
print "<input type=hidden name=certOrder value='$certOrder'>";
print "<input type=hidden name=privacyOrder value='$privacyOrder'>";
print "<input type=hidden name=localContactOrder value='$localContactOrder'>";
print "<input type=hidden name=license value='$license'>";
print "<input type=hidden name=transferAuth value='$transferAuth'>";
}
if ($step > 2 and $type == "d") {
print "<input type=hidden name=zone_id value='$zone_id'>";
print "<input type=hidden name=useDefaultNS value='$useDefaultNS'>";
print "<input type=hidden name=transferAuth value='$transferAuth'>";
print "<input type=hidden name=certOrder value='$certOrder'>";
print "<input type=hidden name=privacyOrder value='$privacyOrder'>";
print "<input type=hidden name=localContactOrder value='$localContactOrder'>";
print "<input type=hidden name=license value='$license'>";
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'>";
print "<input type=hidden name=ns1ip value='$ns1ip'>";
print "<input type=hidden name=ns2ip value='$ns2ip'>";
print "<input type=hidden name=ns3ip value='$ns3ip'>";
print "<input type=hidden name=ns4ip value='$ns4ip'>";
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'>";
print "<input type=hidden name=ns1ip value='$ns1ip'>";
print "<input type=hidden name=ns2ip value='$ns2ip'>";
print "<input type=hidden name=ns3ip value='$ns3ip'>";
print "<input type=hidden name=ns4ip value='$ns4ip'>";
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]'>";
print "<input type=hidden name='dns1ip[$v]' value='$dns1ip[$v]'>";
print "<input type=hidden name='dns2ip[$v]' value='$dns2ip[$v]'>";
print "<input type=hidden name='dns3ip[$v]' value='$dns3ip[$v]'>";
print "<input type=hidden name='dns4ip[$v]' value='$dns4ip[$v]'>";
print "<input type=hidden name='certOrder[$v]' value='$certOrder[$v]'>";
print "<input type=hidden name='privacyOrder[$v]' value='$privacyOrder[$v]'>";
print "<input type=hidden name='localContactOrder[$v]' value='$localContactOrder[$v]'>";
print "<input type=hidden name='license[$v]' value='$license[$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'>";
print "<input type=hidden name=licenseName value='$licenseName'>";
print "<input type=hidden name=licenseIP value='$licenseIP'>";
}
if ($step > 2) {
print "<input type=hidden name=promocode value='$promocode'>";
}
if ($error) { print "<code class=warn>".$_lang[Error].": $error</code><BR><BR>"; }
if ($warning) { print "<code class=warn>".htmlDecode($warning)."</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')"> <? print $_lang[OrderRegedUser]?><BR><? }
?><input type=radio name=usertype value=new <? if ($usertype == 'new') {print "checked";} ?> onclick="hideblankdiv('tablelogin'); showblankdiv('tablereg')"> <? print $_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' 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 id=pass 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 id=repass name=repassword value='$repassword' size=30> <A href="#" class=rootlink onclick="getPass('pass','repass'); this.blur(); return false;">".$_lang[OrderGeneratePassword]."</a></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")) {
?>
<script>
function changeValuta(val) {
var url, org;
url = location.href;
if (url.indexOf("?") > -1) {
url = url+"&valuta="+val+"&usertype=new&login="+document.getElementById('orderForm').login.value+"&password="+document.getElementById('orderForm').password.value+"&repassword="+document.getElementById('orderForm').repassword.value+"&email="+document.getElementById('orderForm').email.value;
} else {
url = url+"?valuta="+val+"&usertype=new&login="+document.getElementById('orderForm').login.value+"&password="+document.getElementById('orderForm').password.value+"&repassword="+document.getElementById('orderForm').repassword.value+"&email="+document.getElementById('orderForm').email.value+"&valuta="+val+"&type=<? print $type?>&vid=<? print $vid?>";
}
document.location=url;
}
</script>
<?
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 id=valuta name=valuta "; if ($type != "partner") { print "onchange="javascript: changeValuta(document.getElementById('valuta').value)"";} print ">";
$r = GetCurrencys();
while ($rr = @mysql_fetch_object($r)) {
if ($rr->code == $valuta or $rr->code == CURC) { $selected = "selected"; } else { $selected = ""; }
print "<option value='$rr->code' $selected>$rr->name</option>";
}
print "</select></td></tr>";
}
if ($registerNeedFIO or ($attachPDFtoBill and $type != "partner")) {
if ($phone) { $phone = @mb_split(" ",$phone); $phone[0] = preg_replace("/+/iu","",$phone[0]);} else { $phone = array(); }
$profileTypes=GetSetting("profileTypes"); $profileTypes=mb_split("::",$profileTypes);
if ($org and !@in_array($org,$profileTypes)) { $org = ""; }
if (!$org) {
if (@in_array("1",$profileTypes)) { $org = 1; }
else if (@in_array("2",$profileTypes)) { $org = 2; }
else if (@in_array("3",$profileTypes)) { $org = 3; }
}
if ($org == "1") {$orgCheck1='checked';} else if ($org == "2") {$orgCheck2='checked';} else if ($org == "3") {$orgCheck3='checked';}
if ($attachPDFtoBill and $type != "partner") {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[ProfileUserType].":</td></tr>";
print "<tr class=order_table_tr><td>";
if (@in_array("1",$profileTypes)) { print "<input type=radio onclick="hidediv('profileOrg'); showdiv('profilePerson');" name=org value=1 $orgCheck1> ".$_lang[OrderUserPrivatePerson]." "; }
if (@in_array("2",$profileTypes)) { print "<input type=radio onclick="hidediv('profileOrg'); showdiv('profilePerson');" name=org value=2 $orgCheck2> ".$_lang[OrderUserPrivatePredprinimatel]." "; }
if (@in_array("3",$profileTypes)) { print "<input type=radio name=org onclick="showdiv('profileOrg'); hidediv('profilePerson');" value=3 $orgCheck3> ".$_lang[OrderUserOrg]; }
print "</td></tr>";
}
print "<tr class=order_table_tr><td>";
if ($org == "3") { $profileOrgDisplay = "block"; $profilePersonDisplay = "none";} else { $profileOrgDisplay = "none"; $profilePersonDisplay = "org";}
if ($attachPDFtoBill and $type != "partner") {
print "<div id=profileOrg style="display: $profileOrgDisplay;">";
print "<table width=100% class=order_table>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[ProfileOrg].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=firma value="$firma" title='".$_lang[ProfileOrgComment]."' size=40></td></tr>";
print "</table>";
print "</div>";
}
if ($registerNeedFIO == "2" or ($attachPDFtoBill and $type != "partner")) { $warnCode = "<code class=warn>*</code>"; } else { $warnCode = ""; }
print "<div id=profilePerson style="display: $profilePersonDisplay;">";
print "<table width=100% class=order_table>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>$warnCode ".$_lang[ProfileSurname].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=surname value="$surname" size=40></td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>$warnCode ".$_lang[ProfileName].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=name value="$name" size=40></td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>$warnCode ".$_lang[ProfileOtchestvo].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=otchestvo value="$otchestvo" size=40></td></tr>";
print "</table>";
print "</div>";
print "</td></tr>";
if ($attachPDFtoBill and $type != "partner") {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[ProfileCountry].":</td></tr>";
print "<tr class=order_table_tr><td>"; printCountrySelect($country); print "</td></tr>";
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[ProfilePhone].":</td></tr>";
print "<tr class=order_table_tr><td>+ <input class=input type=text name=phone[0] maxlength=3 value="$phone[0]" title="".$_lang[ProfilePhoneCountryCodeComment]."" size=1> ( <input class=input type=text maxlength=5 name=phone[1] value="$phone[1]" title="".$_lang[ProfilePhoneCodeComment]."" size=1> ) <input class=input type=text name=phone[2] value="$phone[2]" title="".$_lang[ProfilePhoneNumberComment]."" maxlength=8 size=5></td></tr>";
}
}
if ($registerNeedMobile) {
if ($mobile) { $mobile = @mb_split(" ",$mobile); $mobile[0] = preg_replace("/+/iu","",$mobile[0]);} else { $mobile = array(); }
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>"; if ($registerNeedMobile == "2") { print "<code class=warn>*</code> "; } print $_lang[ProfileMobile].":</td></tr>";
if ($registerNeedMobile == "2" and $registerNeedMobileVerification) { print "<tr class=order_table_tr><td class=styleHelp>$_lang[VerificationInfo]</td></tr>"; }
print "<tr class=order_table_tr><td>+ <input class=input type=text name=mobile[0] maxlength=3 value="$mobile[0]" title="".$_lang[ProfilePhoneCountryCodeComment]."" size=1> ( <input class=input type=text maxlength=5 name=mobile[1] value="$mobile[1]" title="".$_lang[ProfileMobileCodeComment]."" size=1> ) <input class=input type=text name=mobile[2] value="$mobile[2]" title="".$_lang[ProfilePhoneNumberComment]."" maxlength=8 size=5></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 ($needpersonalinfo and $type == "partner") {
$needpersonalinfourl = GetSetting("needpersonalinfourl");
$personalinfotxt = $_lang[OrderPrefixS]." <A class=rootlink href=$needpersonalinfourl target=_blank>".$_lang[OrderPersonalInfo2]."</a> ".$_lang[OrderPretenziyNeImeyu];
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> $_lang[OrderPersonalInfo]:</td></tr>";
if ($personalinfo) {$personalCheck1="checked";}
print "<tr class=order_table_tr><td><input class=input type=checkbox name=personalinfo $personalCheck1> $personalinfotxt</td></tr>";
}
if ($partnerEnable and $partnerEnableOrderReferalLogin) {
if ($_COOKIE["partnerRootPanelCookie"]) { $referalLogin = GetUserById($_COOKIE["partnerRootPanelCookie"]); $referalLogin = $referalLogin->login; }
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderReferalLogin].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=referalLogin value="$referalLogin" size=20></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'";
}
}
$orderTarifType=GetSetting("orderTarifType");
if ($orderTarifType == "select") { print "<select name=tarif_id id=tarif_id onChange='selectMe(this)' class=input>"; $selectedJsArray = array();}
$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);
$selectedWithSlots=0;
$selectedOnlyWithDomain=0;
$selectedAllowWithoutDomain=0;
$iii=0;
while ($rr = @mysql_fetch_object($r)) {
if (!$vid) { $vid = $rr->vid; }
$rr->cost = $rr->cost / GetCurrencyKoeficientByCode($rr->costCurrency);
$rr->cost_setup = $rr->cost_setup / GetCurrencyKoeficientByCode($rr->cost_setupCurrency);
$iii++;
if ($_SESSION['userId']) {
$tarifSpecCost = GetSpecialCost($_SESSION['userId'],"tarif",$rr->id);
if ($tarifSpecCost) {
$rr->cost_setup = $tarifSpecCost["cost1"];
$rr->cost = $tarifSpecCost["cost2"];
}
}
if ($orderShowTarifMinCost) {
$maxDiscount=@mysql_query("select MAX(discount) as maxDiscount from tarifs_sroki where tarif_id='$rr->id' and `order`='1'") 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;
}
} else {
$maxDiscount = 0;
}
if ($rr->id == $tarif_id or $tarif == $rr->name or $tarifs_cnt == 1 or ($iii == 1 and !$tarif_id)) {
$addon='checked';
if (!$tarif_id) { $tarif_id=$rr->id; }
if ($rr->enableSlots) { $selectedWithSlots=1; }
if ($rr->onlyWithDomain) { $selectedOnlyWithDomain=1; }
if ($rr->allowWithoutDomain) { $selectedAllowWithoutDomain=1; }
} else {
$addon='';
}
if ($rr->cost_setup) {
$tarifCostSetup = $rr->cost_setup;
$addon_cost=" + ".round($tarifCostSetup*CURK,2)." ".CURS." ".$_lang[OrderRazovoZaUstanovku];
} else {
$addon_cost="";
}
if ($rr->enableSlots) {
$slotCostAddon=" ".$_lang[OrderForSlot];
$jsAddon = "showdiv('slots');";
} else {
$slotCostAddon="";
$jsAddon = "hidediv('slots');";
}
if ($maxDiscount > 0) {
$tarifCost = $rr->cost - $rr->cost/100*$maxDiscount;
$tarifCostTxt = $_lang[OrderFrom]." ".round($tarifCost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth].$slotCostAddon.$addon_cost;
} else {
$tarifCostTxt = round($rr->cost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth].$slotCostAddon.$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 = ""; }
if ($rr->onlyWithDomain) {
$jsAddon .= "document.getElementById('domExists').disabled=1;";
# if ($vid == "vds" or $vid == "dedicated" or $vid == "vpn" or $vid == "ssh") { $jsAddon .= "document.getElementById('domWithout').disabled=1;"; }
$jsAddon .= "document.getElementById('domWithout').disabled=1;";
} else {
$jsAddon .= "document.getElementById('domExists').disabled=0;";
# if ($vid == "vds" or $vid == "dedicated" or $vid == "vpn" or $vid == "ssh") { $jsAddon .= "document.getElementById('domWithout').disabled=0;"; }
if ($rr->allowWithoutDomain) {
$jsAddon .= "document.getElementById('domWithout').disabled=0;";
} else {
$jsAddon .= "document.getElementById('domWithout').disabled=1;";
}
}
if ($orderTarifType == "select") {
$selectedJsArray[$rr->id] = "$jsAddon";
if ($addon == "checked") {$addon="selected";}
print "<option value=$rr->id $addon> $rr->name (".$tarifCostTxt.") $description</option>";
} else {
$jsAddon = "onclick="$jsAddon"";
print "<input type=radio name=tarif_id value=$rr->id $addon $slotAddon $jsAddon> $rr->name (".$tarifCostTxt.") $description<BR>";
$tarifsCosts = GetTarifsCostsActive($rr->id);
if (@mysql_num_rows($tarifsCosts) > 0) {
print " <span class=styleHelp>".$_lang[OrderCostsVariants].":</span><BR>";
while ($tarifsCost = @mysql_fetch_object($tarifsCosts)) {
$tarifsCost->cost_setup = $tarifsCost->cost_setup / GetCurrencyKoeficientByCode($tarifsCost->cost_setupCurrency);
$tarifsCost->cost = $tarifsCost->cost / GetCurrencyKoeficientByCode($tarifsCost->costCurrency);
if ($tarifsCost->cost_setup) {
$addonTarifsCost=" + ".round($tarifsCost->cost_setup*CURK,2)." ".CURS." ".$_lang[OrderRazovoZaUstanovku];
} else {
$addonTarifsCost="";
}
if ($maxDiscount > 0) {
$tarifsCost->cost = $tarifsCost->cost - $tarifsCost->cost/100*$maxDiscount;
$tarifsCostTxt = $_lang[OrderFrom]." ".round($tarifsCost->cost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth].$slotCostAddon.$addonTarifsCost;
} else {
$tarifsCostTxt = round($tarifsCost->cost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth].$slotCostAddon.$addonTarifsCost;
}
if ($costId == $tarifsCost->id) { $tarifsCostAddon = "checked"; } else { $tarifsCostAddon = ""; }
print " <input type=radio name=costId value=$tarifsCost->id $tarifsCostAddon> $tarifsCostTxt<BR>";
}
}
}
}
if ($orderTarifType == "select") {
print "</select>";
print "
<script language=javascript type='text/javascript'>
function selectMe(f)
{
var id;
id=tarif_id.options[tarif_id.selectedIndex].value;
";
while (list($k,$v) = @each($selectedJsArray)) {
print "if (id == $k) {".$v."}
";
}
print "
}
</script>
";
}
if ($selectedWithSlots) { $st = "block"; } else {$st = "none";}
print "<div id=slots style='display: $st;'><BR><code class=warn>*</code> ".$_lang[OrderSlotsCount].": <input type=text name=slotsCount class=input size=5 value=$slotsCount></div>";
print "</td></tr>";
$orderNotShowDomainsBlock = @mb_split("::",GetSetting("orderNotShowDomainsBlock"));
if (@in_array($vid,$orderNotShowDomainsBlock) or $vid == "vpn" or $vid == "ssh") {
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>";
$weSalesTypes = GetSetting("weSalesTypes");
$weSalesTypes = @mb_split("::",$weSalesTypes);
if (!@in_array("domains",$weSalesTypes)) { $domain_reg = "0"; }
if ($domain_reg == "1") {$domCheck1="checked";}
if ($domain_reg == "0") {$domCheck2="checked";}
if ($domain_reg == "2") {$domCheck3="checked";}
if ($domain_reg == "3") {$domCheck4="checked";}
if ($selectedOnlyWithDomain) {
$domDisabled1="";
$domDisabled2="disabled";
$domDisabled3="disabled";
$domDisabled4="";
} else {
$domDisabled1="";
$domDisabled2="";
if ($selectedAllowWithoutDomain) {
$domDisabled3="";
} else {
$domDisabled3="disabled";
}
$domDisabled4="";
}
if (@in_array("domains",$weSalesTypes)) { print "<input type=radio name=domain_reg value=1 id=domNew $domCheck1 $domDisabled1 onclick="hideblankdiv('domain0'); showblankdiv('domain1')"> ".$_lang[OrderDomainNew]."<BR>"; }
if (@in_array("domains",$weSalesTypes) and GetZonesNamesActiveWithTransferCount() > 0) { print "<input type=radio name=domain_reg value=3 id=domTransfer $domCheck4 $domDisabled4 onclick="hideblankdiv('domain0'); showblankdiv('domain1')"> ".$_lang[OrderDomainTransfer]."<BR>"; }
print "<input type=radio name=domain_reg id=domExists value=0 $domCheck2 $domDisabled2 onclick="hideblankdiv('domain1'); showblankdiv('domain0')"> ".$_lang[OrderDomainExists]."<BR>";
print "<input type=radio name=domain_reg id=domWithout value=2 $domCheck3 $domDisabled3 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 (@in_array("domains",$weSalesTypes)) {
if ($domain_reg == "1" or $domain_reg == "3") {$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 = GetDomainMinCostForUserByZone($_SESSION["userId"],$rr->zone,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 = GetDomainMinCostForUserByZone($_SESSION["userId"],$rr->zone,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>";
$weSalesTypes = GetSetting("weSalesTypes");
$weSalesTypes = @mb_split("::",$weSalesTypes);
if (@in_array("domains",$weSalesTypes) and GetZonesNamesActiveWithTransferCount() > 0) {
print "<tr class=order_table_tr><td>";
if (!$domain_reg) {$domain_reg=1;}
if ($domain_reg == "1") {$domCheck1="checked";}
if ($domain_reg == "3") {$domCheck2="checked";}
print "<input type=radio name=domain_reg value=1 $domCheck1> ".$_lang[OrderDomainNew]."<BR>";
print "<input type=radio name=domain_reg value=3 $domCheck2> ".$_lang[OrderDomainTransfer]."<BR>";
print "</td></tr>";
} else {
print "<input type=hidden name=domain_reg value=1>";
}
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);
if ($_SESSION['userId']) {
$freeDomsToday = GetDomainsFreeCountTodayByUserId($_SESSION['userId']);
} else {
$freeDomsToday = 0;
}
$freedomains=array();
while (list($k,$v) = @each($domain)) {
if ($v) {
$arr=""; $res="";
$v=preg_replace("/^www./ui","",$v);
preg_match("/^([^.]+).(.+)$/ui",$v,$arr);
$dname=mb_strtolower($arr[1]); $dzone=mb_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 ($activeZone->idn == "no" and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}$/u",$dname)) { $res = $_lang[OrderDomainStatusErrorSymbolsNoIDN]; $colorStyle = "domainerror";}
else if ($activeZone->idn == "yes" and !preg_match("/^[a-zа-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}[a-zа-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9-]*[a-zа-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}$/u",$dname)) { $res = $_lang[OrderDomainStatusErrorSymbols]; $colorStyle = "domainerror";}
else if ($activeZone->idn == "only" and !preg_match("/^[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9-]*[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ0-9]{1}$/u",$dname)) { $res = $_lang[OrderDomainStatusErrorSymbolsOnlyIDN]; $colorStyle = "domainerror";}
else if ($activeZone->free and $domainFreeLimit > 0 and $freeDomsToday >= $domainFreeLimit) { $res = $_lang[OrderErrorDomainFreeLimit]." ($domainFreeLimit)"; $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;
if ($activeZone->free) {$freeDomsToday++;}
}
}
}
print "<tr class=order_subtable_tr><td>"; if ($dname and $dzone) { print "$dname.$dzone"; } else {print "$v";} print "</td><td class='$colorStyle' style='padding-left: 10px'>$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 = GetDomainMinCostForUserByZone($_SESSION["userId"],$zone->zone,$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 name") 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' and `order`='1' 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" or $domain_reg == "3") {
$tfreedomains=@mysql_query("select zone from tarifs_freedomains where tarif_id='$tarif_id' and hostmonths='$rr->months' and renew='0'") 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=@mb_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 and !$oneAddon->onlyifrenew) {
$allAddonsCnt++;
if ($oneAddon->isOs) {$osCnt++;}
else if ($oneAddon->isPanel) {$panelCnt++;}
else {$addonsCnt++;}
}
}
}
if ($allAddonsCnt > 0) {
if ($prev) {$addons=@mb_split(":x:",$addons); $addonsInputCnt=parseRPStrArray($addonsInputCnt,":x:",":");}
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 and !$oneAddon->onlyifrenew) {
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$oneAddon->id);
if ($addonSpecCost) {
$oneAddon->cost_start = $addonSpecCost["cost1"];
$oneAddon->cost_monthly = $addonSpecCost["cost2"];
} else {
$oneAddon->cost_start = $oneAddon->cost_start / GetCurrencyKoeficientByCode($oneAddon->cost_startCurrency);
$oneAddon->cost_monthly = $oneAddon->cost_monthly / GetCurrencyKoeficientByCode($oneAddon->cost_monthlyCurrency);
}
$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 and !$oneAddon->onlyifrenew) {
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$oneAddon->id);
if ($addonSpecCost) {
$oneAddon->cost_start = $addonSpecCost["cost1"];
$oneAddon->cost_monthly = $addonSpecCost["cost2"];
} else {
$oneAddon->cost_start = $oneAddon->cost_start / GetCurrencyKoeficientByCode($oneAddon->cost_startCurrency);
$oneAddon->cost_monthly = $oneAddon->cost_monthly / GetCurrencyKoeficientByCode($oneAddon->cost_monthlyCurrency);
}
$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>";
$addonsGroupSelect = array();
reset($addonsForTarif);
while (list($k,$v) = @each($addonsForTarif)) {
if ($v) {
$oneAddon = GetAddonById($v);
if ($oneAddon->active and !$oneAddon->isOs and !$oneAddon->isPanel and !$oneAddon->onlyifrenew) {
$group = GetAddonsGroupById($oneAddon->addonsgroup);
if ($group->isSelect) { $addonsGroupSelect[$group->id][] = $oneAddon->id; }
else {
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$oneAddon->id);
if ($addonSpecCost) {
$oneAddon->cost_start = $addonSpecCost["cost1"];
$oneAddon->cost_monthly = $addonSpecCost["cost2"];
} else {
$oneAddon->cost_start = $oneAddon->cost_start / GetCurrencyKoeficientByCode($oneAddon->cost_startCurrency);
$oneAddon->cost_monthly = $oneAddon->cost_monthly / GetCurrencyKoeficientByCode($oneAddon->cost_monthlyCurrency);
}
$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)";
if (!$addonsInputCnt[$v]) { $addonsInputCnt[$v] = 1; }
if ($oneAddon->cntforoneorder != 1 and $oneAddon->allowSetCnt) { print ", <input type=text class=input size=1 name=addonsInputCnt[$v] value=".$addonsInputCnt[$v]."> ".$_lang[FakturaSokraschenieShtuka];} else { print "<input type=hidden name=addonsInputCnt[$v] value=".$addonsInputCnt[$v].">"; }
print "<BR>";
}
}
}
}
@ksort($addonsGroupSelect);
while (list($k,$v) = @each($addonsGroupSelect)) {
if ($k) {
$f=0;
$fCNT = count($v);
while (list($kk,$vv) = @each($v)) {
$f++;
$oneAddon = GetAddonById($vv);
$group = GetAddonsGroupById($k);
$addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$oneAddon->id);
if ($addonSpecCost) {
$oneAddon->cost_start = $addonSpecCost["cost1"];
$oneAddon->cost_monthly = $addonSpecCost["cost2"];
} else {
$oneAddon->cost_start = $oneAddon->cost_start / GetCurrencyKoeficientByCode($oneAddon->cost_startCurrency);
$oneAddon->cost_monthly = $oneAddon->cost_monthly / GetCurrencyKoeficientByCode($oneAddon->cost_monthlyCurrency);
}
if ($f == 1) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$group->name.":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<select class=input name=addons[] ><option></option>";
}
$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="selected";} else {$addCheck="";}
print "<option $addCheck value=$oneAddon->id> $oneAddon->name ($addonMoney)";
if (!$addonsInputCnt[$vv]) { $addonsInputCnt[$vv] = 1; }
print "<BR>";
if ($f == $fCNT) {
print "</select>";
reset($v);
while (list($kk,$vv) = @each($v)) {
print "<input type=hidden name=addonsInputCnt[$vv] value=".$addonsInputCnt[$vv].">";
}
}
}
}
}
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 (!($subserverone->accLimit > 0 and GetServerUserCount($subserverone->id) >= $subserverone->accLimit)) {
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" or $domain_reg == "3") {
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 ($domain_reg == "3" and $tzones->transferNeedAuth) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomainTransferAuth].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=transferAuth value='$transferAuth' size=30>";
print "</td></tr>";
}
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>";
}
$localContactUser = GetUserByLogin(GetSetting("localContactUser"));
if ($_SESSION["userId"] or ($localContactUser->id and $tzones->localContact)) {
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>";
if ($_SESSION["userId"]) {
printProfileSelect($_SESSION["userId"],$profileId);
print "<BR>";
}
if ($localContactUser->id and $tzones->localContact) {
if ($tzones->localContact_cost) { $localContactAddonCost = round($tzones->localContact_cost*CURK,2)." ".CURS."/".$_lang[OrderYear]; } else { $localContactAddonCost = $_lang[OrderFree]; }
print "<input type=checkbox class=input name=localContactOrder "; if ($localContactOrder) {print "checked";} print " value=1> ".$_lang[OrderLocalContactOrder]." (".$localContactAddonCost.") <img src='./_rootimages/question.gif' alt='$_lang[OrderLocalContactHelp]'>";
}
}
if ($tzones->licenseRequired == "yes" or ($tzones->licenseRequired == "idn" and preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]+/u",$domain))) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomainTM].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=license value='$license' size=30>";
print "</td></tr>";
}
if ($tzones->privacy) {
if ($tzones->privacy == "person") { $privacyAddonTitle = " (".$_lang[OrderrOnlyForPerson].")"; }
if ($tzones->privacy_cost) { $privacyAddonCost = round($tzones->privacy_cost*CURK,2)." ".CURS."/".$_lang[OrderYear]; } else { $privacyAddonCost = $_lang[OrderFree]; }
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderPrivacy].$privacyAddonTitle.":</td></tr>";
print "<tr class=order_table_tr><td><input type=checkbox class=input name=privacyOrder "; if ($privacyOrder) {print "checked";} print " value=1> ".$_lang[OrderPrivacyOrder]." (".$privacyAddonCost.")</td></tr>";
}
if (GetSetting("sertificateEnable")) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderCert].":</td></tr>";
print "<tr class=order_table_tr><td><input type=checkbox class=input name=certOrder "; if ($certOrder) {print "checked";} print " value=1> ".$_lang[OrderCertOrder]." (".round(GetSetting("sertificateCost")*CURK,2)." ".CURS.")</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 ($domain_reg == "3" and $tzones->transferNeedAuth) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomainTransferAuth].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=transferAuth value='$transferAuth' size=30>";
print "</td></tr>";
}
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>";
} else {
$registrator = GetRegistratorById($tzones->autoreg);
}
$localContactUser = GetUserByLogin(GetSetting("localContactUser"));
if ($_SESSION["userId"] or ($localContactUser->id and $tzones->localContact)) {
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>";
if ($_SESSION["userId"]) {
printProfileSelect($_SESSION["userId"],$profileId);
print "<BR>";
}
if ($localContactUser->id and $tzones->localContact) {
if ($tzones->localContact_cost) { $localContactAddonCost = round($tzones->localContact_cost*CURK,2)." ".CURS."/".$_lang[OrderYear]; } else { $localContactAddonCost = $_lang[OrderFree]; }
print "<input type=checkbox class=input name=localContactOrder "; if ($localContactOrder) {print "checked";} print " value=1> ".$_lang[OrderLocalContactOrder]." (".$localContactAddonCost.") <img src='./_rootimages/question.gif' alt='$_lang[OrderLocalContactHelp]'>";
}
print "</td></tr>";
}
if ($tzones->licenseRequired == "yes" or ($tzones->licenseRequired == "idn" and preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]+/u",$domain))) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderDomainTM].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input class=input type=text name=license value='$license' size=30>";
print "</td></tr>";
}
if ($tzones->privacy) {
if ($tzones->privacy == "person") { $privacyAddonTitle = " (".$_lang[OrderrOnlyForPerson].")"; }
if ($tzones->privacy_cost) { $privacyAddonCost = round($tzones->privacy_cost*CURK,2)." ".CURS."/".$_lang[OrderYear]; } else { $privacyAddonCost = $_lang[OrderFree]; }
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderPrivacy].$privacyAddonTitle.":</td></tr>";
print "<tr class=order_table_tr><td><input type=checkbox class=input name=privacyOrder "; if ($privacyOrder) {print "checked";} print " value=1> ".$_lang[OrderPrivacyOrder]." (".$privacyAddonCost.")</td></tr>";
}
if (GetSetting("sertificateEnable")) {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td>".$_lang[OrderCert].":</td></tr>";
print "<tr class=order_table_tr><td><input type=checkbox class=input name=certOrder "; if ($certOrder) {print "checked";} print " value=1> ".$_lang[OrderCertOrder]." (".round(GetSetting("sertificateCost")*CURK,2)." ".CURS.")</td></tr>";
}
print "<tr height=3><td></td></tr>";
if ($tzones->enableDefaultNS and $tzones->defaultNS1 and $tzones->defaultNS2) {
if ($useDefaultNS) {
$useDefaultNSCheck1 = "checked";
$useDefaultNSCheck2 = "";
$nsDisabled = "disabled";
$ns1="";
$ns2="";
$ns3="";
$ns4="";
$ns1ip="";
$ns2ip="";
$ns3ip="";
$ns4ip="";
} else {
$useDefaultNSCheck1 = "";
$useDefaultNSCheck2 = "checked";
$nsDisabled = "";
}
print "<tr class=order_table_tr_title><td>".$_lang[OrderDNS].":</td></tr>";
print "<tr class=order_table_tr><td>";
print "<input type=radio name=useDefaultNS $useDefaultNSCheck1 onclick='this.form.ns1.disabled=1; this.form.ns2.disabled=1; this.form.ns3.disabled=1; this.form.ns4.disabled=1;' value=1 class=input> ".$_lang[OrderUseDefaultNS]."<BR>";
print "<input type=radio name=useDefaultNS $useDefaultNSCheck2 onclick='this.form.ns1.disabled=0; this.form.ns2.disabled=0; this.form.ns3.disabled=0; this.form.ns4.disabled=0;' value=0 class=input> ".$_lang[OrderFillOwnNS];
print "</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 $nsDisabled name=ns1 value='$ns1' size=30>";
if ($registrator->type != "gfx" and $domain_reg != "3") { print " ".$_lang[OrderIP].": <input class=input type=text $nsDisabled name=ns1ip value='$ns1ip' size=20 maxlength=15>"; }
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 $nsDisabled name=ns2 value='$ns2' size=30>";
if ($registrator->type != "gfx" and $domain_reg != "3") { print " ".$_lang[OrderIP].": <input class=input type=text $nsDisabled name=ns2ip value='$ns2ip' size=20 maxlength=15>"; }
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 $nsDisabled name=ns3 value='$ns3' size=30>";
if ($registrator->type != "gfx" and $domain_reg != "3") { print " ".$_lang[OrderIP].": <input class=input type=text $nsDisabled name=ns3ip value='$ns3ip' size=20 maxlength=15>"; }
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 $nsDisabled name=ns4 value='$ns4' size=30>";
if ($registrator->type != "gfx" and $domain_reg != "3") { print " ".$_lang[OrderIP].": <input class=input type=text $nsDisabled name=ns4ip value='$ns4ip' size=20 maxlength=15>"; }
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)) {
$zone=GetZoneByNonExistsDomain($v);
$registrator = GetRegistratorById($zone->autoreg);
print "<tr class=order_subtable_tr><td>$v</td><Td><input class=input type=text name=dns1[$v] value='".$dns1[$v]."' size=8>";
if ($registrator->type != "gfx") { print "<BR>".$_lang[OrderIP].": <input class=input type=text name=dns1ip[$v] value='".$dns1ip[$v]."' size=5>"; }
print "</td><td><input type=text class=input name=dns2[$v] value='".$dns2[$v]."' size=8>";
if ($registrator->type != "gfx") { print "<BR>".$_lang[OrderIP].": <input class=input type=text name=dns2ip[$v] value='".$dns2ip[$v]."' size=5>"; }
print "</td><td><input type=text class=input name=dns3[$v] value='".$dns3[$v]."' size=8>";
if ($registrator->type != "gfx") { print "<BR>".$_lang[OrderIP].": <input class=input type=text name=dns3ip[$v] value='".$dns3ip[$v]."' size=5>"; }
print "</td><td><input type=text class=input name=dns4[$v] value='".$dns4[$v]."' size=8>";
if ($registrator->type != "gfx") { print "<BR>".$_lang[OrderIP].": <input class=input type=text name=dns4ip[$v] value='".$dns4ip[$v]."' size=5>"; }
print "</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>";
$sertificateEnable = GetSetting("sertificateEnable");
$sertificateCost = GetSetting("sertificateCost");
reset($freedomains);
while (list($k,$v) = each($freedomains)) {
$zone=GetZoneByNonExistsDomain($v);
print "<tr class=order_subtable_tr><td valign=top><B>$v</b></td><Td>";
if ($zone->warning) { print "<code class=warn>".htmlDecode($zone->warning)."</code><BR><BR>"; }
printProfileSelect($_SESSION["userId"],$profile_id[$v],0,"profile_id[$v]");
print "<BR>";
$localContactUser = GetUserByLogin(GetSetting("localContactUser")); if ($localContactUser->id and $zone->localContact) {
if ($zone->localContact_cost) { $localContactAddonCost = round($zone->localContact_cost*CURK,2)." ".CURS."/".$_lang[OrderYear]; } else { $localContactAddonCost = $_lang[OrderFree]; }
print "<input type=checkbox class=input name=localContactOrder[$v] "; if ($localContactOrder[$v]) {print "checked";} print " value=1> ".$_lang[OrderLocalContactOrder]." (".$localContactAddonCost.") <img src='./_rootimages/question.gif' alt='$_lang[OrderLocalContactHelp]'><BR>";
}
if ($zone->privacy) {
if ($zone->privacy == "person") { $privacyAddonTitle = ", ".$_lang[OrderrOnlyForPerson]; }
if ($zone->privacy_cost) { $privacyAddonCost = round($zone->privacy_cost*CURK,2)." ".CURS."/".$_lang[OrderYear]; } else { $privacyAddonCost = $_lang[OrderFree]; }
print "<input type=checkbox class=input name=privacyOrder[$v] "; if ($privacyOrder[$v]) {print "checked";} print " value=1> ".$_lang[OrderPrivacyOrder].$privacyAddonTitle." (".$privacyAddonCost.")<BR>";
}
if ($sertificateEnable) {
print "<input type=checkbox class=input name=certOrder[$v] "; if ($certOrder[$v]) {print "checked";} print " value=1> ".$_lang[OrderCertOrder]." (".round($sertificateCost*CURK,2)." ".CURS.")<BR>";
}
if ($zone->licenseRequired == "yes" or ($zone->licenseRequired == "idn" and preg_match("/[а-яёЁїЇіІєЄӘәҒғҚқҢңӨөҮүҰұҺһ]+/u",$v))) {
print "<BR><code class=warn>*</code> ".$_lang[OrderDomainTM].": <input class=input type=text name=license[$v] value='$license[$v]' size=10>";
}
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_sroki where item='$item_id' and `order`='1' 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></tr>";
while ($rr = @mysql_fetch_object($r)) {
if ($t->costtype == "month") {$sokrashenie = $_lang[OrderSokraschenieMonth]; $m = $rr->months;}
else if ($t->costtype == "year") {$sokrashenie = $_lang[OrderSokraschenieGod]; $m = $rr->months / 12;}
$cost = $t->cost*$m;
$itogo=$cost-($cost/100)*$rr->discount;
if ($rr->discount) {$discount="<B>$rr->discount%</b>";} else {$discount="$rr->discount%";}
if ($months == $rr->months) {$monthCheck='checked';} else {$monthCheck='';}
print "<tr class=order_subtable_tr><Td align=center><input type=radio name=months value=$rr->months $monthCheck></td><td> $m ".$sokrashenie."</td><td> ".round($cost*CURK,2)." ".CURS."</td><td> $discount</td><td> ".round($itogo*CURK,2)." ".CURS."</td></tr>";
}
print "</table>";
} else {
print $_lang[OrderErrorNetSrokovZakaza];
}
print "</td></tr>";
}
if ($t->type == "ispmanagerlite" or $t->type == "ispmanagerlitefull" or $t->type == "ispmanagerlitetrial" or $t->type == "ispmanagerpro" or $t->type == "ispmanagerprofull" or $t->type == "ispmanagerprotrial" or $t->type == "vdsmanagerlinux" or $t->type == "vdsmanagerlinuxfull" or $t->type == "vdsmanagerfreebsd" or $t->type == "vdsmanagerfreebsdfull" or $t->type == "billmanagerstandart" or $t->type == "billmanageradvanced" or $t->type == "billmanagercorporate" or $t->type == "dsmanager" or $t->type == "dsmanagerfull" or $t->type == "dnsmanagerfull" or $t->type == "ipmanagerfull") {
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderLisenseName].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=licenseName value='$licenseName' size=30></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderLisenseIP].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=licenseIP value='$licenseIP' size=30></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 value='$promocode'></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 ($domain_reg == "3") {
$transfer = 1; $transferTxt = " (".$_lang[DomainTransferMin].")";
} else {
$transfer = 0; $transferTxt = "";
}
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" or $domain_reg == "3") { print "<tr class=order_subtable_tr></td><td> ".$_lang[OrderDomain]." <B>$fulldomain</B>$transferTxt ".$_lang[OrderPrefixNa]." <B>".($domainminsrok/12)." ".$_lang[OrderSokraschenieGod]."</B>";
if ($certOrder) { print " + ".$_lang[OrderCert]; }
if ($privacyOrder) { print " + ".$_lang[OrderPrivacy]; }
if ($localContactOrder) { print " + ".$_lang[OrderLocalContact]; }
print "</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>$transferTxt ".$_lang[OrderPrefixNa]." <B>".($domainMinSrok/12)." ".$_lang[OrderSokraschenieGod]."</B>";
if ($certOrder) { print " + ".$_lang[OrderCert]; }
if ($privacyOrder) { print " + ".$_lang[OrderPrivacy]; }
if ($localContactOrder) { print " + ".$_lang[OrderLocalContact]; }
print "</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>";
if ($certOrder[$v]) { print " + ".$_lang[OrderCert]; }
if ($privacyOrder[$v]) { print " + ".$_lang[OrderPrivacy]; }
if ($localContactOrder[$v]) { print " + ".$_lang[OrderLocalContact]; }
print "</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>"; }
}
print "<tr class=order_subtable_tr></td><td align=right><B>".$_lang[OrderTotal].":</b> </td><td> ".round(($allsumm)*CURK,2)." ".CURS."</td></tr>";
if ($promocode) {
if ($promoTotal > 0) {
print "<tr class=order_subtable_tr></td><td align=right> ".$_lang[OrderSkidkaByPromo].":</td><td> ".round($promoTotal*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>";
}
if (GetSetting("orderShowSSHLogin") and ($vid == "ssh")) {
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderSSHLogin].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=serverLogin value='$serverLogin' size=30></td></tr>";
}
if (GetSetting("orderShowSSHPassword") and ($vid == "ssh")) {
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderSSHPassword].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=serverPassword value='$serverPassword' size=30></td></tr>";
}
if (GetSetting("orderShowPurposeOfUse") and ($vid == "vds" or $vid == "dedicated")) {
print "<tr class=order_table_tr_title><td><code class=warn>*</code> ".$_lang[OrderPurposeOfUse].":</td></tr>";
print "<tr class=order_table_tr><td><input class=input type=text name=purposeofuse value='$purposeofuse' size=30></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 ($needpersonalinfo) {
$needpersonalinfourl = GetSetting("needpersonalinfourl");
$personalinfotxt = $_lang[OrderPrefixS]." <A class=rootlink href=$needpersonalinfourl target=_blank>".$_lang[OrderPersonalInfo2]."</a> ".$_lang[OrderPretenziyNeImeyu];
print "<tr height=3><td></td></tr>";
print "<tr class=order_table_tr_title><td><code class=warn>*</code> $_lang[OrderPersonalInfo]:</td></tr>";
if ($personalinfo) {$personalCheck1="checked";}
print "<tr class=order_table_tr><td><input class=input type=checkbox name=personalinfo $personalCheck1> $personalinfotxt</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])) {
if (!$onclick) {$onclick = "onclick="if (this.form.subm.value == '1') {return false;} else {this.form.subm.value=1;}"";}
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();
?>