drupal_valid_http_host()
files/drupal-6.7/includes/bootstrap.inc, line 278
Validate that $_SERVER['HTTP_HOST'] is safe.
As $_SERVER['HTTP_HOST'] is user input, ensure it only contains characters allowed in hostnames. See RFC 952 (and RFC 2181). $_SERVER['HTTP_HOST'] is lowercased.
TRUE if only containing valid characters, or FALSE otherwise.
<?php
function drupal_valid_http_host() {
$_SERVER['HTTP_HOST'] = strtolower($_SERVER['HTTP_HOST']);
return preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $_SERVER['HTTP_HOST']);
}
?>