Thursday, 08 January 2015 06:39

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

Written by
Rate this item
(0 votes)
$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;
}
Read 986 times Last modified on Sunday, 09 July 2017 14:35
Admin

Live and Be Free