inc/record.inc.php
changeset 171 2a10febd6af9
parent 170 391e744a1def
child 172 4708e6b152a0
--- a/inc/record.inc.php	Sun May 18 11:51:59 2008 +0000
+++ b/inc/record.inc.php	Sun May 18 12:28:16 2008 +0000
@@ -1049,6 +1049,19 @@
         }
 }
 
+function get_serial_by_zid($zid) {
+	global $db;
+	if (is_numeric($zid)) {
+		$query = "SELECT content FROM records where TYPE = 'SOA' and domain_id = " . $db->quote($zid);
+		$rr_soa = $db->queryOne($query);
+		if (PEAR::isError($rr_soa)) { error($rr_soa->getMessage()); return false; }
+		$rr_soa_fields = explode(" ", $rr_soa);
+	} else {
+		error(sprintf(ERR_INV_ARGC, "get_serial_by_zid", "id must be a number"));
+		return false;
+	}
+	return $rr_soa_fields[2];
+}
 
 function validate_account($account) {
   	if(preg_match("/^[A-Z0-9._-]+$/i",$account)) {