Copy codeThe Code is as follows: <%
Function GetBot ()
'Query spider
Dim s_agent
GetBot = ""
S_agent = Request. ServerVariables ("HTTP_USER_AGENT") 'key judgment statement
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
'Customized content for Baidu
Elseif GetBot = "google" then
'Custom content for google
End if
%>
For more information about the complete code, see. It also contains some client information.Copy codeThe Code is as follows: 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 "has this identifier as a browser
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 "has this identifier as a browser
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
'Recognition Search Engine
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) & "searcher"
IsSearch = True
Exit
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