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

📄 count.asp

📁 BBS论坛的开发和设计
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
response.Buffer=false
Server.ScriptTimeOut=500000
%>
<!--#Include file = "BBSConfig.asp"-->
<!--#include file="Session.asp"-->
<!--#include file="../INC/Board_Config.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>计数管理</title>
<link href="Style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_callJS(jsStr) { //V2.3
  return eval(jsStr)
}
//-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<%
'---------------------------------------
action = trim(request.QueryString("action"))
SELECT CASE action
	Case "userpostcount"
		Call userpostcount()
	Case "boardpostcount"
		Call boardpostcount()
End SELECT
'=============================
Sub userpostcount()
	if trim(request.Form("Submit")) = "确定" then
		response.Write("<br>&nbsp;&nbsp;正在重新计数,请不要关闭浏览器!")
		set rs = server.CreateObject("adodb.recordset")
		rs.open "select userid,username,threadcount,replycount from JBB_user order by userid asc",conn,1,1
		if not rs.eof then
		for i = 1 to rs.recordCount
			set rs1 = server.CreateObject("adodb.recordset")
			rs1.open "select threadid From JBB_thread where postuserid="&Cint(trim(rs(0))),conn,1,1
			if Not rs.eof then
				userthreadcount = rs1.recordCount
				Conn.ExeCute("update JBB_user set threadcount="&userthreadcount &" where userid="&Cint(trim(rs(0))))
			End if
			rs1.close
			set rs1 = nothing
			'---------------------------------------------------------------------------------------
			set rs2 = server.CreateObject("adodb.recordset")
			rs2.open "select postid From JBB_post where user_id="&Cint(trim(rs(0))),conn,1,1
			if Not rs2.eof then
				Conn.ExeCute("update JBB_user set replycount="&CINT(rs2.recordCount)-CINT(userthreadcount) &" where userid="&Cint(trim(rs(0))))
			End if
			response.Write("<br>&nbsp;&nbsp;<b>"&rs("username")&"</b>&nbsp;主题数:"&userthreadcount&"&nbsp;回复数:"&CINT(rs2.recordCount)-CINT(userthreadcount))
			rs2.close
			set rs2 = nothing
			userthreadcount = 0
		rs.movenext
		next'i
		End if
		response.Write("<br>&nbsp;&nbsp;全部会员重新统计完毕")
		rs.close
		set rs = nothing
	else
%>
<br>
<br>
<br>
<br>
<table width="368" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EFEFE7">
  <tr>
    <td bgcolor="#FFFFFF">
<div align="center">
        <form name="form1" method="post" action="?action=userpostcount">
          <br>
          您确定重新计算各会员发贴与回复数吗?<br>
          <br>
          <input type="submit" name="Submit" value="确定">
        </form>
      </div></td>
  </tr>
</table>
<%
	End if
End Sub
'======================================
Sub boardpostcount()
	if trim(request.Form("Submit")) = "确定" then
		set rs = server.CreateObject("adodb.recordset")
		rs.open "select Boardid,title,threadcount,replycount from JBB_Board order by Boardid asc",conn,1,1
		if not rs.eof then
		for i = 1 to rs.recordCount
			threadcount = 0
			replycount = 0
			Boardid = Cint(trim(rs(0)))
			set rs1 = server.CreateObject("adodb.recordset")
			rs1.open "select threadid From JBB_thread where board_id="&Boardid,conn,1,1
			if Not rs.eof then
				threadcount = rs1.recordCount
			else
				threadcount = 0
			End if
			Conn.ExeCute("update JBB_board set threadcount="&threadcount &" where boardid="&Boardid)
			rs1.close
			set rs1 = nothing
			'---------------------------------------------------------------------------------------
			set rs2 = server.CreateObject("adodb.recordset")
			rs2.open "select postid From JBB_post where board_id="&BoardID,conn,1,1
			if Not rs2.eof then
				replycount = CINT(rs2.recordCount)
				replycount = replycount - CINT(threadcount)
			else
				replycount = 0
			End if
			Conn.ExeCute("update JBB_board set replycount="&replycount &" where boardid="&Boardid)
			rs2.close
			set rs2 = nothing
			response.Write("<br>&nbsp;&nbsp;<b>"&rs("title")&"</b>&nbsp;主题数:"&threadcount&"&nbsp;回复数:"&replycount)
			Board_info BoardID
			Board_Config2 = Application(JBBMasterCookies&"Board_Config"&BoardID)
			Board_Config2(7)=threadcount
			Board_Config2(8)=replycount
			allThreadCount = allThreadCount + threadcount
			allReplyCount = replycount + allReplyCount
			Application.Lock
				Application(JBBMasterCookies&"Board_Config"&BoardID) = Board_Config2
			Application.UnLock
		rs.movenext
		next'i
		postCount2 = Application(JBBMasterCookies&"postCount")
		postCount2(0) = allThreadCount
		postCount2(1) = allReplyCount
		Application.Lock
			Application(JBBMasterCookies&"postCount") = postCount2
		Application.UnLock
		End if
		response.Write("<br>&nbsp;&nbsp;全部版块重新统计完毕,主题总数:"&allThreadCount&"  帖子总数:"&allReplyCount+allThreadCount)
		rs.close
		set rs = nothing
	else
%>
<br>
<br>
<br>
<br>
<table width="368" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EFEFE7">
  <tr>
    <td bgcolor="#FFFFFF">
<div align="center">
        <form name="form1" method="post" action="?action=boardpostcount">
          <br>
          您确定重新计算各版块主题与贴子数吗?<br>
          <br>
          <input type="submit" name="Submit" value="确定">
        </form>
      </div></td>
  </tr>
</table>
<%	
	End if
End Sub
%>
</body>
</html>
<%
set conn=nothing
%>

⌨️ 快捷键说明

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