本文整理匯總了PHP中is_unqualified_hostname函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_unqualified_hostname函數的具體用法?PHP is_unqualified_hostname怎麽用?PHP is_unqualified_hostname使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_unqualified_hostname函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: do_input_validation
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
/* either MAC or Client-ID must be specified */
if (empty($_POST['mac']) && empty($_POST['cid'])) {
$input_errors[] = gettext("Either MAC address or Client identifier must be specified");
}
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
$_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac']));
if ($_POST['hostname']) {
preg_match("/\\-\$/", $_POST['hostname'], $matches);
if ($matches) {
$input_errors[] = gettext("The hostname cannot end with a hyphen according to RFC952");
}
if (!is_hostname($_POST['hostname'])) {
$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'.");
} else {
if (!is_unqualified_hostname($_POST['hostname'])) {
$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
}
}
}
if ($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr'])) {
$input_errors[] = gettext("A valid IP address must be specified.");
}
if ($_POST['mac'] && !is_macaddr($_POST['mac'])) {
$input_errors[] = gettext("A valid MAC address must be specified.");
}
if ($static_arp_enabled && !$_POST['ipaddr']) {
$input_errors[] = gettext("Static ARP is enabled. You must specify an IP address.");
}
/* check for overlaps */
foreach ($a_maps as $mapent) {
示例2: foreach
}
if (ctype_digit($entry)) {
$aliases[$entry][$field] = $value;
}
}
$pconfig['aliases']['item'] = $aliases;
/* validate aliases */
foreach ($aliases as $idx => $alias) {
$aliasreqdfields = array('aliasdomain' . $idx);
$aliasreqdfieldsn = array(gettext("Alias Domain"));
do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors);
if ($alias['host']) {
if (!is_hostname($alias['host'])) {
$input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'.");
} else {
if (!is_unqualified_hostname($alias['host'])) {
$input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted");
}
}
}
if ($alias['domain'] && !is_domain($alias['domain'])) {
$input_errors[] = gettext("A valid domain must be specified in alias list.");
}
}
/* check for overlaps */
foreach ($a_hosts as $hostent) {
if (isset($id) && $a_hosts[$id] && $a_hosts[$id] === $hostent) {
continue;
}
if ($hostent['host'] == $_POST['host'] && $hostent['domain'] == $_POST['domain'] && (is_ipaddrv4($hostent['ip']) && is_ipaddrv4($_POST['ip']) || is_ipaddrv6($hostent['ip']) && is_ipaddrv6($_POST['ip']))) {
$input_errors[] = gettext("This host/domain already exists.");