Links | Web page
PHP implementation of the Internet link to prohibit the way to view the Web page
Prohibit Internet links (such as search engines) from viewing Web page content
if (!empty ($_server[' http_referer '))
{
Preg_match ("/^" (http:\/\/)? [^\/]+)/I ", $_server[' Http_referer '], $matches);
$host = $matches [2];
if ($host = = "211.152.50.35") | | ($host ==www.phpv.net))
{
}
Else
{
Header ("Location:http://www.phpv.net");
Exit
}
}
No direct input to the Web site to view the content
Else
{
Header ("Location:http://www.phpv.net");
Exit
}
Only click on the hyperlink (that is, <a href=...>) open page only http_referer environment variables, such as window.open (), window.location= ..., Window.showmodelessdialog () and other open windows do not have http_referer environment variables, such restrictions will make the site a lot less activity. Of course, the fish and bear cake can not be both, hehe.
Is it simpler to write?
if (($host!= "211.152.50.35") && ($host!=www.phpv.net)) {
Header ("Location:http://www.phpv.net");
Exit
}