inc/record.inc.php
changeset 160 19cc35549204
parent 141 1ede5203910d
child 161 0832d846bf8e
equal deleted inserted replaced
159:abe711eddd45 160:19cc35549204
   197 
   197 
   198 
   198 
   199 function add_supermaster($master_ip, $ns_name, $account)
   199 function add_supermaster($master_ip, $ns_name, $account)
   200 {
   200 {
   201         global $db;
   201         global $db;
   202         if (!is_valid_ip($master_ip) && !is_valid_ip6($master_ip)) {
   202         if (!is_valid_ipv4$master_ip) && !is_valid_ipv6($master_ip)) {
   203                 error(ERR_DNS_IP);
   203                 error(ERR_DNS_IP);
   204 		return false;
   204 		return false;
   205         }
   205         }
   206         if (!is_valid_hostname($ns_name)) {
   206         if (!is_valid_hostname($ns_name)) {
   207                 error(ERR_DNS_HOSTNAME);
   207                 error(ERR_DNS_HOSTNAME);
   220         }
   220         }
   221 }
   221 }
   222 
   222 
   223 function delete_supermaster($master_ip) {
   223 function delete_supermaster($master_ip) {
   224 	global $db;
   224 	global $db;
   225         if (is_valid_ip($master_ip) || is_valid_ip6($master_ip))
   225         if (is_valid_ipv4$master_ip) || is_valid_ipv6($master_ip))
   226         {
   226         {
   227                 $db->query("DELETE FROM supermasters WHERE ip = ".$db->quote($master_ip));
   227                 $db->query("DELETE FROM supermasters WHERE ip = ".$db->quote($master_ip));
   228                 return true;
   228                 return true;
   229         }
   229         }
   230         else
   230         else
   234 }
   234 }
   235 
   235 
   236 function get_supermaster_info_from_ip($master_ip)
   236 function get_supermaster_info_from_ip($master_ip)
   237 {
   237 {
   238 	global $db;
   238 	global $db;
   239         if (is_valid_ip($master_ip) || is_valid_ip6($master_ip))
   239         if (is_valid_ipv4$master_ip) || is_valid_ipv6($master_ip))
   240 	{
   240 	{
   241 	        $result = $db->queryRow("SELECT ip,nameserver,account FROM supermasters WHERE ip = ".$db->quote($master_ip));
   241 	        $result = $db->queryRow("SELECT ip,nameserver,account FROM supermasters WHERE ip = ".$db->quote($master_ip));
   242 
   242 
   243 		$ret = array(
   243 		$ret = array(
   244 		"master_ip"	=>              $result["ip"],
   244 		"master_ip"	=>              $result["ip"],
   677 }
   677 }
   678 
   678 
   679 function supermaster_exists($master_ip)
   679 function supermaster_exists($master_ip)
   680 {
   680 {
   681         global $db;
   681         global $db;
   682         if (is_valid_ip($master_ip) || is_valid_ip6($master_ip))
   682         if (is_valid_ipv4$master_ip) || is_valid_ipv6($master_ip))
   683         {
   683         {
   684                 $result = $db->query("SELECT ip FROM supermasters WHERE ip = ".$db->quote($master_ip));
   684                 $result = $db->query("SELECT ip FROM supermasters WHERE ip = ".$db->quote($master_ip));
   685                 if ($result->numRows() == 0)
   685                 if ($result->numRows() == 0)
   686                 {
   686                 {
   687                         return false;
   687                         return false;
  1037 }
  1037 }
  1038 
  1038 
  1039 function change_zone_slave_master($zone_id, $ip_slave_master) {
  1039 function change_zone_slave_master($zone_id, $ip_slave_master) {
  1040 	global $db;
  1040 	global $db;
  1041         if (is_numeric($zone_id)) {
  1041         if (is_numeric($zone_id)) {
  1042        		if (is_valid_ip($ip_slave_master) || is_valid_ip6($ip_slave_master)) {
  1042        		if (is_valid_ipv4$ip_slave_master) || is_valid_ipv6($ip_slave_master)) {
  1043 			$result = $db->query("UPDATE domains SET master = " .$db->quote($ip_slave_master). " WHERE id = ".$db->quote($zone_id));
  1043 			$result = $db->query("UPDATE domains SET master = " .$db->quote($ip_slave_master). " WHERE id = ".$db->quote($zone_id));
  1044 		} else {
  1044 		} else {
  1045 			error(sprintf(ERR_INV_ARGC, "change_domain_ip_slave_master", "This is not a valid IPv4 or IPv6 address: $ip_slave_master"));
  1045 			error(sprintf(ERR_INV_ARGC, "change_domain_ip_slave_master", "This is not a valid IPv4 or IPv6 address: $ip_slave_master"));
  1046 		}
  1046 		}
  1047 	} else {
  1047 	} else {