答案:// 禁止网外链接(例如搜索引擎)查看网页内容
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;
}
}
// 禁止直接输入网址查看网页内容
else
{
header("Location:http://www.phpv.net");
exit;
}
只有点击超链接(即<A href=>
这样写是不是更简洁些?
if(($host!="211.152.50.35")&&($host!=www.phpv.net)){
header("Location:http://www.phpv.net");
exit;
}
上一个:PHP怎样连接Oracle
下一个:一 php与XML、XSLT、Mysql的结合运用,安装篇