ASP Judge user browser and search spider code
Last Update:2017-01-13
Source: Internet
Author: User
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
This article is from www.111cn.net