limit PHP script to one domain per license

Posted by Mac Os on Stack Overflow See other posts from Stack Overflow or by Mac Os
Published on 2012-04-01T05:26:29Z Indexed on 2012/04/01 5:28 UTC
Read the original article Hit count: 166

Filed under:

what is the best way to make my php code working on one domain and sure i will encode the whole code by ioncube

i want function like

function domain(){

}

if($this_domain <> domain()){
   exit('no');
}

or

$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;
}

now i want know the best way to do that

may be will user strpos

© Stack Overflow or respective owner

Related posts about php