Файл: _rootadmin/_zones.inc.php
Строк: 2040
<?
        if (!$sub) {$sub='list';}
    if ($sub == "groups" or $sub == "addgroup" or $sub == "editgroup" or $sub == "addgroup2" or $sub == "editgroup2" or $sub == "deletegroup" or $sub == "movegroup") {
        if ($sub == "movegroup" and $id and $to) {
            checkAdminAccess('sZonesGroupEdit',1);
            if ($to == "up") {
                @mysql_query("update zones_groups set sort=sort-1 where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
            }
            if ($to == "down") {
                @mysql_query("update zones_groups set sort=sort+1 where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
            }
            print "Группа доменных зон успешно перемещена.<BR><BR>";
        }
        if ($sub == "deletegroup") {
            checkAdminAccess('sZonesGroupDelete',1);
            if ($id) {
                $r = GetZonesGroupById($id);
                if ($r->id) {
                    @mysql_query("delete from zones_groups where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                    @mysql_query("update zones set `group`='0' where `group`='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                    writeAdminLog("Удалена группа доменных зон ID # $id, $r->name");
                    print "Группа доменных зон успешно удалена.";
                } else {
                    print "Группа доменных зон не найдена.";
                }
            }
            else {
                print "Утерян идентификатор группы доменных зон.";
            }
            print "<BR><BR>";
        }
        if ($sub == "addgroup2" or $sub == "editgroup2") {
                    if (!$name) {print "Не указано название группы доменных зон.";}
                    else {
                            if ($sub == 'addgroup2') {
                    checkAdminAccess('sZonesGroupCreate',1);
                                    $r=@mysql_query("select * from zones_groups where name='$name'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                                    if (mysql_num_rows($r) > 0) {print "Группа доменных зон <B>$name</b> уже присутствует в базе.";}
                                    else {
                                            @mysql_query("insert into zones_groups (name,description) values('$name','$description')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                        $newid=mysql_insert_id();
                        writeAdminLog("Добавлена группа доменных зон ID # $newid, $name");
                                            print "Группа доменных зон <B>$name</b> успешно добавлена в базу.";
                                    }
                    $name = "";
                            }
                            else if ($sub == 'editgroup2') {
                    checkAdminAccess('sZonesGroupEdit',1);
                                    if ($id) {
                                            @mysql_query("update zones_groups set name='$name',description='$description' where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                        writeAdminLog("Изменена группа доменных зон ID # $id, $name");
                                            print "Группа доменных зон <B>$name</b> успешно изменена."; 
                                    }
                                    else {
                                            print "Утерян идентификатор группы доменных зон.";
                                    }
                    $name=""; $id="";
                            }
            }
            print "<BR><BR>";
                }
        checkAdminAccess('sZonesGroupRead',1);
                $r=GetZonesGroups();
                ?>
                <table cellpadding=3 width=95%>
                <tr><td colspan=5 align=center bgcolor=<? print $font_head?>><B>Группы доменных зон</b></td></tr>
                <tr bgcolor=<? print $font_head?>><td align=center>ID</td><td align=center>Название</td><td align=center>Ссылка</td><td align=center>Сортировка</td><td align=center></td></tr>
                <?
                $cnt=0;
                while ($rr = @mysql_fetch_object($r)) {
                        getfont();
                        print "
                        <tr bgcolor=$font_row>
                        <td width=30 align=center>$rr->id</td>
                        <td>$rr->name</td>
                        <Td>order.php?type=d&group=$rr->id</td>
            <td align=center><a href=?do=$do&sub=movegroup&id=$rr->id&to=up><img src="./_rootimages/s_asc.png" border=0 alt="Поднять вверх" ></a> <a href=?do=$do&sub=movegroup&id=$rr->id&to=down><img src="./_rootimages/s_desc.png" border=0 alt="Опустить вниз"></a></td>
            <td width=100 align=center><A href=?do=$do&sub=editgroup&id=$rr->id><img src=./_rootimages/edit.gif alt=Изменить border=0></a><A href=?do=$do&sub=deletegroup&id=$rr->id onclick="javascript: return confirm('Вы уверены, что хотите удалить группу доменных зон?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td>
                        </tr>
                        ";
                        $cnt++;
                }
                ?>
                <tr bgcolor=<? print $font_head?>><Td colspan=5>Всего групп доменных зон: <? print $cnt?></td></tr>
                </table>
                <?
        if ($sub == 'editgroup') {
            $r=GetZonesGroupById($id);
            $id=$r->id;
            $name=$r->name;
            $description=$r->description;
                            
            $sub = "editgroup";
            $txt = "Изменение";
            $button = 'Изменить';
        } else {
            $sub = "addgroup";
            $txt = "Добавление";
            $button = 'Добавить';                    
        }
        ?><BR>
        <form method=post>
        <input type=hidden name=do value="<? print $do?>">
        <input type=hidden name=sub value="<? print $sub?>2">
        <input type=hidden name=id value="<? print $id?>">
        <table>
        <tr><td colspan=4 align=center bgcolor=#EAEAEA><B><? print $txt?> группы доменных зон</b></td></tr>
        <tr><td>Название:</td><td><input type=text size=30 name=name value="<? print $name?>"></td><td></td><Td><input type=submit value=<? print $button?>></td></tr>
                <tr><td valign=top>Описание группы:</td><td><textarea name=description cols=40 rows=5><? print $description?></textarea></td></tr>
        </table>
        </form>
        <?
    }
    if ($sub == "domainCostType") {
        if ($act == "save") {
            checkAdminAccess('sZonesCostTypeEdit',1);
            SetSetting("domainCostType",$domainCostType);
            writeAdminLog("Изменены настройки: Доменные зоны / Тип цены");
            print "Данные успешно сохранены.<BR><BR>";
        }
        checkAdminAccess('sZonesCostTypeRead',1);
        $domainCostType = GetSetting("domainCostType");
        ?>
        <form method=post>
        <input type=hidden name=do value=<? print $do?>>
        <input type=hidden name=sub value=<? print $sub?>>
        <input type=hidden name=act value=save>
        <table width=400>
        <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Настройка системы цен на регистрацию доменов</b></td></tr>
        <tr><td colspan=2><BR><input type=radio name=domainCostType value=0 <? if (!$domainCostType) { print "checked"; } ?>> <B>Система цен №1</b><BR>      Возможность установить 2 цены:<BR>      1. Цена при заказе только домена<BR>      2. Цена при заказе домена вместе с хостингом</td></tr>
        <tr><td colspan=2><BR><input type=radio name=domainCostType value=1 <? if ($domainCostType) { print "checked"; } ?>> <B>Система цен №2</b><BR>      Возможность установить 2 цены:<BR>      1. Цена, если клиент не пользуется услугами хостинга<BR>      2. Цена, если клиент пользуется услугами хостинга либо заказывает хостинг вместе с доменом</td></tr>
        <tr><Td colspan=2 align=center><BR><input type=submit value=Сохранить></td></tr>
        </table>
        </form>
        <?
    
    }
    if ($sub == "cert") {
        if ($act == "save") {
            checkAdminAccess('sZonesCertEdit',1);
            SetSetting("sertificateEnable",$sertificateEnable);
            SetSetting("sertificateCost",$sertificateCost);
            writeAdminLog("Изменены настройки: Доменные зоны / Сертификаты");
            print "Данные успешно сохранены.<BR><BR>";
        }
        checkAdminAccess('sZonesCertRead',1);
        $sertificateEnable = GetSetting("sertificateEnable");
        $sertificateCost = GetSetting("sertificateCost");
        ?>
        <form method=post>
        <input type=hidden name=do value=<? print $do?>>
        <input type=hidden name=sub value=<? print $sub?>>
        <input type=hidden name=act value=save>
        <table width=400>
        <tr><td align=center bgcolor=#EAEAEA><B>Сертификаты для доменных имён</b></td></tr>
        <tr><td align=center><BR><input type=radio name=sertificateEnable onclick="this.form.sertificateCost.readOnly=true" value=0 <? if (!$sertificateEnable) { print "checked"; } ?>> выключено <input type=radio name=sertificateEnable onclick="this.form.sertificateCost.readOnly=false" value=1 <? if ($sertificateEnable) { print "checked"; } ?>> включено</td></tr>
        <tr><td align=center><BR>Цена, <? print CURAS?>: <input type=text name=sertificateCost <? if (!$sertificateEnable) {print "readOnly=true";} ?> value="<? print $sertificateCost?>" size=4></td></tr>
        <tr><Td align=center><BR><input type=submit value=Сохранить></td></tr>
        <tr><td><BR>* данная функция позволяет клиенту при заказе домена заказать сертификат для него.</td></tr>
        </table>
        </form>
        <?
    
    }
        if ($sub == 'addbytpl2') {
        checkAdminAccess('sZonesCreate',1);
        $sub = "addbytpl";
                if (!$zone) {print "Не указана доменная зона.";}
                else if (preg_match("/^./ui",$zone)) {print "Доменная зона не должна начинаться с точки.";}
                else if (!$tplid) {print "Не указана доменная зона, используемая в качестве шаблона.";}
                else {
            $tplZone = GetZoneById($tplid);
            if (!$tplZone->id) {print "Доменная зона, указанная в качестве шаблона, не найдена.";}
            else {
                $zone = mb_strtolower($zone);
                                $r=@mysql_query("select * from zones where zone='$zone' and autoreg='$tplZone->autoreg'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                                if (mysql_num_rows($r) > 0) {print "Доменная зона <B>$zone</b> с таким регистратором уже присутствует в базе.";}
                                else {
                                       $domain=new domain("test.".$zone);
                    $whois = $domain->get_whois_server();
                    $notfoundstring = $domain->get_notfound_string();
                    if ($tplZone->isDefault) {
                        @mysql_query("update zones set isDefault=0 where zone='$zone'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                    }
                                        @mysql_query("insert into zones (zone,`group`,transferCost,transferCostCurrency,cost_if_host,cost_if_not_host,cost_if_reseller,cost_if_domainreseller,renew_if_host,renew_if_not_host,renew_if_reseller,renew_if_domainreseller,cost_if_hostCurrency,cost_if_not_hostCurrency,cost_if_resellerCurrency,cost_if_domainresellerCurrency,renew_if_hostCurrency,renew_if_not_hostCurrency,renew_if_resellerCurrency,renew_if_domainresellerCurrency,minsrok,minsrok_renew,active,comment,whois,notfoundstring,useinwhois,autoreg,isDefault,isFavorite,minWidth,maxWidth,enableDefaultNS,defaultNS1,defaultNS2,defaultNS3,defaultNS4,enableCreateZone,createZoneScript,createZoneScriptReply,enableCheckNS,checkNSScript,checkNSScriptReply,promo,createZoneServer,createZoneServerLogin,free,daysRenew,description,registratorId,privacy,privacy_cost,privacy_payafterdisable,idn,warning,licenseRequired,privacy_required,transferAllow,transferNeedAuth,transferRenew,localContact,localContact_cost) values('$zone','$tplZone->group','$tplZone->transferCost','$tplZone->transferCostCurrency','$tplZone->cost_if_host','$tplZone->cost_if_not_host','$tplZone->cost_if_reseller','$tplZone->cost_if_domainreseller','$tplZone->renew_if_host','$tplZone->renew_if_not_host','$tplZone->renew_if_reseller','$tplZone->renew_if_domainreseller','$tplZone->cost_if_hostCurrency','$tplZone->cost_if_not_hostCurrency','$tplZone->cost_if_resellerCurrency','$tplZone->cost_if_domainresellerCurrency','$tplZone->renew_if_hostCurrency','$tplZone->renew_if_not_hostCurrency','$tplZone->renew_if_resellerCurrency','$tplZone->renew_if_domainresellerCurrency','$tplZone->minsrok','$tplZone->minsrok_renew','$tplZone->active','$tplZone->comment','$whois','$notfoundstring','$tplZone->useinwhois','$tplZone->autoreg','$tplZone->isDefault','$tplZone->isFavorite','$tplZone->minWidth','$tplZone->maxWidth','$tplZone->enableDefaultNS','$tplZone->defaultNS1','$tplZone->defaultNS2','$tplZone->defaultNS3','$tplZone->defaultNS4','$tplZone->enableCreateZone','$tplZone->createZoneScript','$tplZone->createZoneScriptReply','$tplZone->enableCheckNS','$tplZone->checkNSScript','$tplZone->checkNSScriptReply','$tplZone->promo','$tplZone->createZoneServer','$tplZone->createZoneServerLogin','$tplZone->free','$tplZone->daysRenew','$tplZone->description','$tplZone->registratorId','$tplZone->privacy','$tplZone->privacy_cost','$tplZone->privacy_payafterdisable','$tplZone->idn','$tplZone->warning','$tplZone->licenseRequired','$tplZone->privacy_required','$tplZone->transferAllow','$tplZone->transferNeedAuth','$tplZone->transferRenew','$tplZone->localContact','$tplZone->localContact_cost')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                    $id=mysql_insert_id();
                    writeAdminLog("Добавлена доменная зона ID # $id, $zone");
                                        print "Доменная зона <B>$zone</b> успешно добавлена.<BR>При необходимости можно указать WHOIS-сервер и строку Not Found в настройках зоны.";
                                        $sub='edit';
                                }
            }
                }
        print "<BR><BR>";
        }
        if ($sub == 'addbytpl') {
        checkAdminAccess('sZonesCreate',1);
                $button='Добавить';
                $title='Добавление';
                ?>
                <form method=post>
                <input type=hidden name=do value=<? print $do?>>
                <input type=hidden name=sub value=<? print $sub?>2>
                <table>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B><? print $title?> доменной зоны</b></td></tr>
                <tr bgcolor=<? print $font_row1?>><td width=300>Доменная зона:</td><td><input type=text size=15 name=zone value=<? print $zone?> <? print $readonly?>> без точки в начале (ru, net.ru, com)</td></tr>
                <tr><td>Шаблон:<img src="./_rootimages/question.gif" alt="Доменная зона будет создана с использованием настроек той доменной зоны, которая указана в качестве шаблона."></td><td colspan=2><select name=tplid><option></option>
        <?
        $zones = @mysql_query("select * from zones order by `group`,zone") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
        while ($zone = mysql_fetch_object($zones)) {
            if ($zone->group) { $zoneGroup = GetZonesGroupById($zone->group); $zoneGroup = $zoneGroup->name." / "; } else { $zoneGroup = ""; }
            if ($zone->autoreg) { $zoneRegistrator = GetRegistratorById($zone->autoreg); $zoneRegistrator = " [$zoneRegistrator->name]";} else { $zoneRegistrator = ""; }
            
            if ($tplid == $zone->id) { $selected = "selected"; } else { $selected = ""; }
            print "<option $selected value=$zone->id>$zoneGroup$zone->zone$zoneRegistrator</option>";
        }
        ?>
        </select></td></tr>
                <tr><Td colspan=2 align=center><BR><input type=submit value=<? print $button?>></td></tr>
                </table>
                </form>
                <?
        }
        if ($sub == 'add2' or $sub == 'edit2') {
                if ($sub == 'add2') {$sub2='add'; checkAdminAccess('sZonesCreate',1);}
                if ($sub == 'edit2') {$sub2='edit'; checkAdminAccess('sZonesEdit',1);}
                if (!$zone) {print "Не указана доменная зона.";}
                else if (preg_match("/^./ui",$zone)) {print "Доменная зона не должна начинаться с точки.";}
                else if ($minsrok != 12 and $minsrok != 24 and $minsrok != 36 and $minsrok != 48 and $minsrok != 60 and $minsrok != 72 and $minsrok != 84 and $minsrok != 96 and $minsrok != 108 and $minsrok != 120) {print "Минимальный срок регистрации должен составлять 12, 24, 36, 48, 60, 72, 84, 96, 108 или 120 месяцев.";}
                else if ($minsrok_renew != 12 and $minsrok_renew != 24 and $minsrok_renew != 36 and $minsrok_renew != 48 and $minsrok_renew != 60 and $minsrok_renew != 72 and $minsrok_renew != 84 and $minsrok_renew != 96 and $minsrok_renew != 108 and $minsrok_renew != 120) {print "Минимальный срок продления должен составлять 12, 24, 36, 48, 60, 72, 84, 96, 108 или 120 месяцев.";}
                else if ($minWidth <= 1) {print "Минимальная длина домена не может быть меньше 2-х символов.";}
                else if ($maxWidth <= 0) {print "Не указана максимальная длина домена.";}
                else if ($cost_if_not_host == '') {print "Не указана цена регистрации.";}
                else if ($cost_if_not_hostCurrency == '') {print "Не указана валюта для цены регистрации.";}
                else if ($cost_if_host == '') {print "Не указана цена регистрации при покупке хостинга.";}
                else if ($cost_if_hostCurrency == '') {print "Не указана валюта для цены регистрации при покупке хостинга.";}
                else if ($cost_if_reseller == '') {print "Не указана цена регистрации для реселлеров хостинга.";}
                else if ($cost_if_resellerCurrency == '') {print "Не указана валюта для цены регистрации для реселлеров хостинга.";}
                else if ($cost_if_domainreseller == '') {print "Не указана цена регистрации для реселлеров доменов.";}
                else if ($cost_if_domainresellerCurrency == '') {print "Не указана валюта для цены регистрации для реселлеров доменов.";}
                else if ($renew_if_not_host == '') {print "Не указана цена продления.";}
                else if ($renew_if_not_hostCurrency == '') {print "Не указана валюта для цены продления.";}
                else if ($renew_if_host == '') {print "Не указана цена продления при продлении хостинга.";}
                else if ($renew_if_hostCurrency == '') {print "Не указана валюта для цены продления при продлении хостинга.";}
                else if ($renew_if_reseller == '') {print "Не указана цена продления для реселлеров хостинга.";}
                else if ($renew_if_resellerCurrency == '') {print "Не указана валюта для цены продления для реселлеров хостинга.";}
                else if ($renew_if_domainreseller == '') {print "Не указана цена продления для реселлеров домена.";}
                else if ($renew_if_domainresellerCurrency == '') {print "Не указана валюта для цены продления для реселлеров домена.";}
        else if ($enableDefaultNS and !$defaultNS1) {print "Не указан NS1 в DNS-серверах по умолчанию.";}
        else if ($enableDefaultNS and !$defaultNS2) {print "Не указан NS2 в DNS-серверах по умолчанию.";}
        else if ($enableDefaultNS and $enableCreateZone == "1" and !$createZoneScript) {print "Не указана команда для прописки DNS-зоны.";}
        else if ($enableDefaultNS and $enableCreateZone == "2" and !$createZoneServer) {print "Не указан сервер для прописки DNS-зоны.";}
        else if ($enableDefaultNS and $enableCreateZone == "2" and !$createZoneServerLogin) {print "Не указан аккаунт/домен на сервере для прописки DNS-зоны.";}
        else if ($enableCheckNS and !$checkNSScript) {print "Не указана команда для проверки DNS-серверов.";}
                else {
            $zone = mb_strtolower($zone);
                        if ($sub == 'add2') {
                                $r=@mysql_query("select * from zones where zone='$zone' and autoreg='$autoreg'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                                if (mysql_num_rows($r) > 0) {print "Доменная зона <B>$zone</b> с таким регистратором уже присутствует в базе.";}
                                else {
                                       $domain=new domain("test.".$zone);
                    $whois = $domain->get_whois_server();
                    $notFoundString = $domain->get_notfound_string();
                    if ($isDefault) {
                        @mysql_query("update zones set isDefault=0 where zone='$zone'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                    }
                                        @mysql_query("insert into zones (zone,`group`,transferCost,transferCostCurrency,cost_if_host,cost_if_not_host,cost_if_reseller,cost_if_domainreseller,renew_if_host,renew_if_not_host,renew_if_reseller,renew_if_domainreseller,cost_if_hostCurrency,cost_if_not_hostCurrency,cost_if_resellerCurrency,cost_if_domainresellerCurrency,renew_if_hostCurrency,renew_if_not_hostCurrency,renew_if_resellerCurrency,renew_if_domainresellerCurrency,minsrok,minsrok_renew,active,comment,whois,notfoundstring,useinwhois,autoreg,isDefault,isFavorite,minWidth,maxWidth,enableDefaultNS,defaultNS1,defaultNS2,defaultNS3,defaultNS4,enableCreateZone,createZoneScript,createZoneScriptReply,enableCheckNS,checkNSScript,checkNSScriptReply,promo,createZoneServer,createZoneServerLogin,free,daysRenew,description,registratorId,privacy,privacy_cost,privacy_payafterdisable,idn,warning,licenseRequired,privacy_required,transferAllow,transferNeedAuth,transferRenew,localContact,localContact_cost) values('$zone','$group','$transferCost','$transferCostCurrency','$cost_if_host','$cost_if_not_host','$cost_if_reseller','$cost_if_domainreseller','$renew_if_host','$renew_if_not_host','$renew_if_reseller','$renew_if_domainreseller','$cost_if_hostCurrency','$cost_if_not_hostCurrency','$cost_if_resellerCurrency','$cost_if_domainresellerCurrency','$renew_if_hostCurrency','$renew_if_not_hostCurrency','$renew_if_resellerCurrency','$renew_if_domainresellerCurrency','$minsrok','$minsrok_renew','$active','$comment','$whois','$notFoundString','$useInWhois','$autoreg','$isDefault','$isFavorite','$minWidth','$maxWidth','$enableDefaultNS','$defaultNS1','$defaultNS2','$defaultNS3','$defaultNS4','$enableCreateZone','$createZoneScript','$createZoneScriptReply','$enableCheckNS','$checkNSScript','$checkNSScriptReply','$promo','$createZoneServer','$createZoneServerLogin','$free','$daysRenew','$description','$registratorId','$privacy','$privacy_cost','$privacy_payafterdisable','$idn','$warning','$licenseRequired','$privacy_required','$transferAllow','$transferNeedAuth','$transferRenew','$localContact','$localContact_cost')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                    $newid=mysql_insert_id();
                    writeAdminLog("Добавлена доменная зона ID # $newid, $zone");
                                        print "Доменная зона <B>$zone</b> успешно добавлена.<BR>При необходимости можно указать WHOIS-сервер и строку Not Found в настройках зоны.";
                                        $sub2='list';
                                }
                        }
                        else if ($sub == 'edit2') {
                                if ($id) {
                                    $r=@mysql_query("select * from zones where zone='$zone' and autoreg='$autoreg' and NOT(id='$id')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                                    if (mysql_num_rows($r) > 0) {print "Доменная зона <B>$zone</b> с таким регистратором уже присутствует в базе.";}
                                    else {
                        if ($isDefault) {
                            @mysql_query("update zones set isDefault=0 where zone='$zone'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                        }
                                            @mysql_query("update zones set `group`='$group',transferCost='$transferCost',transferCostCurrency='$transferCostCurrency',cost_if_host='$cost_if_host',cost_if_not_host='$cost_if_not_host',cost_if_reseller='$cost_if_reseller',cost_if_domainreseller='$cost_if_domainreseller',renew_if_host='$renew_if_host',renew_if_not_host='$renew_if_not_host',renew_if_reseller='$renew_if_reseller',renew_if_domainreseller='$renew_if_domainreseller',cost_if_hostCurrency='$cost_if_hostCurrency',cost_if_not_hostCurrency='$cost_if_not_hostCurrency',cost_if_resellerCurrency='$cost_if_resellerCurrency',cost_if_domainresellerCurrency='$cost_if_domainresellerCurrency',renew_if_hostCurrency='$renew_if_hostCurrency',renew_if_not_hostCurrency='$renew_if_not_hostCurrency',renew_if_resellerCurrency='$renew_if_resellerCurrency',renew_if_domainresellerCurrency='$renew_if_domainresellerCurrency',minsrok='$minsrok',minsrok_renew='$minsrok_renew',active='$active',comment='$comment',whois='$whois',notfoundstring='$notFoundString',useinwhois='$useInWhois',autoreg='$autoreg',isDefault='$isDefault',isFavorite='$isFavorite',minWidth='$minWidth',maxWidth='$maxWidth',enableDefaultNS='$enableDefaultNS',defaultNS1='$defaultNS1',defaultNS2='$defaultNS2',defaultNS3='$defaultNS3',defaultNS4='$defaultNS4',enableCreateZone='$enableCreateZone',createZoneScript='$createZoneScript',createZoneScriptReply='$createZoneScriptReply',enableCheckNS='$enableCheckNS',checkNSScript='$checkNSScript',checkNSScriptReply='$checkNSScriptReply',promo='$promo',createZoneServer='$createZoneServer',createZoneServerLogin='$createZoneServerLogin',free='$free',daysRenew='$daysRenew',description='$description',registratorId='$registratorId',privacy='$privacy',privacy_cost='$privacy_cost',privacy_payafterdisable='$privacy_payafterdisable',idn='$idn',warning='$warning',licenseRequired='$licenseRequired',privacy_required='$privacy_required',transferAllow='$transferAllow',transferNeedAuth='$transferNeedAuth',transferRenew='$transferRenew',localContact='$localContact',localContact_cost='$localContact_cost' where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                        writeAdminLog("Изменена доменная зона ID # $id, $zone");
                                            print "Доменная зона <B>$zone</b> успешно изменена.";
                                            $sub2='list';
                    }
                                }
                                else {
                                        print "Утерян идентификатор зоны.";
                                        $sub2='list';
                                }
                        }
                }
                if ($sub2) {print "<BR><BR>";$sub=$sub2;}
                else {$sub='';}
        }
        if ($sub == 'delete') {
        checkAdminAccess('sZonesDelete',1);
                if ($id) {
                        if (IsZoneInUse($id)) {print "Вы не можете удалить доменную зону <B>$zone</b>, т.к. она используется в заказах. Вы можете сделать зону не активной."; }
                        else {
                                @mysql_query("delete from zones where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                writeAdminLog("Удалена доменная зона ID # $id, $zone");
                                print "Доменна зона <B>$zone</b> успешно удалена.";
                        }
                }
                else {print "Утерян идентификатор.";}
                print "<BR><BR>";
                $sub = "list";
        }
        if ($sub == 'add' or $sub == 'edit') {
        if ($sub == 'add') {checkAdminAccess('sZonesCreate',1);}
        if ($sub == 'edit') {checkAdminAccess('sZonesRead',1);}
                $button='Добавить';
                $title='Добавление';
                if ($sub == 'edit') {
                        $r=@mysql_query("select * from zones where id=$id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                        $r=mysql_fetch_object($r);
                        $zone=$r->zone;
            $group=$r->group;
            $transferCost=$r->transferCost;
            $transferCostCurrency=$r->transferCostCurrency;
                        $cost_if_host=$r->cost_if_host;
                        $cost_if_not_host=$r->cost_if_not_host;
            $cost_if_reseller=$r->cost_if_reseller;
            $cost_if_domainreseller=$r->cost_if_domainreseller;
                        $renew_if_host=$r->renew_if_host;
                        $renew_if_not_host=$r->renew_if_not_host;
            $renew_if_reseller=$r->renew_if_reseller;
            $renew_if_domainreseller=$r->renew_if_domainreseller;
                        $cost_if_hostCurrency=$r->cost_if_hostCurrency;
                        $cost_if_not_hostCurrency=$r->cost_if_not_hostCurrency;
            $cost_if_resellerCurrency=$r->cost_if_resellerCurrency;
            $cost_if_domainresellerCurrency=$r->cost_if_domainresellerCurrency;
                        $renew_if_hostCurrency=$r->renew_if_hostCurrency;
                        $renew_if_not_hostCurrency=$r->renew_if_not_hostCurrency;
            $renew_if_resellerCurrency=$r->renew_if_resellerCurrency;
            $renew_if_domainresellerCurrency=$r->renew_if_domainresellerCurrency;
                        $minsrok=$r->minsrok;
                        $minsrok_renew=$r->minsrok_renew;
                        $isDefault=$r->isDefault;
                        $active=$r->active;
                        $comment=$r->comment;
                        $whois=$r->whois;
                        $notFoundString=$r->notfoundstring;
                        $useInWhois=$r->useinwhois;
            $autoreg=$r->autoreg;
            $isFavorite=$r->isFavorite;
            $minWidth=$r->minWidth;
            $maxWidth=$r->maxWidth;
            $enableDefaultNS=$r->enableDefaultNS;
            $defaultNS1=$r->defaultNS1;
            $defaultNS2=$r->defaultNS2;
            $defaultNS3=$r->defaultNS3;
            $defaultNS4=$r->defaultNS4;
            $enableCreateZone=$r->enableCreateZone;
            $createZoneScript=$r->createZoneScript;
            $createZoneScriptReply=$r->createZoneScriptReply;
            $enableCheckNS=$r->enableCheckNS;
            $checkNSScript=$r->checkNSScript;
            $checkNSScriptReply=$r->checkNSScriptReply;
            $promo=$r->promo;
            $createZoneServer=$r->createZoneServer;
            $createZoneServerLogin=$r->createZoneServerLogin;
            $free=$r->free;
            $daysRenew=$r->daysRenew;
            $description=$r->description;
            $registratorId=$r->registratorId;
            $privacy=$r->privacy;
            $privacy_cost=$r->privacy_cost;
            $privacy_payafterdisable=$r->privacy_payafterdisable;
            $idn=$r->idn;
            $warning=$r->warning;
            $licenseRequired=$r->licenseRequired;
            $privacy_required=$r->privacy_required;
            $transferAllow=$r->transferAllow;
            $transferNeedAuth=$r->transferNeedAuth;
            $transferRenew=$r->transferRenew;
            $localContact=$r->localContact;
            $localContact_cost=$r->localContact_cost;
                        $button='Изменить';
                        $title='Редактирование';
                        $readonly='readonly';
                }
        if (!$transferCostCurrency) { $transferCostCurrency = CURAC; }
        if (!$cost_if_hostCurrency) { $cost_if_hostCurrency = CURAC; }
        if (!$cost_if_not_hostCurrency) { $cost_if_not_hostCurrency = CURAC; }
        if (!$cost_if_resellerCurrency) { $cost_if_resellerCurrency = CURAC; }
        if (!$cost_if_domainresellerCurrency) { $cost_if_domainresellerCurrency = CURAC; }
        if (!$renew_if_hostCurrency) { $renew_if_hostCurrency = CURAC; }
        if (!$renew_if_not_hostCurrency) { $renew_if_not_hostCurrency = CURAC; }
        if (!$renew_if_resellerCurrency) { $renew_if_resellerCurrency = CURAC; }
        if (!$renew_if_domainresellerCurrency) { $renew_if_domainresellerCurrency = CURAC; }
        $domainCostType = GetSetting("domainCostType");
                ?>
                <form method=post>
                <input type=hidden name=do value=<? print $do?>>
                <input type=hidden name=sub value=<? print $sub?>2>
                <input type=hidden name=id value=<? print $id?>>
                <table>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B><? print $title?> доменной зоны</b></td></tr>
                <tr bgcolor=<? print $font_row1?>><td width=300>Доменная зона:</td><td><input type=text size=15 name=zone value=<? print $zone?> <? print $readonly?>> без точки в начале (ru, net.ru, com)</td></tr>
        <tr><td>Группа:</td><td><select name=group><option></option>
        <?
        $groups = GetZonesGroups();
        while ($grp = @mysql_fetch_object($groups)) {
            if ($grp->id == $group) {$addon="selected";} else {$addon="";}
            print "<option value=$grp->id $addon>$grp->name</option>";
        }
        ?>
        </select></td></tr>
                <tr><td valign=top>Описание: <img src="./_rootimages/question.gif" alt="Описание выводится на странице zones.php"></td><td><textarea name=description cols=50 rows=3><? print htmlDecode($description)?></textarea></td></tr>
                <tr><td valign=top>Предупреждение: <img src="./_rootimages/question.gif" alt="Если указано, то предупреждение будет выдано клиенту на этапе оформления заказа."></td><td><textarea name=warning cols=50 rows=3><? print htmlDecode($warning)?></textarea></td></tr>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Параметры доменной зоны</b></td></tr>
                <tr><td>Поддержка IDN: <img src="./_rootimages/question.gif" alt="<B>Поддержка национальных доменов:</b><BR><BR><B>нет</B> - доменная зона не поддерживает национальные домены<BR><B>да</B> - доменная зона поддерживает национальные домены<BR><B>только IDN</B> - доменная зона поддерживает только национальные домены<BR>"></td><td><input type=radio name=idn value=no <? if ($idn == 'no') { print "checked"; }?>> нет <input type=radio name=idn value=yes <? if ($idn == "yes") { print "checked"; }?>> да <input type=radio name=idn value=only <? if ($idn == "only") { print "checked"; }?>> только IDN</td></tr>
                <tr><td>Требовать номер торговой марки:</td><td><input type=radio name=licenseRequired value=no <? if ($licenseRequired == 'no') { print "checked"; }?>> нет <input type=radio name=licenseRequired value=yes <? if ($licenseRequired == "yes") { print "checked"; }?>> да <input type=radio name=licenseRequired value=idn <? if ($licenseRequired == "idn") { print "checked"; }?>> только для IDN</td></tr>
                <tr><td>Минимальный срок регистрации:</td><td><input type=text size=5 name=minsrok value=<? print $minsrok?>> в месяцах (12, 24)</td></tr>
                <tr><td>Минимальный срок продления:</td><td><input type=text size=5 name=minsrok_renew value=<? print $minsrok_renew?>> в месяцах (12, 24)</td></tr>
                <tr><td>Продление не ранее чем за: <img src="./_rootimages/question.gif" alt="Если задано, то клиент сможет заказать продление домена не ранее, чем за указанное количество дней до окончания срока делегирования домена.<BR><BR>0 - без ограничений."></td><td><input type=text size=1 name=daysRenew value=<? print $daysRenew?>> дней</td></tr>
                <tr><td>Минимальная длина домена:</td><td><input type=text size=5 name=minWidth value=<? print $minWidth?>> кол-во символов, пример: 3. минимум: 2</td></tr>
                <tr><td>Максимальная длина домена:</td><td><input type=text size=5 name=maxWidth value=<? print $maxWidth?>> кол-во символов, пример 63</td></tr>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Параметры трансфера</b></td></tr>
                <tr><td>Разрешить трансфер: <img src="./_rootimages/question.gif" alt="<B>Разрешить трансфер:</b><BR><BR><B>нет</B> - клиент не сможет заказать трансфер зарегистрированного домена в данной зоне к Вам<BR><B>да</B> - клиент сможет заказать трансфер зарегистрированного домена в данной зоне к Вам<BR>"></td><td><input type=radio name=transferAllow value=0 <? if (!$transferAllow) { print "checked"; }?>> нет <input type=radio name=transferAllow value=1 <? if ($transferAllow) { print "checked"; }?>> да</td></tr>
                <tr><td>Требовать AUTH-CODE для трансфера: <img src="./_rootimages/question.gif" alt="<B>Требовать AUTH-CODE для трансфера:</b><BR><BR><B>нет</B> - клиент сможет заказать трансфер зарегистрированного домена без указания AUTH-CODE<BR><B>да</B> - клиент сможет заказать трансфер зарегистрированного домена только с обязательным указанием AUTH-CODE<BR>"></td><td><input type=radio name=transferNeedAuth value=0 <? if (!$transferNeedAuth) { print "checked"; }?>> нет <input type=radio name=transferNeedAuth value=1 <? if ($transferNeedAuth) { print "checked"; }?>> да</td></tr>
                <tr><td>Цена при трансфере: <img src="./_rootimages/question.gif" alt="<B>Цена при трансфере:</b><BR><BR><B>бесплатно</B> - клиенту будет выставлен нулевой счёт<BR><B>регистрация</B> - клиенту будет выставлен счет за регистрацию домена на минимальный срок регистрации<BR><B>продление</B> - клиенту будет выставлен счет за продление домена на минимальный срок регистрации<BR>"></td><td><input type=radio name=transferRenew value=0 <? if (!$transferRenew) { print "checked"; }?>> бесплатно <input type=radio name=transferRenew value=1 <? if ($transferRenew == "1") { print "checked"; }?>> регистрация <input type=radio name=transferRenew value=2 <? if ($transferRenew == "2") { print "checked"; }?>> продление</td></tr>
                <tr><td>Доп. цена трансфера: <img src="./_rootimages/question.gif" alt="<B>Доп. цена трансфера:</b><BR><BR>Данная цена будет прибавлена к цене при трансфере, даже если в ней указано бесплатно. Если минимальный срок регистрации более 1 года, то данная цена будет умножена на количество лет.<BR>"</td><td><input type=text size=5 name=transferCost value=<? print $transferCost?>> <? printCurrencyCodes("transferCostCurrency", $transferCostCurrency) ?></td></tr>
                                                                                                   
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Стоимость регистрации домена (за 1 год)</b></td></tr>
                <tr><td><? if (!$domainCostType) { print "При заказе только домена:"; } else { print "Если клиент не пользуется услугами хостинга:"; } ?></td><td><input type=text size=5 name=cost_if_not_host value=<? print $cost_if_not_host?>> <? printCurrencyCodes("cost_if_not_hostCurrency", $cost_if_not_hostCurrency) ?></td></tr>
                <tr><td><? if (!$domainCostType) { print "При заказе домена вместе с хостингом:"; } else { print "Если клиент пользуется услугами хостинга:"; } ?></td><td><input type=text size=5 name=cost_if_host value=<? print $cost_if_host?>> <? printCurrencyCodes("cost_if_hostCurrency", $cost_if_hostCurrency) ?></td></tr>
                <tr><td>Для реселлеров хостинга:</td><td><input type=text size=5 name=cost_if_reseller value=<? print $cost_if_reseller?>> <? printCurrencyCodes("cost_if_resellerCurrency", $cost_if_resellerCurrency) ?></td></tr>
                <tr><td>Для реселлеров доменов:</td><td><input type=text size=5 name=cost_if_domainreseller value=<? print $cost_if_domainreseller?>> <? printCurrencyCodes("cost_if_domainresellerCurrency", $cost_if_domainresellerCurrency) ?></td></tr>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Стоимость продления домена (за 1 год)</b></td></tr>
                <tr><td><? if (!$domainCostType) { print "При продлении только домена:"; } else { print "Если клиент не пользуется услугами хостинга:"; } ?></td><td><input type=text size=5 name=renew_if_not_host value=<? print $renew_if_not_host?>> <? printCurrencyCodes("renew_if_not_hostCurrency", $renew_if_not_hostCurrency) ?></td></tr>
                <tr><td><? if (!$domainCostType) { print "При продлении домена вместе с хостингом:"; } else { print "Если клиент пользуется услугами хостинга:"; } ?></td><td><input type=text size=5 name=renew_if_host value=<? print $renew_if_host?>> <? printCurrencyCodes("renew_if_hostCurrency", $renew_if_hostCurrency) ?></td></tr>
                <tr><td>Для реселлеров хостинга:</td><td><input type=text size=5 name=renew_if_reseller value=<? print $renew_if_reseller?>> <? printCurrencyCodes("renew_if_resellerCurrency", $renew_if_resellerCurrency) ?></td></tr>
                <tr><td>Для реселлеров доменов:</td><td><input type=text size=5 name=renew_if_domainreseller value=<? print $renew_if_domainreseller?>> <? printCurrencyCodes("renew_if_domainresellerCurrency", $renew_if_domainresellerCurrency) ?></td></tr>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Privacy Protection</b></td></tr>
                <tr><td>Privacy Protection:</td><td><select name=privacy><option value=0 <? if (!$privacy) {print "selected";} ?>>не доступно</option><option value=person <? if ($privacy == "person") {print "selected";} ?>>доступно только для физ. лиц</option><option value=all <? if ($privacy == "all") {print "selected";} ?>>доступно для всех</option></select></td></tr>
                <tr><td>Стоимость (за 1 год), <? print CURAS?>:</td><td><input type=text size=5 name=privacy_cost value=<? print $privacy_cost?>></td></tr>
                <tr><td>Взымать плату заново, после отключения Privacy Protection клиентом:</td><td><input type=radio name=privacy_payafterdisable value=1 <? if ($privacy_payafterdisable) { print "checked"; }?>> да <input type=radio name=privacy_payafterdisable value=0 <? if (!$privacy_payafterdisable) { print "checked"; }?>> нет</td></tr>
                <tr><td>Активировать принудительно: <img src="./_rootimages/question.gif" alt="Если включено, то Privacy Protection будет активирован автоматически, независимо от того заказал ли его клиент."></td><td><input type=radio name=privacy_required value=1 <? if ($privacy_required) { print "checked"; }?>> да <input type=radio name=privacy_required value=0 <? if (!$privacy_required) { print "checked"; }?>> нет</td></tr>
        <? $localContactUser = GetUserByLogin(GetSetting("localContactUser")); if ($localContactUser->id) { ?>
                    <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Локальный контакт</b></td></tr>
                    <tr><td>Локальный контакт: <img src="./_rootimages/question.gif" alt="Если включено, то клиент при регистрации домена сможет зарегистрировать домен, заказав использование локального контакта (домен будет зарегистрирован на профайл, указанный в данном поле)."></td><td><select name=localContact><option value=0 <? if (!$localContact) {print "selected";} ?>>не доступно</option>
            <?
                $r = @mysql_query("select * from users_profile where uid='$localContactUser->id' order by id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>Function: ".__FUNCTION__."<BR>MySQL Error: ".mysql_error());
    
                if (mysql_num_rows($r) > 0) {
                    while ($rr = mysql_fetch_object($r)) {
                        $profileName = "[$rr->id]";
                        if ($rr->org == "1" or $rr->org == "2") {
                            if ($rr->surname or $rr->name or $rr->otchestvo) { $profileName=$profileName." $rr->surname $rr->name $rr->otchestvo";}
                        } else if ($rr->org == "3") {
                            if ($rr->firma) { $profileName=$profileName." $rr->firma";}
                        }
                        print "<option value=$rr->id "; if ($localContact == $rr->id) { print "selected"; } print ">$profileName</option>";
                    }
                }
            ?>
            </select></td></tr>
                    <tr><td>Стоимость (за 1 год), <? print CURAS?>:</td><td><input type=text size=5 name=localContact_cost value=<? print $localContact_cost?>></td></tr>
        <? } else { print "<input type=hidden name=localContact value=$localContact><input type=hidden name=localContact_cost value=$localContact_cost>"; } ?>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Регистратор для доменной зоны</b></td></tr>
                <tr><td>Авторегистрация домена через:</td><td><? printAutoregSelect($autoreg); ?></td></tr>
                <tr><td>Регистратор по умолчанию:</td><td><input type=checkbox name=isDefault <? if ($isDefault) {print "checked";}?> value=1> регистратор будет выбран по умолчанию, если клиенту предоставляется выбор регистратора</td></tr>
        <? $registratorType = GetRegistratorTypeById($autoreg); 
        if ( $registratorType == "rrpproxy" or $registratorType == "internetbs" or $registratorType == "namecheap") { ?><tr><td>Промо-код:</td><td><input type=text size=20 name=promo value=<? print $promo?>> промо-код для зоны у регистратора</td></tr><? }
        if ( $registratorType == "rootpanel") { ?><tr><td>ID регистратора:</td><td><input type=text size=20 name=registratorId value=<? print $registratorId?>> Если регистратор, предоставляет возможность выбора регистратора для доменной зоны, то здесь можно указать его ID.</td></tr><? }
        ?>
                <?
                if ($sub == 'edit') {
            $d = new domain("test.".$zone, 1);
            $dWhoisServer = $d->my_whois_server;
            if (!$dWhoisServer) {
                $dWhoisServer = "отсутствует сервер по умолчанию"; 
                if (!$whois) { $dWhoisServer = "<font color=red>".$dWhoisServer."</font>"; }
            }
            $dNotFound = $d->my_notfound_string;
            if (!$dNotFound) { 
                $dNotFound = "отсутствует строка по умолчанию"; 
                if (!$notFoundString) { $dNotFound = "<font color=red>".$dNotFound."</font>"; }
            }
        ?>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Настройки WHOIS</b></td></tr>
                <tr><td>WHOIS-сервер:</td><td><input type=text size=25 name=whois value=<? print $whois?>> по умолчанию: <B><? print $dWhoisServer?></B></td></tr>
                <tr><td>Строка Not Found:<BR>(часть ответа сервера, если домен не найден)</td><td><input type=text size=25 name=notFoundString value="<? print $notFoundString?>">  по умолчанию: <B><? print $dNotFound?></B></td></tr>
        <?
                }
        ?>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Другие настройки</b></td></tr>
                <tr><td>Зона активна:</td><td><input type=checkbox name=active <? if ($active) {print "checked";}?> value=1> клиент может заказать домен только в активной зоне</td></tr>
                <tr><td>Зона используется в whois:</td><td><input type=checkbox name=useInWhois <? if ($useInWhois) {print "checked";}?> value=1> отметить, если нужно отображать зону на whois-странице</td></tr>
                <tr><td valign=top>Зона является избранной:</td><td><input type=checkbox name=isFavorite <? if ($isFavorite) {print "checked";}?> value=1> если доменное имя на этапе заказа занято, то автоматически проверяем его во всех избранных зонах и выводим клиенту результат</td></tr>
                <tr><td valign=top>Зона является бесплатной:</td><td><input type=checkbox name=free <? if ($free) {print "checked";}?> value=1> да</td></tr>
                <tr><td>Комментарий:</td><td><input type=text size=60 name=comment value="<? print $comment?>"></td></tr>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>DNS-сервера по умолчанию</b><BR>(данная функция активна только при заказе домена отдельно (без хостинга))</td></tr>
                <tr><td colspan=2>Предлагать клиентам использовать DNS-сервера по умолчанию: <input type=radio name=enableDefaultNS onclick="hidediv('createZone'); this.form.defaultNS1.disabled=1; this.form.defaultNS2.disabled=1; this.form.defaultNS3.disabled=1; this.form.defaultNS4.disabled=1; " value=0 <? if (!$enableDefaultNS) {print "checked";} ?>> нет <input type=radio name=enableDefaultNS onclick="showdiv('createZone'); this.form.defaultNS1.disabled=0; this.form.defaultNS2.disabled=0; this.form.defaultNS3.disabled=0; this.form.defaultNS4.disabled=0; " value=1 <? if ($enableDefaultNS) {print "checked";} ?>> да</td></tr>
                <tr><td valign=top>DNS-сервера по умолчанию:</td><td>
            NS1: <input type=text size=25 name=defaultNS1 <? if (!$enableDefaultNS) { print "disabled"; } ?> value="<? print $defaultNS1?>"> NS2: <input type=text size=25 name=defaultNS2 <? if (!$enableDefaultNS) { print "disabled"; } ?> value="<? print $defaultNS2?>"><BR>
            NS3: <input type=text size=25 name=defaultNS3 <? if (!$enableDefaultNS) { print "disabled"; } ?> value="<? print $defaultNS3?>"> NS4: <input type=text size=25 name=defaultNS4 <? if (!$enableDefaultNS) { print "disabled"; } ?> value="<? print $defaultNS4?>"><BR><BR>
            <div id="createZone" style="display: <? if ($enableDefaultNS) {print "block";} else {print "none";} ?>;">
            <table width="100%">
            <tr><td>
                <B>Если клиент выбрал использование DNS-серверов по умолчанию:</b><BR>
                <input type=radio name=enableCreateZone value=0 onclick="hidediv('createZoneServer'); hidediv('createZoneScript')" <? if (!$enableCreateZone) { print "checked"; } ?>> не прописывать DNS-зону на сервере<BR>
                <input type=radio name=enableCreateZone value=2 onclick="showdiv('createZoneServer'); hidediv('createZoneScript')" <? if ($enableCreateZone == "2") { print "checked"; } ?>> прописать DNS-зону на сервере (только для ISPManager & DirectAdmin)<BR>
                    <div id="createZoneServer" style="display: <? if ($enableCreateZone == "2") {print "block";} else {print "none";} ?>;">
                    <BR>
                    <table>
                    <tr><td>         Сервер: </td><td><select name=createZoneServer><option></option>
                    <?
                    $servers = GetServers();
                    while ($server = @mysql_fetch_object($servers)) {
                        if ($createZoneServer == $server->id) {$addon='selected';} else {$addon='';}
                        print "<option value=$server->id $addon>$server->name [$server->ip] [$server->type]</option>";
                    }
                    ?>
                    </select></td></tr>
                    <tr><td>         Аккаунт/Домен: </td><td><input type=text name=createZoneServerLogin value="<? print $createZoneServerLogin?>" size=10><img src="./_rootimages/question.gif" alt="<B>Для ISPManager:</B> аккаунт в который добавлять доменную зону. Должен принадлежать реселлеру/админу, логин которого указан в настройках сервера.<BR><BR><B>Для DirectAdmin:</b> основное доменное имя аккаунта, логин которого указан в настройках сервера."></td></tr>
                    </table><BR>
                    </div>
                <input type=radio name=enableCreateZone value=1 onclick="hidediv('createZoneServer'); showdiv('createZoneScript')" <? if ($enableCreateZone == "1") { print "checked"; } ?>> прописать DNS-зону на сервере с помощью запуска скрипта:<BR>
                    <div id="createZoneScript" style="display: <? if ($enableCreateZone == "1") {print "block";} else {print "none";} ?>;">
                    <BR>
                    <table>
                    <tr><td>
                                     доступные макросы: {domain}, {ns1}, {ns2}, {ns3}, {ns4}<BR>
                             пример команды: /usr/bin/add.sh -domain {domain} -ns1 {ns1} -ns2 {ns2}<BR><BR>
                                     команда:  <input type=text size=72 name=createZoneScript value="<? print $createZoneScript?>"><BR>
                                     часть ответа скрипта в случае успешного выполнения: <input type=text size=30 name=createZoneScriptReply value="<? print $createZoneScriptReply?>">
                    </td></tr>
                    </table><BR>
                    </div>
            </td></tr>
            </td></tr>
            </table>
            </div>
            
        </td></tr>
                <tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Проверка DNS-серверов</b><BR>(данная функция используется только при заказе домена отдельно (без хостинга), если клиент указал собственные NS-сервера)</td></tr>
        <tr><td colspan=2>
            <input type=radio name=enableCheckNS onclick="hidediv('checkNSScript')" value=0 <? if (!$enableCheckNS) { print "checked"; } ?>> не проверять DNS-сервера<BR>
            <input type=radio name=enableCheckNS onclick="showdiv('checkNSScript')" value=1 <? if ($enableCheckNS) { print "checked"; } ?>> проверять DNS-сервера с помощью запуска скрипта:<BR><BR>
            <div id="checkNSScript" style="display: <? if ($enableCheckNS) {print "block";} else {print "none";} ?>;">
            <table width="100%">
            <tr><td>
                                 доступные макросы: {domain}, {ns1}, {ns2}, {ns3}, {ns4}<BR>
                         пример команды: /usr/bin/check.sh -domain {domain} -ns1 {ns1} -ns2 {ns2}<BR><BR>
                                    команда:  <input type=text size=72 name=checkNSScript value="<? print $checkNSScript?>"><BR>
                                    часть ответа скрипта в случае успешного выполнения: <input type=text size=30 name=checkNSScriptReply value="<? print $checkNSScriptReply?>"></td></tr>
            </td></tr>
            </table>
            </div>
        </td></tr>
                <tr><Td colspan=2 align=center><BR><input type=submit value=<? print $button?>></td></tr>
                </table>
                </form>
                <?
        }
        if ($sub == 'list') {
        checkAdminAccess('sZonesRead',1);
        $zonesgroups = GetzonesGroups();
        if (@mysql_num_rows($zonesgroups) > 0) {
            print "Группы доменных зон:";
            while ($zonesgroup = mysql_fetch_object($zonesgroups)) {
                print " [ <a href=?do=$do&group=$zonesgroup->id>$zonesgroup->name</a> ] ";
            }
            print " [ <a href=?do=$do&group=0>Без группы</a> ] ";
            print "<BR>";
        }
        print " [ <a href=?do=$do>Все доменные зоны</a> ]<BR><BR> ";
        if ($group != "") {
            $where = "WHERE `group`='$group'";
            $zonesgroup=GetZonesGroupById($group);
            $txt = "$zonesgroup->name";
        }
                $r=@mysql_query("select * from zones $where order by zone") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
                ?>
                <table cellpadding=3 width=95%>
                <tr><td colspan=8 align=center bgcolor=<? print $font_head?>><B>Доменные зоны <? if ($txt) { print "($txt)"; } ?></b></td></tr>
                <tr bgcolor=<? print $font_head?>><td align=center>зона</td><td align=center>цена регистрации<p style="<? print $styleHelp?>">ц1 / ц2 / рес / рес.дом</td><td align=center>цена продления<p style="<? print $styleHelp?>">ц1 / ц2 / рес / рес.дом</td><Td align=center>минимальный срок<p style="<? print $styleHelp?>">регистрация / продление</td><Td align=center>активность</td><Td align=center>whois</td><Td align=center>регистратор</td><td></td></tr>
                <?
                $cnt=0;
                while ($rr = mysql_fetch_object($r)) {
                        getfont();
            if ($rr->cost_if_not_hostCurrency == $rr->cost_if_hostCurrency and $rr->cost_if_not_hostCurrency == $rr->cost_if_resellerCurrency and $rr->cost_if_not_hostCurrency == $rr->cost_if_domainresellerCurrency) {
                $costTxt = "$rr->cost_if_not_host / $rr->cost_if_host / $rr->cost_if_reseller / $rr->cost_if_domainreseller $rr->cost_if_domainresellerCurrency";
            } else {
                $costTxt = "$rr->cost_if_not_host $rr->cost_if_not_hostCurrency / $rr->cost_if_host $rr->cost_if_hostCurrency / $rr->cost_if_reseller $rr->cost_if_resellerCurrency / $rr->cost_if_domainreseller $rr->cost_if_domainresellerCurrency";
            }
            if ($rr->renew_if_not_hostCurrency == $rr->renew_if_hostCurrency and $rr->renew_if_not_hostCurrency == $rr->renew_if_resellerCurrency and $rr->renew_if_not_hostCurrency == $rr->renew_if_domainresellerCurrency) {
                $renewTxt = "$rr->renew_if_not_host / $rr->renew_if_host / $rr->renew_if_reseller / $rr->renew_if_domainreseller $rr->renew_if_domainresellerCurrency";
            } else {
                $renewTxt = "$rr->renew_if_not_host $rr->renew_if_not_hostCurrency / $rr->renew_if_host $rr->renew_if_hostCurrency / $rr->renew_if_reseller $rr->renew_if_resellerCurrency / $rr->renew_if_domainreseller $rr->renew_if_domainresellerCurrency";
            }
                        print "
                        <tr bgcolor=$font_row>
                        <td>$rr->zone</td>
                        <td align=center>$costTxt</td>
                        <Td align=center>$renewTxt</td>
                        <td align=center>".($rr->minsrok/12)." / ".($rr->minsrok_renew/12)."</td>
                        <td align=center>".$_yes[$rr->active]."</td>
                        <td align=center>".$_yes[$rr->useinwhois]."</td>
                        <td>".GetRegistratorNameById($rr->autoreg)."</td>
                        <Td align=center><A href=?do=$do&sub=edit&id=$rr->id><img src=./_rootimages/edit.gif alt=Изменить border=0></a><A href=?do=$do&sub=delete&id=$rr->id&zone=$rr->zone onclick="javascript: return confirm('Вы уверены, что хотите удалить доменную зону?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td>
                        </tr>";
                        $cnt++;
                }
                ?>
                <tr bgcolor=<? print $font_head?>><Td colspan=8>Всего доменных зон: <? print $cnt?></td></tr>
                </table>
                <?
        }
?>