Файл: billing/_rootbill/_domains.inc.php
Строк: 437
<?
_head('utf-8',$_lang[DomainsTitle]);
$r=@mysql_query("select * from bills where status = '0' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
print "<font color=red>".$_lang[BillsNeOplachenoSchetov].": ".mysql_num_rows($r).". ".$_lang[BillsGoto]." <A class=rootlink href=?do=bills>".$_lang[BillsTitle]."</a> ".$_lang[BillGotoFor].".</font><BR><BR>";
}
if ($sub == "updatens" and $id) {
$d=@mysql_query("select * from orders_domains where id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($d) > 0) {
$d = @mysql_fetch_object($d);
$ns1=trim($ns1); $ns1 = preg_replace("/.$/ui","",$ns1);
$ns2=trim($ns2); $ns2 = preg_replace("/.$/ui","",$ns2);
$ns3=trim($ns3); $ns3 = preg_replace("/.$/ui","",$ns3);
$ns4=trim($ns4); $ns4 = preg_replace("/.$/ui","",$ns4);
if ($d->lastDNSchangeTime) {
$changeDNStimeout = GetSetting("changeDNStimeout");
$minutes = (time() - $d->lastDNSchangeTime) / 60;
}
if ($minutes and $changeDNStimeout and $minutes <= $changeDNStimeout) {$error=$_lang[DomainsErrorDNSTimeout]." (".round($minutes,2)."/$changeDNStimeout)";}
else if (!$ns1) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns1)) {$error=$_lang[OrderErrorNoPrymaryNS];}
else if (preg_match("/.$d->domain$/u",$ns1)) {$error=$_lang[OrderErrorNoOwnNS];}
else if (!$ns2) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if (!preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns2)) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if (preg_match("/.$d->domain$/u",$ns2)) {$error=$_lang[OrderErrorNoOwnNS];}
else if ($ns3 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns3)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($ns3 and preg_match("/.$d->domain$/u",$ns3)) {$error=$_lang[OrderErrorNoOwnNS];}
else if ($ns4 and !preg_match("/^[a-z0-9]{1}[a-z0-9-]*[a-z0-9]{1}.[a-z0-9-.]*[a-z0-9]{1}$/u",$ns4)) {$error=$_lang[OrderErrorNoFourNS];}
else if ($ns4 and preg_match("/.$d->domain$/u",$ns4)) {$error=$_lang[OrderErrorNoOwnNS];}
else if ($ns1 == $ns2) {$error=$_lang[OrderErrorNoSecondaryNS];}
else if ($ns3 and ($ns3 == $ns1 or $ns3 == $ns2)) {$error=$_lang[OrderErrorNoThirdNS];}
else if ($ns4 and ($ns4 == $ns1 or $ns4 == $ns2 or $ns4 == $ns3)) {$error=$_lang[OrderErrorNoFourNS];}
else {
if ($d->autoregby) {
if (updateNS($id,$ns1,$ns2,$ns3,$ns4)) {
@mysql_query("update orders_domains set lastDNSchangeTime=".time()." where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[DomainsChangeDNSSuccess]."<BR><BR>";
} else {
print $_lang[DomainsErrorChangeDNS]." ".$GLOBALerror."<BR><BR>"; $sub = "ns";
}
} else {
$nsss = "NS1: $ns1nNS2: $ns2";
if ($ns3) {$nsss = $nsss."nNS3: $ns3";}
if ($ns4) {$nsss = $nsss."nNS4: $ns4";}
$subject_msg = "Изменение DNS-серверов для $d->domain";
$message = "Пользователь ".$_SESSION["userLogin"]." заказал смену DNS-серверов для домена $d->domain (ID # $d->id) на:nn$nsssnn--nRootPanel";
$manager_email = GetSetting("manager_email");
$admEmails=GetAdminEmailsWhereTrueParam("senddns");
if (count($admEmails) > 0) {
WriteMailLog($subject_msg,$message);
}
sendmail($manager_email,'',$manager_email,$subject_msg,$message);
@mysql_query("update orders_domains set lastDNSchangeTime=".time()." where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[DomainsChangeDNSSendSuccess]."<BR><BR>";
}
}
if ($error) { print $error."<BR><BR>"; $sub = "ns"; }
}
else { print $_lang[ErrorBadId]."<BR><BR>"; }
}
if ($sub == "ns" and $id) {
$domain = GetDomainById($id);
if ($domain->uid == $_SESSION["userId"]) {
if ($domain->autoregby) {
$registrator = GetRegistratorById($domain->autoregby);
$ns = GetNS($id);
if (!$ns) { print $_lang[DomainsErrorCantGetDNS]." ".$GLOBALerror."<BR><BR>"; }
}
if ($ns1 or $ns2 or $ns3 or $ns4) {
$ns[0] = $ns1;
$ns[1] = $ns2;
$ns[2] = $ns3;
$ns[3] = $ns4;
}
print "<center>";
print "<form action=billing.php method=post>";
print "<input type=hidden name=do value=$do>";
print "<input type=hidden name=sub value=updatens>";
print "<input type=hidden name=id value=$id>";
print "<table class='rpTable' cellpadding=3>";
print "<tr><td colspan=2 align=center bgcolor=$font_head><B>".$_lang[DomainsDNSFor]." $domain->domain</b></td></tr>";
if ($registrator->type == "ficora") { print "<tr><Td>".$_lang[AuthorizationKey].":</td><td><input class=input type=text size=30 name=authorization_key value='$authorization_key'></td></tr>"; }
print "<tr><Td>".$_lang[DomainsNS1].":</td><td><input class=input type=text size=30 name=ns1 value=$ns[0]></td></tr>";
print "<tr><Td>".$_lang[DomainsNS2].":</td><td><input class=input type=text size=30 name=ns2 value=$ns[1]></td></tr>";
print "<tr><Td>".$_lang[DomainsNS3].":</td><td><input class=input type=text size=30 name=ns3 value=$ns[2]></td></tr>";
print "<tr><Td>".$_lang[DomainsNS4].":</td><td><input class=input type=text size=30 name=ns4 value=$ns[3]></td></tr>";
print "<tr><td colspan=2 align=center bgcolor=$font_head><input class=button type=submit value='".$_lang[Change]."'></td></tr>";
print "</table>";
print "</form>";
print "</center>";
}
else { print $_lang[ErrorBadId]."<BR><BR>"; }
}
if ($sub == 'delete' and $id) {
@mysql_query("delete from orders_domains where id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from bills where domain_id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[DomainsDeleteSuccess]."<BR><BR>";
}
getfont();
$r=@mysql_query("select * from orders_domains WHERE uid='".$_SESSION["userId"]."' order by id desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$rows = mysql_num_rows($r);
list($start, $perPage, $txt) = MakePages($page, $rows);
?>
<table class='rpTable' cellpadding=3 width=95% align=center border=1>
<tr align=center>
<th><?=$_lang[DomainsDate]?></th>
<th><?=$_lang[DomainsDomain]?></th>
<th><?=$_lang[DomainsEnd]?></th>
<th><?=$_lang[DomainsLeftDays]?></th>
<th><?=$_lang[Option]?></th>
</tr>
<?
$r=@mysql_query("select *,TO_DAYS(todate)-TO_DAYS(NOW()) as leftdays from orders_domains where uid='".$_SESSION["userId"]."' order by id desc LIMIT $start,$perPage") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$cnt=0;
getfont();
while ($rr = mysql_fetch_object($r)) {
getfont();
$b=mysql_query("select * from bills where domain_id = '$rr->id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$bills=mysql_num_rows($b);
$b=mysql_fetch_object($b);
$bp=mysql_query("select * from bills where domain_id = '$rr->id' and uid='".$_SESSION["userId"]."' and !(status='0')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$billspayed=mysql_num_rows($bp);
$billsNonPayed = $bills-$billspayed;
if ($rr->leftdays == "") {$rr->leftdays = "-";}
else if ($rr->leftdays <= 30 and $rr->startdate != "0000-00-00") {$rr->leftdays = "<font color=red>".$rr->leftdays."</font>"; }
if ($rr->startdate != "0000-00-00") { $todate = mydate($rr->todate); } else { $todate = "-"; }
$leftDays = $rr->leftdays;
if ($rr->todate != "0000-00-00" and $rr->status == "1") {
$dns="<A class=rootlink href=?do=$do&sub=ns&id=$rr->id><img src=./_rootimages/dns.gif style='padding-right: 5px' border=0 alt='".$_lang[DomainsChangeDNS]."'>$_lang[DomainsChangeDNS]</a><BR>";
} else {
$dns="";
}
if ($billspayed > 0 or $rr->todate != "0000-00-00") {
$delete='';
} else {
$delete="<A class=rootlink href=?do=$do&sub=delete&id=$rr->id onclick="javascript: return confirm('".$_lang[DomainsDeleteAlert]."');"><img src=./_rootimages/del.gif style='padding-right: 5px' border=0 alt='".$_lang[DomainsDeleteDomain]."'>$_lang[DomainsDeleteDomain]</a><BR>";
}
if ($billsNonPayed == 0 and $rr->todate != "0000-00-00") {
$renew="<a class=rootlink href=?do=renewdomain&domain_id=$rr->id><img src=./_rootimages/renew.gif style='padding-right: 5px' border=0 alt='".$_lang[DomainsRenewDomain]."'>$_lang[DomainsRenewDomain]</a>";
} else {
$renew='';
}
if (GetSetting("dogovor_enable") and !$rr->host_id) {
$dogovor="<a class=rootlink href='' onClick="popupWin = window.open('billing.php?do=orders&domain_id=$rr->id&sub=dogovor', 'dogovor', 'location,width=650,height=600,top=0,scrollbars=yes'); popupWin2 = window.open('billing.php?do=orders&domain_id=$rr->id&sub=dodatok', 'dodatok', 'location,width=650,height=600,top=20,left=20,scrollbars=yes'); popupWin.focus(); return false;"><img src=./_rootimages/dogovor.gif style='padding-right: 5px' border=0 alt='".$_lang[OrdersPrintDogovor]."'>$_lang[OrdersPrintDogovor]</a><BR>";
} else {
$dogovor="";
}
if ($rr->remarkUser) {
$rr->remarkUser = preg_replace("/n/ui","<BR>",$rr->remarkUser);
$remark="<span title='<B>".$_lang[OrderRemark].":</b><BR>$rr->remarkUser'><img src=./_rootimages/question2.gif style='padding-right: 5px' border=0>$_lang[OrderRemark]</span><BR>";
} else {
$remark="";
}
print "
<tr bgcolor=$font_row height=30>
<td align=center>".mydate($rr->orderdate)."</td>
<td><B>$rr->domain</b></td>
<td align=center>$todate</td>
<td align=center>$leftDays</td>
<td align=left valign=middle>$remark$dogovor$dns<A class=rootlink href=?do=bills¶m=domain_id&search=$rr->id><img src=./_rootimages/bills.gif style='padding-right: 5px' border=0 alt='".$_lang[BillsTitle].": $bills'>$_lang[BillsTitle]: $bills</a><BR>$renew$delete</td>
</tr>
";
$cnt++;
}
?>
<tr><th colspan=6><?=$_lang[DomainsDomainsTotal]?>: <?=$rows?>, <?=$_lang[DomainsOnPage]?>: <?=$cnt?></th></tr>
<tr><th colspan=10 align=right><?=$txt?></th></tr>
</table>
<?
_foot('utf-8');
?>