Question, im trying to grab just the root of HTTP_REFERER.
The below will work but sometimes RERERER is like this
And of course in that case the key exist will be false. So whats the best way to limit REFERER to just root.
PHP Code:
$ref = $_SERVER['HTTP_REFERER'];
$ok_array = array('http://www.mysite.com', 'www.mysitel.com', 'mysite.com');
if (array_key_exists($ref, $ok))
{
//do something
}
I do understand that REFERER could be blank for non referrers but that will be fine, i am trying to hardcode just my site as permitted, the rest can do what they want.
i guess i could use SERVER_NAME right
Thanks.