📄 forum.asp
字号:
<%
'#############################################################
'# 中国在线--极酷论坛 ver.2001 3.0
'#
'# 版权所有: 中国在线 (ChinaXP.Net)
'#
'# 制作人 : 周周 (SeeYa!)
'#
'#
'# 主页地址: http://www.ChinaXP.net/ 中国在线
'# http://www.ChinaXP.Net/bbs/ 中国在线--极酷论坛
'#
'#############################################################
%>
<%
if Request.QueryString("FORUM_ID") = "" and (Request.Form("Method_Type") <> "login") and (Request.Form("Method_Type") <> "logout") then
Response.Redirect "Default.asp"
end if
%>
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_functions.asp" -->
<!--#INCLUDE FILE="inc_functions2.asp" -->
<%
Dim strFolderImg
Randomize
strFolderImg = (Int(5 * Rnd)) ' ### 产生随机数
If Request("whichpage") = "" or Request("whichpage") <= 0 then
mypage = 1
Else
mypage = CINT(Request("whichpage"))
End If
'############################################
sortorder = request.Form("newsort")
SortImg = request.Form("sortimg")
if sortorder <> "" then
mypage = 1
else
sortorder = request.Form("sort")
end if
'############################################
nDays = Request.Cookies(strCookieURL & "NumDays")
OlderThan = Request.Cookies(strCookieURL & "OlderThan") 'HuwR
if Request.form("cookie") = 1 then
if strSetCookieToForum = "1" then
Response.Cookies(strCookieURL & "NumDays").Path = strCookieURL
Response.Cookies(strCookieURL & "OlderThan").Path = strCookieURL
end if
Response.Cookies(strCookieURL & "NumDays") = Request.Form("days")
Response.Cookies(strCookieURL & "NumDays").expires = strForumTimeAdjust + 365
Response.Cookies(strCookieURL & "OlderThan") = Request.Form("OlderThan")
Response.Cookies(strCookieURL & "OlderThan").expires = strForumTimeAdjust + 365
OlderThan = Request.Form("OlderThan")
nDays = Request.Form("Days")
mypage = 1
end if
if nDays = "" then
nDays = 0
end if
defDate = DateToStr(dateadd("d", -(nDays), StrToDate(strForumTimeAdjust)))
if (strAuthType = "nt") then
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
call NTauthenticate()
if (ChkAccountReg() = "1") then
call NTUser()
end if
end if
%>
<!--#INCLUDE FILE="inc_top.asp" -->
<%
if strPrivateForums = "1" then
if Request("Method_Type") = "" and (mLev <> 4) then
chkUser4()
end if
end if
if (mLev = 4) or (chkForumModerator(Request.QueryString("FORUM_ID"), STRdbntUserName)= "1") or (lcase(strNoCookies) = "1") then
AdminAllowed = 1
else
AdminAllowed = 0
end if
'## Forum_SQL - Find out if the Category is Locked or Un-Locked and if it Exists
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_STATUS "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY "
strSql = strSql & " WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & Request.QueryString("CAT_ID")
set rsCStatus = my_Conn.Execute (StrSql)
'## Forum_SQL - Find out if the Topic is Locked or Un-Locked and if it Exists
strSql = "SELECT " & strTablePrefix & "FORUM.F_STATUS, " & strTablePrefix & "FORUM.F_PRIVATEFORUMS, "
strSql = strSql & strTablePrefix & "FORUM.F_SUBJECT "
strSql = strSql & " FROM " & strTablePrefix & "FORUM "
strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Request.QueryString("FORUM_ID")
set rsFStatus = my_Conn.Execute (StrSql)
strPrivateForums = rsFStatus("F_PRIVATEFORUMS")
strSubForumTitle = rsFStatus("F_SUBJECT")
'###############################################
Dim objConn, strConn, CheckInTime, User, Timedout, Date
Dim objRS, strSQL, houron, minon, Datec
Dim OnlineLocation
OnlineLocation = "<a href=""Link.asp?FORUM_ID=" & Request.QueryString("FORUM_ID") & """>" & strSubForumTitle & "</a>"
UserIP = Request.ServerVariables("REMOTE_ADDR")
if Request.cookies("User")("Name") = "" then
' ### Request.ServerVariables("REMOTE_ADDR") ###
User = "Guest"
else
User = Request.cookies("User")("Name")
end if
Date = DateToStr(strForumTimeAdjust)
strSql = "SELECT " & strTablePrefix & "ONLINE.UserID "
strSql = strSql & " FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE " & strTablePrefix & "ONLINE.UserID = '" & user & "'"
' set rsWho = my_Conn.Execute (strSql)
strSQL = "UPDATE " & strTablePrefix & "ONLINE SET M_BROWSE = '" & OnlineLocation & "' , DateCreated = '" & Date & "' WHERE UserID = '" & User & "' OR UserIP = '" & UserIP & "'"
my_Conn.Execute strSQL
'### CheckInTime = DateDiff( "s", CDate("01/01/1970"), Now)
'### TimedOut = CheckInTime - 2700 ' ### 时间到,将该会员从在线会员中删除time out the user
'### strSQL = "DELETE FROM " & strTablePrefix & "ONLINE WHERE CheckedIn < '" & TimedOut & "'"
'### my_Conn.Execute strSQL
Set OnlineLocation = Nothing
'###############################################
'## Forum_SQL - Get all topics from DB
strSql ="SELECT " & strTablePrefix & "TOPICS.T_STATUS, " & strTablePrefix & "TOPICS.CAT_ID, "
strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID, " & strTablePrefix & "TOPICS.TOPIC_ID, "
strSql = strSql & strTablePrefix & "TOPICS.T_VIEW_COUNT, " & strTablePrefix & "TOPICS.T_SUBJECT, "
strSql = strSql & strTablePrefix & "TOPICS.T_MAIL, " & strTablePrefix & "TOPICS.T_AUTHOR, " & strTablePrefix & "TOPICS.T_FACE, "
strSql = strSql & strTablePrefix & "TOPICS.T_REPLIES, " & strTablePrefix & "TOPICS.T_LAST_POST, "
strSql = strSql & strTablePrefix & "TOPICS.T_LAST_POST_AUTHOR, " & strTablePrefix & "TOPICS.T_INPLACE, "
strSql = strSql & strTablePrefix & "TOPICS.T_BEST, " & strTablePrefix & "TOPICS.T_FILEID, " & strTablePrefix & "TOPICS.T_FILENAME, "
strSql = strSql & strMemberTablePrefix & "MEMBERS.M_NAME, "
strSql = strSql & strMemberTablePrefix & "MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, "
strSql = strSql & strTablePrefix & "TOPICS, "
strSql = strSql & strMemberTablePrefix & "MEMBERS AS " & strMemberTablePrefix & "MEMBERS_1 "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "TOPICS.T_AUTHOR "
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_LAST_POST_AUTHOR = "& strMemberTablePrefix & "MEMBERS_1.MEMBER_ID "
strSql = strSql & " AND " & strTablePrefix & "TOPICS.FORUM_ID = " & Request.QueryString("FORUM_ID") & " "
if lCase(Request.Querystring("MODE"))="best" then
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_BEST = 1 "
end if
if nDays = "-1" then
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS <> 0 "
end if
if nDays > "0" then
if OlderThan = "1" then
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_LAST_POST < '" & defDate & "'"
else
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_LAST_POST > '" & defDate & "'"
end if
end if
strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_INPLACE DESC "
'############################################
SELECT CASE sortorder
CASE "1a", "1d"
strSql = strSql & ", " & strTablePrefix & "TOPICS.T_SUBJECT"
CASE "2a", "2d"
strSql = strSql & ", " & strTablePrefix & "TOPICS.T_AUTHOR"
CASE "3a", "3d"
strSql = strSql & ", " & strTablePrefix & "TOPICS.T_REPLIES"
CASE "4a", "4d"
strSql = strSql & ", " & strTablePrefix & "TOPICS.T_VIEW_COUNT"
CASE "5a", "5d"
strSql = strSql & ", " & strTablePrefix & "TOPICS.T_LAST_POST"
CASE else
strSql = strSql & ", " & strTablePrefix & "TOPICS.T_LAST_POST"
End SELECT
If InStr(1, sortorder, "a", 1) Then
strSql = strSql & " ASC"
SortImg = "" & strImageURL & "icon_sortUP.gif"
Else
strSql = strSql & " DESC"
SortImg = "" & strImageURL & "icon_sortDOWN.gif"
End if
'############################################
if strDBType = "mysql" then ' ### MySql 数据库特定代码
if mypage > 1 then
intOffset = CInt((mypage-1) * strPageSize)
strSql = strSql & " LIMIT " & intOffset & ", " & strPageSize & " "
end if
'## Forum_SQL - Get the total pagecount
strSql2 = "SELECT COUNT(" & strTablePrefix & "TOPICS.TOPIC_ID) AS PAGECOUNT "
strSql2 = strSql2 & " FROM " & strTablePrefix & "TOPICS "
strSql2 = strSql2 & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID > 0 "
strSql2 = strSql2 & " AND " & strTablePrefix & "TOPICS.FORUM_ID = " & Request.QueryString("FORUM_ID") & " "
if nDays = "-1" then
strSql2 = strSql2 & " AND " & strTablePrefix & "TOPICS.T_STATUS <> 0 "
end if
if nDays > "0" then
if OlderThan = "1" then
strSql2 = strSql2 & " AND " & strTablePrefix & "TOPICS.T_LAST_POST < '" & defDate & "'"
else
strSql2 = strSql2 & " AND " & strTablePrefix & "TOPICS.T_LAST_POST > '" & defDate & "'"
end if
end if
set rsCount = my_Conn.Execute(strSql2)
if not rsCount.eof then
maxpages = (rsCount("PAGECOUNT") \ strPageSize )
if rsCount("PAGECOUNT") mod strPageSize <> 0 then
maxpages = maxpages + 1
end if
else
maxpages = 0
end if
rsCount.close
set rs = Server.CreateObject("ADODB.Recordset")
' RS.cachesize=20
RS.open strSql, my_Conn, 3
if not (RS.EOF or RS.BOF) then
RS.movefirst
end if
else 'end MySql specific code
set rs = Server.CreateObject("ADODB.Recordset")
' RS.cachesize=20
RS.open strSql, my_Conn, 3
if not (RS.EOF or RS.BOF) then
RS.MoveFirst
RS.PageSize = strPageSize
RS.CacheSize = RS.PageSize
maxPages = cint(RS.PageCount)
maxRecs = cint(RS.PageSize)
If myPage > RS.PageCount Then
myPage = RS.PageCount
end if
RS.AbsolutePage = myPage
StartPageNum=1
do while StartPageNum + 10 <= myPage
StartPageNum = StartPageNum + 10
Loop
EndPageNum = StartPageNum+9
If EndPageNum > RS.Pagecount then EndPageNum = RS.Pagecount
end if
end if
'## Forum_SQL - Get all Forum Categories From DB
'## strSql = "SELECT CAT_ID FROM " & strTablePrefix & "CATEGORY"
'## set rsCat = my_Conn.Execute (StrSql)
'##################################
strForumUrl = Request.ServerVariables("SCRIPT_NAME")
strForumUrl = strForumUrl & "?FORUM_ID=" & Request.Querystring("FORUM_ID")
strForumUrl = strForumUrl & "&CAT_ID=" & Request.Querystring("CAT_ID")
%>
<script language="JavaScript">
<!-----
function jumpTo(s) {if (s.selectedIndex != 0) location.href = s.options[s.selectedIndex].value;return 1;}
function setDays(order)
{
if (order.search('a') > 0)
document.DaysFilter.sortimg.value = '<% Response.Write strImageURL %>icon_sortUp.gif'
else
document.DaysFilter.sortimg.value = '<% Response.Write strImageURL %>icon_sortDown.gif';
if (order != '')
document.DaysFilter.newsort.value = order;
document.DaysFilter.submit();
return 0;
}
// -->
</script>
<script src="Screen.js"></script>
<% if rsCStatus.EOF = true OR rsFStatus.EOF = true then
Response.Redirect("default.asp")
end if %>
<% '################################## %>
<TD width="70%" align="left" valign="top">
<TABLE border="0" width="85%" align=center>
<TR>
<TD width="33%" align="left"><font face="<% Response.Write strDefaultFontFace %>" size="<% Response.Write strDefaultFontSize %>"><a href="default.asp"><img src="<% =strImageURL %>icon_folder_open.gif" alt="返回论坛首页" border="0"> <% =strForumTitle %></a><BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -