drupal_valid_http_host

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 drupal_valid_http_host($host)

Validate that a hostname (for example $_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.

Rückgabewert

TRUE if only containing valid characters, or FALSE otherwise.

▾ 1 function calls drupal_valid_http_host()

conf_init in includes/bootstrap.inc
Loads the configuration and sets the base URL, cookie domain, and session name correctly.

Code

includes/bootstrap.inc, line 367

<?php
function drupal_valid_http_host($host) {
  return preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $host);
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen