almir
Jul 31st 2008, 4:09 am
I need some help with PHP code. I have popup on my site, but want to exclude it if visitor comes from certain site. How can I do that ?
nico_swd
Jul 31st 2008, 4:14 am
if (!empty($_SERVER['HTTP_REFERER']) AND $parts = @parse_url($_SERVER['HTTP_REFERER']))
{
$blocked_hosts = array('some.com', 'site.com', 'blah.com');
$host = preg_replace('~^www\.~', null, strtolower($parts['host']));
if (!in_array($host, $blocked_hosts))
{
// Request comes from one of the sites that's NOT in the array above.
}
else
{
// You know the deal
}
}
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.