Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/_rootbill/_calc.inc.php
Строк: 844
<?
_head('utf-8',$_lang[CalcTitle]);
if ($sub == 'order') {
    if ($domain_reg == '') {$error=$_lang[OrderErrorNoDomainReg]; $sub='';}
    else if ((!$domain or !$zone_id) and !$otherdomain and $domain_reg != "2" and $vid != "vpn") {$error=$_lang[OrderErrorNoDomain]; $sub='';}
    else if (!$tarif_id) {$error=$_lang[OrderErrorNoTarif]; $sub='';}
    else if (!$months[$tarif_id]) {$error=$_lang[OrderErrorNoSrokZakaza]; $sub='';}
    else {
        if ($domain and $zone_id) {
            $zone = GetZoneById($zone_id);
            $domain=strtolower($domain); $fulldomain=strtolower($domain.".".$zone->zone);
        } else {
            $fulldomain=$otherdomain;
        }
        $link = "order.php?vid=$vid&tarif=$tarif_id&domain_reg=$domain_reg&domain=$domain&zone=$zone->zone&otherdomain=$otherdomain";
        if ($fulldomain) { $dom=new domain($fulldomain); }
        if ($domain_reg == "1" and (mb_strlen($domain) < $zone->minWidth or mb_strlen($domain) > $zone->maxWidth)) { $error = $_lang[OrderErrorDomainLength]; $error=str_replace("{minWidth}",$zone->minWidth,$error);$error=str_replace("{maxWidth}",$zone->maxWidth,$error); $sub='';}
        else if ($domain_reg == "1" and !preg_match("/^[a-z0-9]{1}[a-z0-9-]+[a-z0-9]{1}$/u",$domain)) { $error = $_lang[OrderErrorDomainSymbols]; $sub=''; }
        else if ($domain_reg == "1" and !$dom->is_available()) {$error=$_lang[OrderErrorDomainRegistered]; $sub='';}
        else {
            $hostmonths=$months[$tarif_id];
            $addonsCost=0;
            $selectedAddons=$addons[$tarif_id];
            $addonsToSave="";
            $addonsToSaveText="";
            while (list($k,$v) = @each($selectedAddons)) {
                if ($v) {
                    $selectedAddon = GetAddonById($v);
                    if ($addonsToSaveText) {
                        $addonsToSaveText = $addonsToSaveText.", ".$selectedAddon->name;
                    } else {
                        $addonsToSaveText = $selectedAddon->name;
                    }
                    $addonsToSave = $addonsToSave.":x:$selectedAddon->id";
                    #Устанавливаем спец. цену, если она указана для данной доп. услуги и данного пользователя
                    #
                    $addonSpecCost = GetSpecialCost($_SESSION['userId'],"addon",$selectedAddon->id);
                    if ($addonSpecCost) {
                        $addonsCost += $addonSpecCost["cost1"];
                        $addonsCost += $addonSpecCost["cost2"]*$hostmonths;
                    } else {
                        $addonsCost += $selectedAddon->cost_start;
                        $addonsCost += $selectedAddon->cost_monthly*$hostmonths;
                    }
                }
            }
            if (!$addonsToSaveText) { $addonsToSaveText="нет"; }
            # Учитываем скидку на доп. услуги при регистрации клиента с указанием источника имеющего скидку
            #
            if ($aboutusfromid and $addonsCost > 0) {
                $addonsCost=$addonsCost-($addonsCost/100)*GetAboutUsFromDiscount($aboutusfromid,'addon');
            }
            $addonsCost=round($addonsCost,2);
            $t=@mysql_query("select id,cost,cost_setup,name from tarifs where id='$tarif_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
            $t=mysql_fetch_object($t);
            #Устанавливаем спец. цену, если она указана для данного тарифа и данного пользователя
            #
            $tarifSpecCost = GetSpecialCost($_SESSION['userId'],"tarif",$t->id);
            if ($tarifSpecCost) {
                $host_setup = $tarifSpecCost["cost1"];
                $hostcost = $tarifSpecCost["cost2"];
            } else {
                $host_setup = $t->cost_setup;
                $hostcost = $t->cost;
            }
            $tsroki=@mysql_query("select discount from tarifs_sroki where tarif_id='$tarif_id' and months='$hostmonths'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
            if (mysql_num_rows($tsroki) > 0) {
                $tsroki=mysql_fetch_object($tsroki);
                $srokDiscount=$tsroki->discount;
            } else {
                $srokDiscount=0;
            }
            $host=$hostcost*$hostmonths; $host=$host-($host/100)*$srokDiscount+$host_setup;
            # Учитываем скидку на хостинг при регистрации клиента с указанием источника имеющего скидку
            #
            if ($aboutusfromid and $host > 0) {
                $host=$host-($host/100)*GetAboutUsFromDiscount($aboutusfromid,'host');
            }
            $host=round($host,2);
            $dom=0;
            if ($domain_reg == "1") {
                $tzones=@mysql_query("select id,cost_if_host,minsrok from zones where id='$zone_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                $tzones=mysql_fetch_object($tzones);
                #Устанавливаем спец. цену, если она указана для данной доменной зоны и данного пользователя
                #
                $domSpecCost = GetSpecialCost($_SESSION['userId'],"zone",$tzones->id);
                if ($domSpecCost) {
                    $domaincost=$domSpecCost["cost1"];
                } else {
                    $domaincost=$tzones->cost_if_host;
                }
                $domainminsrok=$tzones->minsrok;
                $dom=$domaincost*($domainminsrok/12);
                # Учитываем скидку на домен при регистрации клиента с указанием источника имеющего скидку
                #
                if ($aboutusfromid and $dom > 0) {
                    $dom=$dom-($dom/100)*GetAboutUsFromDiscount($aboutusfromid,'domain');
                }
                $dom=round($dom,2);
                $allsumm = $host+$dom+$addonsCost;
                $domainfree = 0;
                $tfreedomains=@mysql_query("select * from tarifs_freedomains where tarif_id='$tarif_id' and zone='$zone->zone' and hostmonths='$hostmonths'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                if (mysql_num_rows($tfreedomains) > 0) {$domainfree=1;}
                $tfreedomains=@mysql_query("select * from tarifs_freedomains where tarif_id='$tarif_id' and zone='$zone->zone' and ordersum > 0 and ordersum <= $allsumm") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                if (mysql_num_rows($tfreedomains) > 0) {$domainfree=1;}
                if ($domainfree) {$dom=0; $bonus=$_lang[OrderFreeDomainInZone]." $zone->zone<BR>";}
            }
print "
<BR><B>".$_lang[OrderParamsOfOrder].":</b><BR>
".$_lang[OrderTarif].": $t->name<BR>
".$_lang[OrderSrokZakaza].": $hostmonths ".$_lang[OrderSokraschenieMonth].".<BR>
".$_lang[OrderDomain].": $fulldomain [ $_newreg[$domain_reg] ]<BR>
$bonus
".$_lang[OrderAddons].": $addonsToSaveText<BR><BR>
<B>".$_lang[OrderTotal].":</b><BR>
".$_lang[OrderType][hosting].": ".round($host*CURK,2)." ".CURS."<BR>
".$_lang[Domain].": ".round($dom*CURK,2)." ".CURS."<BR>
".$_lang[OrderAddons].": ".round($addonsCost*CURK,2)." ".CURS."<BR><BR>
<B>".$_lang[OrderTotal].":</b> ".round(($host+$dom+$addonsCost)*CURK,2)." ".CURS."<BR><BR>
<a href=$link class=rootlink>".$_lang[CalcGotoOrder]."</a><BR><BR>
".$_lang[CalcNePodhodid]."... <A class=rootlink href=?do=$do&vid=$vid>".$_lang[CalcAgain]."</a>
";
        }
    }
}
if ($sub == 'ordershop') {
    $shop = GetShopItemById($item_id);
    if (!$item_id) {$error=$_lang[OrderErrorNoItem]; $sub='';}
    else if ($shop->costtype != "one" and !$months[$item_id]) {$error=$_lang[OrderErrorNoSrokZakaza]; $sub='';}
    else {
        if ($_SESSION['userId']) {
            $itemSpecCost = GetSpecialCost($_SESSION['userId'],"shop",$shop->id);
            if ($itemSpecCost) {
                $shop->cost = $tarifSpecCost["cost1"];
            }
        }
        $itemmonths = $months[$item_id];
        $itemcost = $shop->cost;
        if ($shop->costtype == "month") {
            $itemcost=$itemcost*$itemmonths;
        } else if ($shop->costtype == "year") {
            $itemcost=$itemcost*($itemmonths/12);
        }
        $itemcost = round($itemcost,2);
        if ($shop->costtype == "month") {$msrok = $itemmonths." ".$_lang[OrderSokraschenieMonth]; }
        else if ($shop->costtype == "year") {$msrok = ($itemmonths/12)." ".$_lang[OrderSokraschenieGod];}
        else { $msrok = $_lang[OrderRazovo]; }
        print "
        <BR><B>".$_lang[OrderParamsOfOrder].":</b><BR>
        ".$_lang[OrderItem].": $shop->name<BR>
        ".$_lang[OrderSrokZakaza].": $msrok<BR><BR>
        <B>".$_lang[OrderTotal].":</b><BR>
        ".$_lang[OrderItem].": ".round($itemcost*CURK,2)." ".CURS."<BR><BR>
        <a href=order.php?type=shop&item=$item_id class=rootlink>".$_lang[CalcGotoOrder]."</a><BR><BR>
        ".$_lang[CalcNePodhodid]."... <A class=rootlink href=?do=$do&vid=$vid>".$_lang[CalcAgain]."</a>
        ";
    }
}
if ($vid and $vid != "shop" and !$sub) {
    if ($error) {print "<font color=red>".$_lang[Error].": $error</font><BR><BR>";}
    if ($vid == "vpn") {$domain_reg='2';}
    if ($domain_reg == '2') {$check3='checked'; $disabled='disabled'; $disabled2='disabled';}
    else if ($domain_reg == '0') {$check1='checked'; $disabled=''; $disabled2='';}
    else if ($domain_reg == '1') {$check2='checked'; $disabled='disabled'; $disabled2='';}
    else {$check2='checked'; $disabled='disabled';}
    if (!($vid == "hosting" or $vid == "reseller" or $vid == "vds" or $vid == "dedicated" or $vid == "vpn")) {$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 = "";
        }
    }
    
    ?>
    <script language=javascript type='text/javascript'>
    function showdiv(divid) {
        <?
        if ($tarif_id) {print "parent.flast='$tarif_id';";}
        ?>
        if (parent.last) {hidediv(parent.last);} else { if (parent.flast) {hidediv(parent.flast);}}
        parent.last=divid;
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById('d'+divid).style.display = 'block';
            document.getElementById('a'+divid).style.display = 'block';
        }
        else {
            if (document.layers) { // Netscape 4
                divid = 'd'+divid; document.divid.display = 'block';
                divid = 'a'+divid; document.divid.display = 'block';
            }
            else { // IE 4
                divid = 'd'+divid; document.all.divid.style.display = 'block';
                divid = 'a'+divid; document.all.divid.style.display = 'block';
            }
        }
    }
    function hidediv(divid) {
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById('d'+divid).style.display = 'none';
            document.getElementById('a'+divid).style.display = 'none';
        }
        else {
            if (document.layers) { // Netscape 4
                divid = 'd'+divid; document.divid.display = 'none';
                divid = 'a'+divid; document.divid.display = 'none';
            }
            else { // IE 4
                divid = 'd'+divid; document.all.divid.style.display = 'none';
                divid = 'a'+divid; document.all.divid.style.display = 'none';
            }
        }
    }
    function showblankdiv(divid) {
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById(divid).style.display = 'block';
        }
        else {
            if (document.layers) { // Netscape 4
                document.divid.display = 'block';
            }
            else { // IE 4
                document.all.divid.style.display = 'block';
            }
        }
    }
    
    function hideblankdiv(divid) {
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById(divid).style.display = 'none';
        }
        else {
            if (document.layers) { // Netscape 4
                document.divid.display = 'none';
            }
            else { // IE 4
                document.all.divid.style.display = 'none';
            }
        }
    }
    </script>
    <form method=post name=order>
    <input type=hidden name=do value=<?=$do?>>
    <input type=hidden name=sub value=order>
    <input type=hidden name=vid value=<?=$vid?>>
    <table class='rpTableBlank' border=1>
    <tr><th colspan=3 align=center><?=$_lang[OrderParamsOfOrder]?>:</th></tr>
    <tr <? if ($vid == "vpn") {print "style='display: none'";} ?>><th align=right valign=top> * <?=$_lang[OrderType][$vid]?>:</th><td colspan="2">
        <? if ($vid == "vds" or $vid == "dedicated" or $vid == "vpn") {?> <input class=input type=radio onclick="javascript: this.form.otherdomain.disabled=1; this.form.domain.disabled=1; this.form.zone_id.disabled=1;" name=domain_reg value="2" <?=$check3?>> <?=$_lang[DomainWithout]?><BR> <?}?>
        <input class=input type=radio onclick="javascript: this.form.otherdomain.disabled=0; this.form.domain.disabled=0; this.form.zone_id.disabled=0;" name=domain_reg value=0 <?=$check1?>> <?=$_lang[DomainExists]?><BR>
        <input class=input type=radio onclick="javascript: this.form.otherdomain.disabled=1; this.form.domain.disabled=0; this.form.zone_id.disabled=0;" name=domain_reg value=1 <?=$check2?>> <?=$_lang[DomainNew]?>
    </td></tr>
    <tr <? if ($vid == "vpn") {print "style='display: none'";} ?>><th align=right>* <?=$_lang[OrderDomain]?>:</th><td><input class=input type="text" name="domain" <?=$disabled2?> value="<?=$domain?>"> <select class=input <?=$disabled2?> name="zone_id"><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)) {
        if ($rr->id == $zone_id) {$addon='selected';} else {$addon='';}
        print "<option value=$rr->id $addon>.$rr->zone</option>";
    }
    ?>
    </select></td></tr>
    <tr <? if ($vid == "vpn") {print "style='display: none'";} ?>><th align=right></th><td><?=$_lang[CalcDomainInOtherZone]?>:<BR><input class=input type="text" name="otherdomain" <?=$disabled?> value="<?=$otherdomain?>" size=30> <?=$_lang[OrderDomainComment]?></td><td></td></tr>
    <tr><th align=right valign=top>* <?=$_lang[OrderTarif]?>:</th><td colspan="2">
    <?
    if ($group) {
        $where = "and tarifsgroup='$group'";
    } else if ($tarif_id and $tarif_group) {
        $where = "and tarifsgroup='$tarif_group'";
    } else if ($tarif_id and !$tarif_group and $one) {
        $where = "and id='$tarif_id'";
    } else {
        $where = "";
    }
    $r=@mysql_query("select * from tarifs where active=1 and vid='$vid' $where order by cost") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
    $tarifs_cnt = mysql_num_rows($r);
    while ($rr = mysql_fetch_object($r)) {
        if ($rr->id == $tarif_id or $tarif == $rr->name or $tarifs_cnt == 1) {$addon='checked'; $tarif_id=$rr->id;} else {$addon='';}
        if ($rr->cost_setup) {$addon_cost=" + ".round($rr->cost_setup*CURK,2)." ".CURS." ".$_lang[OrderRazovoZaUstanovku];} else {$addon_cost="";}
        print "<input class=input type=radio name=tarif_id value=$rr->id $addon onclick='showdiv(this.value);'> $rr->name (".round($rr->cost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth].$addon_cost.")<BR>";
    }
    ?>
    </select></td></tr>
    <tr><th align=right>* <?=$_lang[RenewNaSrok]?>:</th><td colspan="2">
    <?
    $r=@mysql_query("select * from tarifs_sroki order by tarif_id,months");
    while ($rr = mysql_fetch_object($r)) {
        if ($rr->tarif_id == $tarif_id) {$style="style='display: block;'";} else {$style="style='display: none;'";}
        if (!$last_tarif_id) {print "<div id=d$rr->tarif_id $style><select class=input name=months[$rr->tarif_id]><option></option>";}
        else if ($last_tarif_id != $rr->tarif_id) {print "</select></div><div id=d$rr->tarif_id $style><select class=input name=months[$rr->tarif_id]><option></option>";}
        if ($months[$rr->tarif_id] == $rr->months) {$addon='selected';} else {$addon='';}
        if ($rr->discount) {$skidka=" (".$_lang[OrderDiscountSmall]." $rr->discount%)";} else {$skidka="";}
        print "<option value=$rr->months $addon>$rr->months ".$_lang[OrderSokraschenieMonth]."$skidka</option>";
        $last_tarif_id=$rr->tarif_id;
    }
    print "</select></div>";
    ?>
    </td></tr>
    <tr><th align=right valign=top><?=$_lang[OrderAddons]?>:</th><td colspan="2">
    <?
    $r=@mysql_query("select * from tarifs where active=1 and vid='$vid' order by cost");
    while ($rr = mysql_fetch_object($r)) {
        $addonsForTarif=split(":x:",$rr->addons);
        if ($rr->id == $tarif_id) {$style="style='display: block;'";} else {$style="style='display: none;'";}
        print "<div id=a$rr->id $style>";
        $cntAddons=0;
        while (list($k,$v) = @each($addonsForTarif)) {
            if ($v) {
                $oneAddon = GetAddonById($v);
                if ($oneAddon->active) {
                    $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]; }
                    print "<input class=input type=checkbox name=addons[$rr->id][] value=$oneAddon->id>$oneAddon->name ($addonMoney)<BR>";
                    $cntAddons++;
                }
            }
        }
        if (!$cntAddons) { print $_lang[No]; }
        print "</div>";
    }
    print "</div>";
    ?>
    </td></tr>
    <tr><th> </th><td colspan="2" align="center"><input class=button type="submit" name="Submit" value="<?=$_lang[CalcCalc]?>"></td></tr>
    </table>
    </form>
    <br>* - <?=$_lang[Required]?>
    <?
}
if ($vid == "shop" and !$sub) {
    if ($error) {print "<font color=red>".$_lang[Error].": $error</font><BR><BR>";}
    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->tarifsgroup;
        } else {
            $item = "";
        }
    }
    
    ?>
    <script language=javascript type='text/javascript'>
    function showdiv(divid) {
        <?
        if ($item_id) {print "parent.flast='$item_id';";}
        ?>
        if (parent.last) {hidediv(parent.last);} else { if (parent.flast) {hidediv(parent.flast);}}
        parent.last=divid;
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById('d'+divid).style.display = 'block';
        }
        else {
            if (document.layers) { // Netscape 4
                divid = 'd'+divid; document.divid.display = 'block';
            }
            else { // IE 4
                divid = 'd'+divid; document.all.divid.style.display = 'block';
            }
        }
    }
    function hidediv(divid) {
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById('d'+divid).style.display = 'none';
        }
        else {
            if (document.layers) { // Netscape 4
                divid = 'd'+divid; document.divid.display = 'none';
            }
            else { // IE 4
                divid = 'd'+divid; document.all.divid.style.display = 'none';
            }
        }
    }
    function showblankdiv(divid) {
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById(divid).style.display = 'block';
        }
        else {
            if (document.layers) { // Netscape 4
                document.divid.display = 'block';
            }
            else { // IE 4
                document.all.divid.style.display = 'block';
            }
        }
    }
    
    function hideblankdiv(divid) {
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById(divid).style.display = 'none';
        }
        else {
            if (document.layers) { // Netscape 4
                document.divid.display = 'none';
            }
            else { // IE 4
                document.all.divid.style.display = 'none';
            }
        }
    }
    </script>
    <form method=post name=order>
    <input type=hidden name=do value=<?=$do?>>
    <input type=hidden name=sub value=ordershop>
    <input type=hidden name=vid value=<?=$vid?>>
    <table class='rpTableBlank' border=1>
    <tr><th colspan=3><?=$_lang[OrderParamsOfOrder]?>:</th></tr>
    <tr><th align=right valign=top>* <?=$_lang[OrderItem]?>:</th><td colspan="2">
    <?
    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 class=input type=radio name=item_id value=$rr->id $addon onclick='showdiv(this.value);'> $rr->name (".$itemCostTxt.") $description<BR>";
    }
    ?>
    </select></td></tr>
    <tr><th align=right>* <?=$_lang[RenewNaSrok]?>:</th><td colspan="2">
    <?
    $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());
    while ($rr = mysql_fetch_object($r)) {
        if ($rr->id == $item_id) {$style="style='display: block;'";} else {$style="style='display: none;'";}
        print "<div id=d$rr->id $style>";
        if ($rr->costtype == "one") {
            print $_lang[OrderRazovo];
        } else {
            print "<select class=input name=months[$rr->id]><option></option>";
            $m = $rr->minsrok;
            while ($m <= $rr->maxsrok) {
                if ($rr->costtype == "month") {$msrok = $m." ".$_lang[OrderSokraschenieMonth]; }
                else if ($rr->costtype == "year") {$msrok = ($m/12)." ".$_lang[OrderSokraschenieGod];}
                if ($months[$rr->id] == $m) {$addon='selected';} else {$addon='';}
                print "<option value=$m $addon> $msrok</option>";
                if ($rr->costtype == "month") {$m = $m+1;}
                else if ($rr->costtype == "year") {$m = $m+12;}
            }
            print "</select>";
        }
        print "</div>";
    }
    print "</select></div>";
    ?>
    </td></tr>
    <tr><th> </th><td colspan="2" align="center"><input class=button type="submit" name="Submit" value="<?=$_lang[CalcCalc]?>"></td></tr>
    </table>
    </form>
    <br>* - <?=$_lang[Required]?>
    <?
}
if (!$sub and !$vid) {
    $weSalesTypes = GetSetting("weSalesTypes");
    $weSalesTypes = @split("::",$weSalesTypes);
    print "<B>".$_lang[CalcSelect].":</B> <BR><BR>";
    print "<form method=post>";
    print "<input type=hidden name=do value='".$do."'>";
    if (@in_array("hosting",$weSalesTypes)) { $resPrint .= "<input class=input type=radio name=vid value=hosting> ".$_lang[OrderType]["hosting"]."<BR>";}
    if (@in_array("reseller",$weSalesTypes)) { $resPrint .= "<input class=input type=radio name=vid value=reseller> ".$_lang[OrderType]["reseller"]."<BR>";}
    if (@in_array("vds",$weSalesTypes)) { $resPrint .= "<input class=input type=radio name=vid value=vds> ".$_lang[OrderType]["vds"]."<BR>";}
    if (@in_array("dedicated",$weSalesTypes)) { $resPrint .= "<input class=input type=radio name=vid value=dedicated> ".$_lang[OrderType]["dedicated"]."<BR>";}
    if (@in_array("vpn",$weSalesTypes)) { $resPrint .= "<input class=input type=radio name=vid value=vpn> ".$_lang[OrderType]["vpn"]."<BR>";}
    if (@in_array("shop",$weSalesTypes)) { $resPrint .= "<input class=input type=radio name=vid value=shop> ".$_lang[OrderItem]."<BR>";}
    print $resPrint;
    print "<BR><input type=submit class=input value='".$_lang[Next]."'></form>";
}
_foot('utf-8');
?>