php和asp判读蜘蛛与人工浏览,用于备案
Posted by he; tagged with 代码 , php判断 , 跳转
php代码:
说明:header("Location:default.php".$_SERVER['REQUEST_URI']); 要跳转到新的页面去。当然也可以echo出来。可参考eot写法,此处不举例了。
fetch_array($news)){
echo <<{$rs[title]}
[{$rs[date]}]
EOT;
?>
asp代码:
<%
function GetBot()
'查询蜘蛛
dim s_agent
GetBot=""
s_agent=Request.ServerVariables("HTTP_USER_AGENT") '关键判断语句
if instr(1,s_agent,"googlebot",1) >0 then
GetBot="google"
end if
if instr(1,s_agent,"msnbot",1) >0 then
GetBot="MSN"
end if
if instr(1,s_agent,"slurp",1) >0 then
GetBot="Yahoo"
end if
if instr(1,s_agent,"baiduspider",1) >0 then
GetBot="baidu"
end if
if instr(1,s_agent,"sohu-search",1) >0 then
GetBot="Sohu"
end if
if instr(1,s_agent,"lycos",1) >0 then
GetBot="Lycos"
end if
if instr(1,s_agent,"robozilla",1) >0 then
GetBot="Robozilla"
end if
if instr(1,s_agent,"Sosospider",1) >0 then
GetBot="soso"
end if
if instr(1,s_agent,"Sogou+web+spider",1) >0 then
GetBot="Sogou"
end if
if instr(1,s_agent,"YodaoBot",1) >0 then
GetBot="Yodao"
end if
end function
%>
<%
if GetBot<>"" then
%>
加载你的网页代码
<%else%>
网站备案中
<%end if%>