⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forumupdate.asp

📁 很好的一个论坛原代码
💻 ASP
字号:
<%
if not session("sfadmin") then response.redirect("welcome.asp")
%>
<!--#INCLUDE FILE="../inc/db_inc.asp"-->
<!--#INCLUDE FILE="../inc/md5_inc.asp"-->
<!--#INCLUDE FILE="../inc/char_inc.asp"-->

<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK rel="stylesheet" href="image/style.css" type="text/css">
</HEAD>

<BODY bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="30">
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open StrConn
%>
<!--#INCLUDE FILE="checkadmin.asp"-->
<%
if request("step") = "2" then

	strforumsql = ""
	if IsNumeric(request("forumid")) then
		forumid = clng(request("forumid"))
		strforumsql = " where forumid=" & forumid
	end if
	strsql = "select count(*) as threadcount from sf_thread" & strforumsql
	Set rs = Conn.Execute(strsql)
	threadcount = rs("threadcount")
	strsql = "select count(*) as postcount from sf_post" & strforumsql
	Set rs = Conn.Execute(strsql)
	postcount = rs("postcount")
	if IsNumeric(request("forumid")) then
		Conn.Execute("update sf_forum set threadcount=" & threadcount & ",postcount=" & postcount & " where forumid=" & request("forumid"))
		StrSql = "select top 1 threadid, username, userid, title from sf_post where forumid = " & forumid & " order by postid DESC"
		Set rs = Conn.Execute(StrSql)
		if not(rs.bof or rs.eof) then
			Conn.Execute("update sf_forum set lastposttitle='" & server.htmlencode(rs("title")) & "', lastpostid=" & rs("threadid") & ", lastposter='" & rs("username") & "', lastposterid=" & rs("userid") & " where forumid = " & forumid)
		else
			Conn.Execute("update sf_forum set lastposttitle='', lastpostid=0,lastposter='', lastposterid=0 where forumid = " & forumid)
		end if
	else
		strsql = "select count(*) as usercount from sf_user"
		Set rs = Conn.Execute(strsql)
		Conn.Execute("update sf_counter set threadnum=" & threadcount & ", postnum=" & postcount & ", usernum=" & rs("usercount"))
	end if
%>
<TABLE width="80%" border="0" cellspacing="1" cellpadding="4" align="center">
  <TR> 
    <TD bgcolor="#D1E3BF" align="center">数据刷新完毕</TD>
  </TR>
</TABLE>
<%
else
	strsql = "select usernum, threadnum, postnum from sf_counter"
	Set rs = Conn.Execute(StrSql)
%>
<FORM name="form1" method="post" action="forumupdate.asp">
<TABLE width="90%" border="0" cellspacing="1" cellpadding="4" align="center">
  <TR> 
    <TD bgcolor="#D1E3BF" align="center"><B>刷新论坛统计数据</B></TD>
  </TR>
  <TR bgcolor="#F5F5F5" align="center"><TD>&nbsp;<br>
  <select name="forumid">
<%
    response.write "<option value=""all"">刷新总体统计(用户数目:" & rs("usernum") & " 主题数目:" & rs("threadnum") & " 帖子数目:" & rs("postnum") & ")</option>"

    strsql = "select sf_forum.forumid, sf_forum.title, sf_forum.postcount, sf_forum.threadcount from sf_forum left join sf_cate on (sf_forum.cateid = sf_cate.cateid) order by sf_cate.displayorder DESC, sf_cate.cateid ASC, sf_forum.displayorder DESC, sf_forum.forumid ASC"
    Set rs = Conn.Execute(strsql)
    if not(rs.bof or rs.eof) then
	do until rs.eof
    		response.write "<option value=""" & rs("forumid") & """> &nbsp; 只刷新版块: " & rs("title") & "(主题数目:" & rs("threadcount") & " 帖子数目:" & rs("postcount") & ")</option>"
    		rs.movenext
    	loop
    end if
%>
  </select><br><br>
  <input type="hidden" name="step" value="2">
  <input type="submit" value="确 定">
  </TD></TR>
</TABLE>
</FORM>
<%
end if
%>
<BR><BR><BR>
</BODY>
</HTML>
<%
Conn.close
Set Conn = nothing
Set rs = nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -