Location: PHPKode > projects > TLD Manager > tldmgr/subdomain_dns_update.php
<?

include("include/config.php"); 
mysql_connect($db_host,$db_user,$db_pass);
@mysql_select_db($db_name) or die( "Unable to select database \"$db_name @ $db_host\"");

$domain = $_COOKIE["domain"];
$TLD = $_COOKIE["TLD"];
if ((!$domain) || (!$TLD)) { header("Location: domain_pick.php"); }	

$subdomain = $_COOKIE["subdomain"];
if (!$subdomain) { header("Location: subdomain_pick.php"); }	


// Update A
$A="";
for ($c=0; $c<count($A_Name); $c++) {
  if (($A_Name[$c]) || ($A_IP[$c])) {
		$A .= "||" . $A_Name[$c] . "=" . $A_IP[$c];
	}
}
$A = substr($A, 2);
$result = mysql_query("UPDATE subdomain SET A='$A' WHERE name='$subdomain' AND parent='$domain.$TLD'");

// Update CNAME
$CNAME="";
for ($c=0; $c<count($CNAME_Name); $c++) {
  if (($CNAME_Name[$c]) || ($CNAME_Ref[$c])) {
		$CNAME .= "||" . $CNAME_Name[$c] . "=" . $CNAME_Ref[$c];
	}
}
$CNAME = substr($CNAME, 2);
$result = mysql_query("UPDATE subdomain SET CNAME='$CNAME' WHERE name='$subdomain' AND parent='$domain.$TLD'");

// Update MX
$MX="";
for ($c=0; $c<count($MX_Val); $c++) {
  if (($MX_Val[$c]) || ($MX_IP[$c])) {
		$MX .= "||" . $MX_Val[$c] . "=" . $MX_IP[$c];
	}
}
$MX = substr($MX, 2);
$result = mysql_query("UPDATE subdomain SET MX='$MX' WHERE name='$subdomain' AND parent='$domain.$TLD'");

// Update NS
$NS="";
for ($c=0; $c<count($NS_IP); $c++) {
  if ($NS_IP[$c]) {
		$NS .= "||" . $NS_IP[$c];
	}
}
$NS = substr($NS, 2);
$result = mysql_query("UPDATE subdomain SET NS='$NS' WHERE name='$subdomain' AND parent='$domain.$TLD'");

// Update RP
$RP="";
for ($c=0; $c<count($RP_Info); $c++) {
  if ($RP_Info[$c]) {
		$RP .= "||" . $RP_Info[$c];
	}
}
$RP = substr($RP, 2);
$result = mysql_query("UPDATE subdomain SET RP='$RP' WHERE name='$subdomain' AND parent='$domain.$TLD'");

// Update TXT
$TXT="";
for ($c=0; $c<count($TXT_Info); $c++) {
  if ($TXT_Info[$c]) {
		$TXT .= "||" . $TXT_Info[$c];
	}
}
$TXT = substr($TXT, 2);
$result = mysql_query("UPDATE subdomain SET TXT='$TXT' WHERE name='$subdomain' AND parent='$domain.$TLD'");


mysql_close();
header("Location: subdomain_dns.php");
?>
Return current item: TLD Manager