Location: PHPKode > projects > TLD Manager > tldmgr/tld_update.php
<? // Write new TLD values and return to tld_pick.php //

$ERR = "";
$CHG = "";
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\"");


// Verify incoming data //


if (! $ERR) {
	$result = mysql_query("SELECT * FROM root WHERE TLD='$TLD'");
	if ($SOA != mysql_result($result,0,"SOA")) { $CHG=TRUE; }
	if ($contact != mysql_result($result,0,"contact")) { $CHG=TRUE; }
	if ($TTL != mysql_result($result,0,"TTL")) { $CHG=TRUE; }
	if ($refresh != mysql_result($result,0,"refresh")) { $CHG=TRUE; }
	if ($retry != mysql_result($result,0,"retry")) { $CHG=TRUE; }
	if ($expire != mysql_result($result,0,"expire")) { $CHG=TRUE; }
	if ($filename != mysql_result($result,0,"filename")) { $CHG=TRUE; }

  if ($CHG) {
		$serial = mysql_result($result,0,"serial");
		$s1=substr($serial,0, strlen($serial)-2);
		$s2=substr($serial,strlen($serial)-2) + 1;
		$newserial = date("Ymd");
		$num = "01";
		if ($s1 == $newserial) { $num = substr("00$s2", -2); }
		$newserial = $newserial . $num;
		
		$result = mysql_query("UPDATE root SET SOA='$SOA' WHERE TLD='$TLD'");
		$result = mysql_query("UPDATE root SET contact='$contact' WHERE TLD='$TLD'");
		$result = mysql_query("UPDATE root SET TTL=$TTL WHERE TLD='$TLD'");
		$result = mysql_query("UPDATE root SET refresh=$refresh WHERE TLD='$TLD'");
		$result = mysql_query("UPDATE root SET retry=$retry WHERE TLD='$TLD'");
		$result = mysql_query("UPDATE root SET expire=$expire WHERE TLD='$TLD'");
		$result = mysql_query("UPDATE root SET serial=$newserial WHERE TLD='$TLD'");
		$result = mysql_query("UPDATE root SET $filename='$filename' WHERE TLD='$TLD'");
	}
}

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