📄 functions_common.asp
字号:
'MSN search engine robot
ElseIf inStr(1, strUserAgent, "msnbot", 1) Then
strBrowserUserType = "MSN"
'inktomi search engine robot
ElseIf inStr(1, strUserAgent, "slurp", 1) Then
strBrowserUserType = "Yahoo"
'AltaVista search engine robot
ElseIf inStr(1, strUserAgent, "Scooter", 1) Then
strBrowserUserType = "AltaVista"
'DMOZ search engine robot
ElseIf inStr(1, strUserAgent, "Robozilla", 1) Then
strBrowserUserType = "DMOZ"
'Ask Jeeves search engine robot
ElseIf inStr(1, strUserAgent, "Ask Jeeves", 1) OR inStr(1, strUserAgent, "Ask+Jeeves", 1) Then
strBrowserUserType = "Ask Jeeves"
'Lycos search engine robot
ElseIf inStr(1, strUserAgent, "lycos", 1) Then
strBrowserUserType = "Lycos"
'Excite search engine robot
ElseIf inStr(1, strUserAgent, "ArchitextSpider", 1) Then
strBrowserUserType = "Excite"
'Northernlight search engine robot
ElseIf inStr(1, strUserAgent, "Gulliver", 1) Then
strBrowserUserType = "Northernlight"
'AllTheWeb search engine robot
ElseIf inStr(1, strUserAgent, "crawler@fast", 1) Then
strBrowserUserType = "AllTheWeb"
'Turnitin search engine robot
ElseIf inStr(1, strUserAgent, "TurnitinBot", 1) Then
strBrowserUserType = "Turnitin"
'InternetSeer search engine robot
ElseIf inStr(1, strUserAgent, "internetseer", 1) Then
strBrowserUserType = "InternetSeer"
'NameProtect Inc. search engine robot
ElseIf inStr(1, strUserAgent, "nameprotect", 1) Then
strBrowserUserType = "NameProtect"
'PhpDig search engine robot
ElseIf inStr(1, strUserAgent, "PhpDig", 1) Then
strBrowserUserType = "PhpDig"
'Rambler search engine robot
ElseIf inStr(1, strUserAgent, "StackRambler", 1) Then
strBrowserUserType = "Rambler"
'UbiCrawler search engine robot
ElseIf inStr(1, strUserAgent, "UbiCrawler", 1) Then
strBrowserUserType = "UbiCrawler"
'entireweb search engine robot
ElseIf inStr(1, strUserAgent, "Speedy+Spider", 1) Then
strBrowserUserType = "entireweb"
'Alexa.com search engine robot
ElseIf inStr(1, strUserAgent, "ia_archiver", 1) Then
strBrowserUserType = "Alexa"
'Arianna/Libero search engine robot
ElseIf inStr(1, strUserAgent, "arianna.libero.it", 1) Then
strBrowserUserType = "Arianna/Libero"
'y2bot/1.0 (+http://bot.y2crack4.com) search engine robot
ElseIf inStr(1, strUserAgent, "y2bot", 1) Then
strBrowserUserType = "y2bot"
'Internet Explorer
ElseIf inStr(1, strUserAgent, "MSIE 8", 1) Then
strBrowserUserType = "IE 8"
ElseIf inStr(1, strUserAgent, "MSIE 7", 1) Then
strBrowserUserType = "IE 7"
ElseIf inStr(1, strUserAgent, "MSIE 6", 1) Then
strBrowserUserType = "IE 6"
ElseIf inStr(1, strUserAgent, "MSIE 5", 1) Then
strBrowserUserType = "IE 5"
ElseIf inStr(1, strUserAgent, "MSIE 4", 1) Then
strBrowserUserType = "IE 4"
ElseIf inStr(1, strUserAgent, "MSIE", 1) Then
strBrowserUserType = "IE"
'Pocket Internet Explorer
ElseIf inStr(1, strUserAgent, "MSPIE", 1) Then
strBrowserUserType = "Pocket IE"
'Firefox
ElseIf inStr(1, strUserAgent, "Gecko", 1) AND inStr(1, strUserAgent, "Firefox/1", 1) Then
strBrowserUserType = "Firefox 1"
ElseIf inStr(1, strUserAgent, "Gecko", 1) AND inStr(1, strUserAgent, "Firefox/2", 1) Then
strBrowserUserType = "Firefox 2"
ElseIf inStr(1, strUserAgent, "Gecko", 1) AND inStr(1, strUserAgent, "Firefox/3", 1) Then
strBrowserUserType = "Firefox 3"
ElseIf inStr(1, strUserAgent, "Gecko", 1) AND inStr(1, strUserAgent, "Firefox/4", 1) Then
strBrowserUserType = "Firefox 4"
ElseIf inStr(1, strUserAgent, "Gecko", 1) AND inStr(1, strUserAgent, "Firefox", 1) Then
strBrowserUserType = "Firefox"
'Mozilla
ElseIf inStr(1, strUserAgent, "Gecko", 1) AND inStr(1, strUserAgent, "rv:2", 1) AND inStr(1, strUserAgent, "Netscape", 1) = 0 Then
strBrowserUserType = "Mozilla 2"
ElseIf inStr(1, strUserAgent, "Gecko", 1) AND inStr(1, strUserAgent, "rv:1", 1) AND inStr(1, strUserAgent, "Netscape", 1) = 0 Then
strBrowserUserType = "Mozilla 1"
ElseIf inStr(1, strUserAgent, "Gecko", 1) AND inStr(1, strUserAgent, "rv:0", 1) AND inStr(1, strUserAgent, "Netscape", 1) = 0 Then
strBrowserUserType = "Mozilla"
'Netscape
ElseIf inStr(1, strUserAgent, "Netscape/9", 1) Then
strBrowserUserType = "Netscape 9"
ElseIf inStr(1, strUserAgent, "Netscape/8", 1) Then
strBrowserUserType = "Netscape 8"
ElseIf inStr(1, strUserAgent, "Netscape/7", 1) Then
strBrowserUserType = "Netscape 7"
ElseIf inStr(1, strUserAgent, "Netscape6", 1) Then
strBrowserUserType = "Netscape 6"
ElseIf inStr(1, strUserAgent, "Mozilla/4", 1) Then
strBrowserUserType = "Netscape 4"
'Else unknown or robot
Else
strBrowserUserType = "Unknown"
End If
'Return function
BrowserType = strBrowserUserType
End Function
'******************************************
'*** Get OS Type *****
'******************************************
Private Function OSType ()
Dim strUserAgent 'Holds info on the users browser and os
Dim strOS 'Holds the users OS
'Get the users HTTP user agent (web browser)
strUserAgent = Request.ServerVariables("HTTP_USER_AGENT")
'Get users OS
'Windows
If inStr(1, strUserAgent, "Windows 2003", 1) Or inStr(1, strUserAgent, "NT 5.2", 1) Then
strOS = "Windows 2003"
ElseIf inStr(1, strUserAgent, "Windows Vista", 1) Or inStr(1, strUserAgent, "NT 6.0", 1) Then
strOS = "Windows Vista"
ElseIf inStr(1, strUserAgent, "Windows XP", 1) Or inStr(1, strUserAgent, "NT 5.1", 1) Then
strOS = "Windows XP"
ElseIf inStr(1, strUserAgent, "Windows 2000", 1) Or inStr(1, strUserAgent, "NT 5", 1) Then
strOS = "Windows 2000"
ElseIf inStr(1, strUserAgent, "Windows NT", 1) Or inStr(1, strUserAgent, "WinNT", 1) Then
strOS = "Windows NT 4"
ElseIf inStr(1, strUserAgent, "Windows 95", 1) Or inStr(1, strUserAgent, "Win95", 1) Then
strOS = "Windows 95"
ElseIf inStr(1, strUserAgent, "Windows ME", 1) Or inStr(1, strUserAgent, "Win 9x 4.90", 1) Then
strOS = "Windows ME"
ElseIf inStr(1, strUserAgent, "Windows 98", 1) Or inStr(1, strUserAgent, "Win98", 1) Then
strOS = "Windows 98"
ElseIf Instr(1, strUserAgent, "Windows CE", 1) Then
strOS = "Windows CE"
'PalmOS
ElseIf inStr(1, strUserAgent, "PalmOS", 1) Then
strOS = "Palm OS"
'PalmPilot
ElseIf inStr(1, strUserAgent, "Elaine", 1) Then
strOS = "PalmPilot"
'Nokia
ElseIf inStr(1, strUserAgent, "Nokia", 1) Then
strOS = "Nokia"
'Linux
ElseIf inStr(1, strUserAgent, "Linux", 1) Then
strOS = "Linux"
'Amiga
ElseIf inStr(1, strUserAgent, "Amiga", 1) Then
strOS = "Amiga"
'Solaris
ElseIf inStr(1, strUserAgent, "Solaris", 1) Then
strOS = "Solaris"
'SunOS
ElseIf inStr(1, strUserAgent, "SunOS", 1) Then
strOS = "Sun OS"
'BSD
ElseIf inStr(1, strUserAgent, "BSD", 1) or inStr(1, strUserAgent, "FreeBSD", 1) Then
strOS = "Free BSD"
'Unix
ElseIf inStr(1, strUserAgent, "Unix", 1) OR inStr(1, strUserAgent, "X11", 1) Then
strOS = "Unix"
'AOL webTV
ElseIf inStr(1, strUserAgent, "AOLTV", 1) OR inStr(1, strUserAgent, "AOL_TV", 1) Then
strOS = "AOL TV"
ElseIf inStr(1, strUserAgent, "WebTV", 1) Then
strOS = "Web TV"
'Machintosh
ElseIf inStr(1, strUserAgent, "Mac OS X", 1) Then
strOS = "Mac OS X"
ElseIf inStr(1, strUserAgent, "Mac_PowerPC", 1) or Instr(1, strUserAgent, "PPC", 1) Then
strOS = "Mac PowerPC"
ElseIf inStr(1, strUserAgent, "Mac", 1) or inStr(1, strUserAgent, "apple", 1) Then
strOS = "Macintosh"
'OS/2
ElseIf inStr(1, strUserAgent, "OS/2", 1) Then
strOS = "OS/2"
'Search Robot
ElseIf inStr(1, strUserAgent, "Googlebot", 1) OR inStr(1, strUserAgent, "Mediapartners-Google", 1) OR inStr(1, strUserAgent, "ZyBorg", 1) OR inStr(1, strUserAgent, "slurp", 1) OR inStr(1, strUserAgent, "Scooter", 1) OR inStr(1, strUserAgent, "Robozilla", 1) OR inStr(1, strUserAgent, "Jeeves", 1) OR inStr(1, strUserAgent, "lycos", 1) OR inStr(1, strUserAgent, "ArchitextSpider", 1) OR inStr(1, strUserAgent, "Gulliver", 1) OR inStr(1, strUserAgent, "crawler@fast", 1) OR inStr(1, strUserAgent, "TurnitinBot", 1) OR inStr(1, strUserAgent, "internetseer", 1) OR inStr(1, strUserAgent, "nameprotect", 1) OR inStr(1, strUserAgent, "PhpDig", 1) OR inStr(1, strUserAgent, "StackRambler", 1) OR inStr(1, strUserAgent, "UbiCrawler", 1) OR inStr(1, strUserAgent, "Spider", 1) OR inStr(1, strUserAgent, "ia_archiver", 1) OR inStr(1, strUserAgent, "msnbot", 1) OR inStr(1, strUserAgent, "arianna.libero.it", 1) OR inStr(1, strUserAgent, "y2bot", 1) Then
strOS = "Search Robot"
Else
strOS = "Unknown"
End If
'Return function
OSType = strOS
End Function
'******************************************
'*** DB Topic/Post Count Update *****
'******************************************
Private Function updateForumStats(ByVal intForumID)
Dim rsStats 'Database recordset
Dim lngNumberOfTopics 'Holds the number of topics
Dim lngNumberOfPosts 'Holds the number of posts
Dim lngLastPostAuthorID 'Holds the last post author ID
Dim dtmLastPostPostDate 'Holds the last post date
Dim strDate 'Holds the date for SQL Server
Dim lngLastTopicID 'Holds the last topic ID
'Intilaise variables
lngNumberOfTopics = 0
lngNumberOfPosts = 0
lngLastPostAuthorID = 1
dtmLastPostPostDate = 0
lngLastTopicID = 0
'Intialise the ADO recordset object
Set rsStats = Server.CreateObject("ADODB.Recordset")
With rsStats
'Get the number of Topics
'Initalise the strSQL variable with an SQL statement to query the database to count the number of topics in the forums
strSQL = "SELECT Count(" & strDbTable & "Topic.Forum_ID) AS Topic_Count " & _
"From " & strDbTable & "Topic " & strDBNoLock & " " & _
"WHERE " & strDbTable & "Topic.Forum_ID = " & intForumID & " " & _
"AND " & strDbTable & "Topic.Hide = " & strDBFalse & ";"
'Query the database
.Open strSQL, adoCon
'Read in the number of Topics
If NOT .EOF Then lngNumberOfTopics = CLng(.Fields("Topic_Count"))
'Close the rs
.Close
'Get the number of Posts
'Initalise the strSQL variable with an SQL statement to query the database to count the number of posts in the forums
strSQL = "SELECT Count(" & strDbTable & "Thread.Thread_ID) AS Thread_Count " & _
"FROM " & strDbTable & "Topic" & strDBNoLock & ", " & strDbTable & "Thread" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Topic.Topic_ID = " & strDbTable & "Thread.Topic_ID " & _
"AND " & strDbTable & "Topic.Forum_ID = " & intForumID & " " & _
"AND " & strDbTable & "Thread.Hide = " & strDBFalse & ";"
'Query the database
.Open strSQL, adoCon
'Get the thread count
If NOT .EOF Then lngNumberOfPosts = CLng(.Fields("Thread_Count"))
'Reset server variables
.Close
'Get the last post author ID and post date
strSQL = "SELECT" & strDBTop1 & " " & strDbTable & "Topic.Topic_ID, " & strDbTable & "Thread.Author_ID, " & strDbTable & "Thread.Message_date " & _
"FROM " & strDbTable & "Topic" & strDBNoLock & ", " & strDbTable & "Thread" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Topic.Topic_ID = " & strDbTable & "Thread.Topic_ID " & _
"AND " & strDbTable & "Topic.Forum_ID = " & intForumID & " " & _
"AND " & strDbTable & "Thread.Hide = " & strDBFalse & " " & _
"ORDER BY " & strDbTable & "Thread.Message_date DESC" & strDBLimit1 & ";"
'Query the database
.Open strSQL, adoCon
'Get the thread count
If NOT .EOF Then
lngLastTopicID = CLng(.Fields("Topic_ID"))
lngLastPostAuthorID = CLng(.Fields("Author_ID"))
dtmLastPostPostDate = CDate(.Fields("Message_date"))
End If
'Reset server variables
.Close
'Get the date of last post in correct format
strDate = internationalDateTime(dtmLastPostPostDate)
'Remove '-' from SQL Server date for backward compatibility with SQL 2000
If strDatabaseType = "SQLServer" Then strDate = Replace(strDate, "-", "", 1, -1, 1)
'Place the date in SQL safe # or '
If strDatabaseType = "Access" Then
strDate = "#" & strDate & "#"
Else
strDate = "'" & strDate & "'"
End If
'Update the database with the new forum statistics
strSQL = "UPDATE " & strDbTable & "Forum" & strRowLock & " " & _
"SET " & strDbTable & "Forum.No_of_topics = " & lngNumberOfTopics & ", " & _
strDbTable & "Forum.No_of_posts = " & lngNumberOfPosts & ", " & _
strDbTable & "Forum.Last_post_author_ID = " & lngLastPostAuthorID & ", " & _
strDbTable & "Forum.Last_post_date = " & strDate & ", " & _
strDbTable & "Forum.Last_topic_ID = " & lngLastTopicID & " " & _
"WHERE " & strDbTable & "Forum.Forum_ID = " & intForumID & ";"
'Write the updated date of last post to the database
adoCon.Execute(strSQL)
End With
'Clean up
Set rsStats = Nothing
End Function
'********************************************
'*** DB Topic Reply Details Update *****
'********************************************
Private Function updateTopicStats(ByVal lngTopicID)
Dim intReplyCount
Dim lngStartPostID
Dim lngLastPostID
'Get the start and last post ID's from the database
strSQL = "SELECT " & strDbTable & "Thread.Thread_ID " & _
"FROM " & strDbTable & "Thread" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Thread.Topic_ID = " & lngTopicID & " " & _
"AND " & strDbTable & "Thread.Hide = " & strDBFalse & " " & _
"ORDER BY " & strDbTable & "Thread.Thread_ID ASC;"
'Set the cursor type property of the record set to Dynamic so we can navigate through the record set
rsCommon.CursorType = 2
'Set set the lock type of the recordset to adLockReadOnly
rsCommon.LockType = 1
'Query the database
rsCommon.Open strSQL, adoCon
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -