Location: PHPKode > projects > TLD Manager > tldmgr/domain_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\"");

if ((!$domain) || (!$TLD)) {
	$domain = $_COOKIE["domain"];
	$TLD = $_COOKIE["TLD"];
}
if ((!$domain) || (!$TLD)) {
	header("Location: domain_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 domain SET A='$A' WHERE name='$domain' AND TLD='$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 domain SET CNAME='$CNAME' WHERE name='$domain' AND TLD='$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 domain SET MX='$MX' WHERE name='$domain' AND TLD='$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 domain SET NS='$NS' WHERE name='$domain' AND TLD='$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 domain SET RP='$RP' WHERE name='$domain' AND TLD='$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 domain SET TXT='$TXT' WHERE name='$domain' AND TLD='$TLD'");


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