📄 basic.asp
字号:
end sub
sub execlean
application.contents.removeall
call suc("","更新缓存成功","?action=updatebbs")
end sub
sub updatebbsdate
dim essaynum,topicnum,newuser,todaynum,usernum,alltable,i
usernum=yxbbs.execute("select count(id) from[yx_user]")(0)
newuser=yxbbs.execute("select top 1 name from [yx_user] order by id desc")(0)
alltable=split(yxbbs.bbstable(0),",")
for i=0 to ubound(alltable)
essaynum=essaynum+yxbbs.execute("select count(bbsid) from[yx_bbs"&alltable(i)&"] where isdel=false")(0)
todaynum=todaynum+yxbbs.execute("select count(bbsid) from[yx_bbs"&alltable(i)&"] where isdel=false and datediff('d',lasttime,'"&yxbbs.nowbbstime&"')<1")(0)
next
topicnum=yxbbs.execute("select count(topicid) from[yx_topic]")(0)
yxbbs.execute("update [yx_config] set usernum="&usernum&",allessaynum="&essaynum&",topicnum="&topicnum&",todaynum="&todaynum&",newuser='"&newuser&"'")
call suc("论坛系统整理成功","论坛系统整理成功,整理后:<li>总帖数:"&essaynum&" | 主题数:"&topicnum&" | 今日帖数:"&todaynum&" | 注册用户数:"&usernum&" | 最新注册用户:"&newuser&"","?action=updatebbs")
cache.name="config"
cache.clean()
end sub
sub updatetopic
dim caption,content,id1,id2,lastreply,go,replynum,alltable,i,temp,maxid
id1=yxbbs.fun.getstr("id1")
id2=yxbbs.fun.getstr("id2")
maxid=yxbbs.execute("select max(topicid)from [yx_topic]")(0)
if id1="" then
id1=1:id2=100
go= " 开始整理 "
else
if not isnumeric(id1) or not isnumeric(id2) then call goback("","<li>请用数字填写!"):exit sub
set rs=yxbbs.execute("select topicid,sqltableid from [yx_topic] where topicid>="&id1&" and topicid<="&id2&"")
if rs.eof then
if int(id2) < int(maxid) then
call goback("数据据中没有数据","在id:<font color=red>"&id1&"</font> 至 <font color=red>"&id2&"</font> 之间不存在帖子,请把结束id的数字填大一些。")
else
call suc("整理结束","全部整理成功!","?action=updatebbs")
end if
exit sub
end if
alltable=split(yxbbs.bbstable(0),",")
do while not rs.eof
for i=0 to ubound(alltable)
if int(rs(1))=int(alltable(i)) then
replynum=yxbbs.execute("select count(bbsid) from [yx_bbs"&rs(1)&"] where isdel=false and replytopicid="&rs(0)&"")(0)
yxbbs.execute("update [yx_topic] set replynum="&replynum&" where topicid="&rs(0)&"")
exit for
end if
next
rs.movenext
loop
rs.close
temp=id1
id1=int(id2)+1
id2=int(id2)+int(id2)-int(temp)+1
go=" 继续整理 "
end if
caption="主题帖子整理"
content="<div style=""height:109px;text-align: left;""><form method=post action='?action=updatetopic' onsubmit='ok.disabled=true;ok.value=""正在整理-请稍等...""'>请填写你要整理的帖子的开始id和结束id:(两者之间不要相差太大)<br />你的论坛帖子最大的 id 为:"&maxid&"<br />初始id:<input type=text name='id1' size=20 value="&id1&"><br />结束id:<input type=text name='id2' size=20 value="&id2&"><br /><input type=submit name='ok' value="&go&"><input type=reset value=' 重 置 '> </p></form></div>"
call showtable(caption,content)
end sub
sub updatealluser
dim caption,content,id1,id2,gradenum,goodnum,essaynum,ug,go,alltable,i,temp,maxid
id1=yxbbs.fun.getstr("id1"):id2=yxbbs.fun.getstr("id2")
maxid=yxbbs.execute("select max(id)from [yx_user]")(0)
if id1="" then
id1=1:id2=100
go= " 开始整理 "
else
if not isnumeric(id1) or not isnumeric(id2) then call goback("","<li>请用数字填写!"):exit sub
set rs=yxbbs.execute("select name,classid from [yx_user] where id>="&id1&" and id<="&id2&"")
if rs.eof then
if int(id2) < int(maxid) then
call goback("数据据中没有数据","在id:<font color=red>"&id1&"</font> 至 <font color=red>"&id2&"</font> 之间不存在用户,请把结束id的数字填大一些。")
else
call suc("整理结束","全部整理成功!","?action=updatebbs")
end if
exit sub
end if
alltable=split(yxbbs.bbstable(0),",")
do while not rs.eof
essaynum=0
goodnum=0
for i=0 to ubound(alltable)
essaynum=essaynum+yxbbs.execute("select count(bbsid) from [yx_bbs"&alltable(i)&"] where name='"&rs(0)&"'")(0)
next
goodnum=yxbbs.execute("select count(topicid) from [yx_topic] where name='"&rs(0)&"' and isgood=true")(0)
set ug=yxbbs.execute("select top 1 gradenum from yx_usergrade where classid="&rs(1)&" and userminpostnum<="&essaynum&" order by userminpostnum desc")
if not ug.eof then
gradenum=ug(0)
end if
ug.close
set ug=nothing
yxbbs.execute("update [yx_user] set essaynum="&essaynum&",goodnum="&goodnum&",gradenum="&gradenum&" where name='"&rs(0)&"'")
rs.movenext
loop
rs.close
temp=id1
id1=int(id2)+1
id2=int(id2)+int(id2)-int(temp)+1
go=" 继续整理 "
end if
caption="用户整理修复"
content="<form method=post action='?action=updatealluser' onsubmit='ok.disabled=true;ok.value=""正在整理-请稍等...""'><div style=""height:109px;text-align: left;"">请填写你要整理用户的开始id和结束id:(两者之间不要相差太大)<br />论坛注册用户最大的 id 为:"&maxid&"<br />初始id:<input type=text name='id1' size=20 value="&id1&"><br />结束id:<input type=text name='id2' size=20 value="&id2&"><br /><input name='ok' type=submit value="&go&" ><input type=reset value=' 重 置 '> </p></div></form>"
call showtable(caption,content)
end sub
sub delwuiong
dim ii,i,alltable%>
<div class="ta">
<div class="th jz">论坛垃圾清理</div>
<div class="tf jz h75" style="text-align: left;"><b><span id=YxBBsT name=YxBBsT>正在清理无效主题!请稍等...</span></b><br /><img src="../images/hr.gif" width=0 height=16 id=YxBBsimg name=YxBBsimg align=absmiddle /><br /><span id=YxBBstxt name=YxBBstxt style="font-size:9pt">0</span><span style="font-size:9pt">%</span></div>
</div>
<%response.flush
alltable=split(yxbbs.bbstable(0),",")
for i=0 to ubound(alltable)
yxbbs.execute("delete * from [yx_bbs"&alltable(i)&"] where topicid<>0 and not exists (select name from [yx_topic] where [yx_bbs"&alltable(i)&"].topicid=[yx_topic].topicid)")
yxbbs.execute("delete * from [yx_topic] where sqltableid="&alltable(i)&" and not exists (select name from [yx_bbs"&alltable(i)&"] where [yx_topic].topicid=[yx_bbs"&alltable(i)&"].topicid)")
next
call table("无效主题清理完毕!","")
call picpro(1,6,"正在清理无效投票!请稍等...")
yxbbs.execute("delete * from [yx_topicvote] where not exists (select name from [yx_topic] where [yx_topicvote].topicid=[yx_topic].topicid)")
yxbbs.execute("delete * from [yx_topicvoteuser] where not exists (select name from [yx_topic] where [yx_topicvoteuser].topicid=[yx_topic].topicid)")
call table("无效投票清理完毕!","")
call picpro(2,6,"正在清理无效留言!请稍等...")
yxbbs.execute("delete * from [yx_sms] where not exists (select name from [yx_user] where [yx_sms].myname=[yx_user].name)")
call table("无效留言清理完毕!","")
call picpro(3,6,"正在清理删除用户的帖子!请稍等...")
for i=0 to ubound(alltable)
yxbbs.execute("delete * from [yx_bbs"&alltable(i)&"] where not exists (select name from [yx_user] where [yx_bbs"&alltable(i)&"].name=[yx_user].name)")
next
yxbbs.execute("delete * from [yx_topic] where not exists (select name from [yx_user] where [yx_topic].name=[yx_user].name)")
call table("无效用户的帖子清理完毕!","")
call picpro(4,6,"正在清理无效回复帖子!请稍等...;")
for i=0 to ubound(alltable)
set rs=yxbbs.execute("select replytopicid from [yx_bbs"&alltable(i)&"] where replytopicid<>0")
do while not rs.eof
if yxbbs.execute("select topicid from [yx_bbs"&alltable(i)&"] where topicid="&rs(0)&"").eof then
yxbbs.execute("delete from [yx_bbs"&alltable(i)&"] where replytopicid="&rs(0)&"")
end if
rs.movenext
loop
rs.close
next
call table("无效回复清理完毕!","")
Response.Write "<script>YxBBsimg.width=400;YxBBstxt.innerHTML=""100"";YxBBsT.innerHTML=""<font color=red>成功完成整理!</font>"";</script>"
end sub
'进度条
Sub PicPro(i,sum,strtxt)
Response.Write "<script>YxBBsimg.width=" & Fix((i/sum) * 400) & ";" & VbCrLf
Response.Write "YxBBstxt.innerHTML=""" & FormatNumber(i/sum*100,4,-1) & """;" & VbCrLf
Response.Write "YxBBsT.innerHTML="""& StrTxt & """;"& VbCrLf
Response.Write "</script>" & VbCrLf
Response.Flush
End Sub
sub boardupdate
%>
<div class="ta">
<div class="th jz">论坛版面整理</div>
<div class="tf jz h75" style="text-align: left;"><b><span id=YxBBsT name=YxBBsT>数据版面正在整理,请稍等</span></b><br /><img src="../images/hr.gif" width=0 height=16 id=YxBBsimg name=YxBBsimg align=absmiddle><br /><span id=YxBBstxt name=YxBBstxt style="font-size:9pt">0</span><span style="font-size:9pt">%</span></div>
</div>
<%response.flush
dim boardnum,essaynum,topicnum,todaynum,parentstr,lastreply,lastcaption
dim alltable,i,ii,iii,sql
boardnum=yxbbs.execute("select count(boardid) from[yx_board] where parentid<>0")(0)
ii=0
set rs=yxbbs.execute("select boardid,boardname,child,parentstr,rootid from[yx_board] where parentid<>0 order by child,rootid,orders desc")
if not rs.eof then
sql=rs.getrows()
rs.close
for i=0 to ubound(sql,2)
essaynum=0
topicnum=0
todaynum=0
lastreply=""
lastcaption="无"
alltable=split(yxbbs.bbstable(0),",")
for iii=0 to ubound(alltable)
essaynum=essaynum+yxbbs.execute("select count(*) from[yx_bbs"&alltable(iii)&"] where boardid="&sql(0,i)&" and isdel=false")(0)
todaynum=todaynum+yxbbs.execute("select count(*) from[yx_bbs"&alltable(iii)&"] where boardid="&sql(0,i)&" and isdel=false and datediff('d',[lasttime],'"&yxbbs.nowbbstime&"')<1")(0)
next
topicnum=yxbbs.execute("select count(topicid) from[yx_topic] where boardid="&sql(0,i)&" and isdel=false")(0)
set rs=yxbbs.execute("select top 1 topicid,name,caption,addtime,face,sqltableid,boardid from [yx_topic] where isdel=false and boardid="&sql(0,i)&" order by topicid desc")
if not rs.eof then
lastcaption=replace(yxbbs.fun.strleft(rs("caption"),20),"'","'")
lastreply=rs("name")&"|"&lastcaption&"|"&rs("addtime")&"|"&rs("face")&"|"&rs("topicid")&"|"&rs("boardid")&"|"&rs("sqltableid")&""
end if
rs.close
yxbbs.execute("update [yx_board] set essaynum="&essaynum&",todaynum="&todaynum&",topicnum="&topicnum&",lastreply='"&lastreply&"' where boardid="&sql(0,i)&"")
'如果有上级论坛,那么更新上级论坛
if sql(2,i)>0 then
parentstr=sql(3,i) & "," & sql(0,i)
set rs=yxbbs.execute("select sum(essaynum),sum(topicnum),sum(todaynum) from [yx_board] where parentstr = '"&parentstr&"'")
if not isnull(rs(0)) then essaynum = rs(0) + essaynum
if not isnull(rs(1)) then topicnum = rs(1) + topicnum
if not isnull(rs(2)) then todaynum = rs(2) + todaynum
rs.close
set rs=yxbbs.execute("select top 1 topicid,name,caption,addtime,face,sqltableid,boardid from [yx_topic] where isdel=false and boardid in ("&parentstr&") order by lasttime desc")
if not rs.eof then
lastcaption=replace(yxbbs.fun.strleft(rs("caption"),20),"'","'")
lastreply=rs("name")&"|"&lastcaption&"|"&rs("addtime")&"|"&rs("face")&"|"&rs("topicid")&"|"&rs("boardid")&"|"&rs("sqltableid")&""
end if
rs.close
yxbbs.execute("update [yx_board] set essaynum="&essaynum&",todaynum="&todaynum&",topicnum="&topicnum&",lastreply='"&lastreply&"' where boardid="&sql(0,i)&"")
end if
call table("论坛 <font color=blue>"&sql(1,i)&"</font> 整理成功","总帖数"&essaynum&" | 主题数:"&topicnum&" | 今日帖:"&todaynum&" | 最新主题:"&lastcaption&"")
ii=ii+1
Response.Write "<script>YxBBsimg.width=" & Fix((ii/BoardNum) * 400) & ";" & VbCrLf
Response.Write "YxBBstxt.innerHTML=""" & FormatNumber(ii/BoardNum*100,4,-1) & """;" & VbCrLf
Response.Write "</script>" & VbCrLf
response.flush
next
end if
Response.Write "<script>YxBBsimg.width=400;YxBBstxt.innerHTML=""100"";YxBBsT.innerHTML=""<font color=red>成功完成整理!</font>"";</script>"
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -