open website only if refer is facebook

i want to allow users to see website only if refer is from facebook
facebook page or timeline or like that...
if refer is direct or from google i want to block him

i have these code where is my mistake?

<?php

$allowed_domains = array('www.facebook.com/','https://www.facebook.com/');

$REFERRER = $_SERVER['HTTP_REFERER'];

if ($REFERRER == '') {
// works
}

$domain = substr($REFERRER, strpos($REFERRER, '://')+3);
$domain = substr($domain, 0, strpos($domain, '/'));

if...

open website only if refer is facebook

from PHP http://ift.tt/1OD64Ee
via IFTTT
Previous
Next Post »
Thanks for your comment