[PHP] Як дозволити доступ тільки до декількох доменних імен?

Written by  Thursday, 08 January 2015 06:39
$allowed_hosts = array('foo.example.com', 'bar.example.com');
if (!isset($_SERVER['HTTP_HOST']) || !in_array($_SERVER['HTTP_HOST'], $allowed_hosts)) {
    header($_SERVER['SERVER_PROTOCOL'].' 400 Bad Request');
    exit;
}
709 Read Last modified on Sunday, 09 July 2017

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.