You are here

function _hosting_valid_fqdn in Hosting 6.2

Same name and namespace in other branches
  1. 5 hosting.module \_hosting_valid_fqdn()
  2. 7.4 hosting.inc \_hosting_valid_fqdn()
  3. 7.3 hosting.inc \_hosting_valid_fqdn()

Check if the FQDN provided is valid.

Parameters

$fqdn: The Fully Qualified Domain Name (FQDN) to validate.

Return value

An integer greater than 0 if the $fqdn is valid, or 0 or FALSE if it not valid.

3 calls to _hosting_valid_fqdn()
hosting_server_validate in server/hosting_server.module
Implementation of hook_validate().
hosting_site_validate in site/hosting_site.form.inc
Implements hook_validate().
hosting_task_migrate_form_validate in migrate/hosting_migrate.module
Implementation of hook_validate().

File

./hosting.inc, line 32
General purpose Hosting module functions.

Code

function _hosting_valid_fqdn($fqdn) {

  // regex is an implementation of RFC1035, a little relaxed to allow
  // commonly registered hostnames (e.g. domaines starting with digits)
  return preg_match("/^([a-z0-9]([a-z0-9-]*[a-z0-9])?\\.?)+\$/i", $fqdn);
}