麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > ASP > 正文

asp 判斷是否為搜索引擎蜘蛛的代碼

2024-05-04 11:08:35
字體:
供稿:網(wǎng)友
下面的代碼注意是針對搜索引擎做出一些適當?shù)膬?nèi)容顯示,但這樣對于seo不好。不建議使用。作為學習參考。
 
 
 

 

復制代碼代碼如下:

<% 
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 
end function 
if GetBot="baidu" then 
'給百度定制的內(nèi)容 
elseif GetBot="google" then 
'給google 定制的內(nèi)容 
end if 
%> 

下面是比較完整的代碼需要的朋友也可以參考下。里面還包括了一些客戶端信息。
復制代碼代碼如下:

Class SystemInfo_Cls 
Public Browser, version, platform, IsSearch, AlexaToolbar 
Private Sub Class_Initialize() 
Dim Agent, Tmpstr 
IsSearch = False 
If Not IsEmpty(Session("SystemInfo_Cls")) Then 
Tmpstr = Split(Session("SystemInfo_Cls"), "|||") 
Browser = Tmpstr(0) 
version = Tmpstr(1) 
platform = Tmpstr(2) 
AlexaToolbar = Tmpstr(4) 
If Tmpstr(3) = "1" Then 
IsSearch = True 
End If 
Exit Sub 
End If 
Browser = "unknown" 
version = "unknown" 
platform = "unknown" 
Agent = Request.ServerVariables("HTTP_USER_AGENT") 
If InStr(Agent, "Alexa Toolbar") > 0 Then 
AlexaToolbar = "YES" 
Else 
AlexaToolbar = "NO" 
End If 
If Left(Agent, 7) = "Mozilla" Then '有此標識為瀏覽器 
Agent = Split(Agent, ";") 
If InStr(Agent(1), "MSIE") > 0 Then 
Browser = "Internet Explorer " 
version = Trim(Left(Replace(Agent(1), "MSIE", ""), 6)) 
ElseIf InStr(Agent(4), "Netscape") > 0 Then 
Browser = "Netscape " 
Tmpstr = Split(Agent(4), "/") 
version = Tmpstr(UBound(Tmpstr)) 
ElseIf InStr(Agent(4), "rv:") > 0 Then 
Browser = "Mozilla " 
Tmpstr = Split(Agent(4), ":") 
version = Tmpstr(UBound(Tmpstr)) 
If InStr(version, ")") > 0 Then 
Tmpstr = Split(version, ")") 
version = Tmpstr(0) 
End If 
End If 
If InStr(Agent(2), "NT 5.2") > 0 Then 
platform = "Windows 2003" 
ElseIf InStr(Agent(2), "Windows CE") > 0 Then 
platform = "Windows CE" 
ElseIf InStr(Agent(2), "NT 5.1") > 0 Then 
platform = "Windows XP" 
ElseIf InStr(Agent(2), "NT 4.0") > 0 Then 
platform = "Windows NT" 
ElseIf InStr(Agent(2), "NT 5.0") > 0 Then 
platform = "Windows 2000" 
ElseIf InStr(Agent(2), "NT") > 0 Then 
platform = "Windows NT" 
ElseIf InStr(Agent(2), "9x") > 0 Then 
platform = "Windows ME" 
ElseIf InStr(Agent(2), "98") > 0 Then 
platform = "Windows 98" 
ElseIf InStr(Agent(2), "95") > 0 Then 
platform = "Windows 95" 
ElseIf InStr(Agent(2), "Win32") > 0 Then 
platform = "Win32" 
ElseIf InStr(Agent(2), "Linux") > 0 Then 
platform = "Linux" 
ElseIf InStr(Agent(2), "SunOS") > 0 Then 
platform = "SunOS" 
ElseIf InStr(Agent(2), "Mac") > 0 Then 
platform = "Mac" 
ElseIf UBound(Agent) > 2 Then 
If InStr(Agent(3), "NT 5.1") > 0 Then 
platform = "Windows XP" 
End If 
If InStr(Agent(3), "Linux") > 0 Then 
platform = "Linux" 
End If 
End If 
If InStr(Agent(2), "Windows") > 0 And platform = "unknown" Then 
platform = "Windows" 
End If 
ElseIf Left(Agent, 5) = "Opera" Then '有此標識為瀏覽器 
Agent = Split(Agent, "/") 
Browser = "Mozilla " 
Tmpstr = Split(Agent(1), " ") 
version = Tmpstr(0) 
If InStr(Agent(1), "NT 5.2") > 0 Then 
platform = "Windows 2003" 
ElseIf InStr(Agent(1), "Windows CE") > 0 Then 
platform = "Windows CE" 
ElseIf InStr(Agent(1), "NT 5.1") > 0 Then 
platform = "Windows XP" 
ElseIf InStr(Agent(1), "NT 4.0") > 0 Then 
platform = "Windows NT" 
ElseIf InStr(Agent(1), "NT 5.0") > 0 Then 
platform = "Windows 2000" 
ElseIf InStr(Agent(1), "NT") > 0 Then 
platform = "Windows NT" 
ElseIf InStr(Agent(1), "9x") > 0 Then 
platform = "Windows ME" 
ElseIf InStr(Agent(1), "98") > 0 Then 
platform = "Windows 98" 
ElseIf InStr(Agent(1), "95") > 0 Then 
platform = "Windows 95" 
ElseIf InStr(Agent(1), "Win32") > 0 Then 
platform = "Win32" 
ElseIf InStr(Agent(1), "Linux") > 0 Then 
platform = "Linux" 
ElseIf InStr(Agent(1), "SunOS") > 0 Then 
platform = "SunOS" 
ElseIf InStr(Agent(1), "Mac") > 0 Then 
platform = "Mac" 
ElseIf UBound(Agent) > 2 Then 
If InStr(Agent(3), "NT 5.1") > 0 Then 
platform = "Windows XP" 
End If 
If InStr(Agent(3), "Linux") > 0 Then 
platform = "Linux" 
End If 
End If 
Else 
'識別搜索引擎 
Dim botlist, i 
botlist = "Google,Isaac,Webdup,SurveyBot,Baiduspider,ia_archiver,P.Arthur,FAST-WebCrawler,Java,Microsoft-ATL-Native,TurnitinBot,WebGather,Sleipnir" 
botlist = Split(botlist, ",") 
For i = 0 To UBound(botlist) 
If InStr(Agent, botlist(i)) > 0 Then 
platform = botlist(i) & "搜索器" 
IsSearch = True 
Exit For 
End If 
Next 
End If 
If IsSearch Then 
Browser = "" 
version = "" 
Session("SystemInfo_Cls") = Browser & "|||" & version & "|||" & platform & "|||1|||" & AlexaToolbar 
Else 
Session("SystemInfo_Cls") = Browser & "|||" & version & "|||" & platform & "|||0|||" & AlexaToolbar 
End If 
End Sub 
End Class

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 久久亚洲成人 | 99国产精品白浆在线观看免费 | 成人午夜一区二区 | 毛片免费视频播放 | 久久综合久久美利坚合众国 | 亚洲免费看片网站 | 在线看免电影网站 | 国产99久久| 国产99一区二区 | 狠狠干天天操 | 国产papa| 日本中文字幕电影在线观看 | 女人久久久www免费人成看片 | 免费a级毛片大学生免费观看 | 欧美日韩亚洲在线 | 一级黄色av电影 | 欧美精品国产综合久久 | 青草久久av | 色婷婷久久久久久 | 精品国产精品久久 | 色网免费观看 | 一级黄色欧美 | 日韩精品中文字幕一区 | 精精国产xxxx视频在线播放7 | 久久96国产精品久久秘臀 | www.成人免费视频 | 精品国内视频 | 越南一级黄色片 | 中文字幕精品在线视频 | 黄色大片www | 久久综合婷婷香五月 | 在线成人av观看 | 免费人成年短视频在线观看网站 | 黄色大片在线观看 | 亚洲视频在线一区二区 | xxxxhdhdhdhd日本 | 国产美女视频一区 | 国产精品一二区 | 亚洲网站在线 | 日韩精品免费一区二区三区 | japanese末成年free |