Copy Code code as follows:
<%
function Getbot ()
' Query spider
Dim s_agent
Getbot= ""
S_agent=request.servervariables ("Http_user_agent") ' critical 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
' Custom content for Baidu
ElseIf getbot= "Google" then
' Customizing the content to Google
End If
%>
Here are the more complete code required by friends can also refer to the following. It also includes some client information.
Copy Code code 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 identity 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), "Then") > 0
Platform = "Windows 98"
ElseIf InStr (Agent (2), "a") > 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 identity 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), "Then") > 0
Platform = "Windows 98"
ElseIf InStr (Agent (1), "a") > 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
' Identify search engines '
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) & "finder"
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