user_update.asp

来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 162 行

ASP
162
字号
<!--#include file="user_top.asp"-->
<!--#include file="inc/class_blog.asp"-->
<body  style="overflow:hidden;" scroll="no" class="user_iframe">
<%
dim action,blog
action=request("action")
set blog=new class_blog
Server.ScriptTimeOut=999999999
select case action
	case "update_message"
	call update_message
	case "update_blog"
	call update_blog
	case "update_alllog"
	call update_alllog
	case else
	call main()
end select
set blog=nothing
%>
	</body>
</html>
<%
sub main
%>
	<table class='win_update_table' align='center' border='0' cellpadding='0' cellspacing='1'>
		<tr>
			<td colspan='2' class='win_update_table_top'>发布更新静态页面</td>
		</tr>
		<tr>
			<td colspan='2'>当数据和静态页面不同步时,可以手动更新首页文件或统计数据。</td>
		</tr>
		<tr>
			<td class='win_update_table_td'>更新整站首页</td>
			<td><input type="button" value="更新整站首页" onClick="window.location='user_update.asp?action=update_blog'" />
			</td>
		</tr>
		<tr>
			<td class='win_update_table_td'>更新留言板</td>
			<td><input type="button" value="更新留言板"  onclick="window.location='user_update.asp?action=update_message'" />
			</td>
		</tr>
		<tr>
			<td class='win_update_table_td'>更新统计数据</td>
			<td><input type="button" value="更新统计数据" onClick="window.location='user_update.asp?action=update_blog'" /></form>
			</td>
		</tr>
	</table>
	<table class='win_update_table' align='center' border='0' cellpadding='0' cellspacing='1'>
		<tr>
			<td colspan='2' class='win_update_table_top'>重新发布全站</td>
		</tr>
		<tr>
			<td colspan='2'>重新发布全站较耗费系统资源,请谨慎使用!</td>
		</tr>
		<tr>
			<td class='win_update_table_td'>重新发布全站<p class="red"><%If oblog.l_Group(32,0)>0 Then %>
	(每天只能进行<%=oblog.l_Group(32,0)%>次!)<%End If%></p></td>
			<td><input type="button" value="重新发布全站" onClick="window.location='user_update.asp?action=update_alllog'" />
			</td>
		</tr>
	</table>
<%end sub

sub update_message()
	const p=4
	response.Write("<div id=""prompt""><ul>")
	blog.progress_init
	blog.progress int(1/p*100),"读取用户数据..."
	blog.userid=oblog.l_uid
	blog.progress int(2/p*100),"更新留言板..."
	blog.update_message 1
	blog.progress int(3/p*100),"更新最新留言..."
	blog.update_newmessage oblog.l_uid
	blog.progress int(4/p*100),"更新留言完成!"
	response.Write("<li><a href='javascript:history.go(-1)'>&lt;&lt; 返回上一页</a></li></ul></div>")
end sub

sub update_blog()
	dim rsu,rst,n_log,n_comment,n_message,user_upfiles_num
	const p=11
	response.Write("<div id=""prompt""><ul>")
	blog.progress_init
	blog.progress int(1/p*100),"更新全站统计数据..."
	set rsu=oblog.execute("select count(logid) from oblog_log where isdel=0 and isdraft=0 and userid="&oblog.l_uid)
	if not rsu.eof then n_log=rsu(0) else n_log=0
	set rsu=oblog.execute("select count(commentid) from oblog_comment where userid="&oblog.l_uid)
	if not rsu.eof then n_comment=rsu(0) else n_comment=0
	set rsu=oblog.execute("select count(messageid) from oblog_message where userid="&oblog.l_uid)
	if not rsu.eof then n_message=rsu(0) else n_message=0
	oblog.execute("update oblog_user set log_count="&n_log&",comment_count="&n_comment&",message_count="&n_message&" where userid="&oblog.l_uid)
	
	blog.progress int(2/p*100),"更新分类统计数据..."
	set rst=server.createobject("adodb.recordset")
	rst.open "select subjectid,subjectlognum from oblog_subject where userid="&oblog.l_uid,conn,2,2
	while not rst.eof
		set rsu=oblog.execute("select count(logid) from oblog_log where subjectid="&rst("subjectid"))
		if not rsu.eof then rst("subjectlognum")=rsu(0) else rst("subjectlognum")=0
		rst.update
		rst.movenext		
	wend
	rst.close
	set rst=nothing
	set rsu=nothing	
	
	blog.progress int(3/p*100),"读取用户数据..."
	blog.userid=oblog.l_uid
	blog.progress int(4/p*100),"更新首页..."
	blog.update_index 1
	blog.progress int(5/p*100),"更新站点信息文件..."
	blog.update_info oblog.l_uid
	blog.progress int(6/p*100),"生成新日志列表文件..."
	blog.update_newblog(oblog.l_uid)
	blog.progress int(7/p*100),"更新最新留言..."
	blog.update_newmessage oblog.l_uid
	blog.progress int(8/p*100),"生成首页日志分类文件..."
	blog.update_subject(oblog.l_uid)
	blog.progress int(9/p*100),"生成功能页面..."
	blog.CreateFunctionPage
	blog.update_mygroups(oblog.l_uid)
	blog.update_friends(oblog.l_uid)
	blog.progress int(10/p*100),"更新上传文件总数..."
	If Is_Sqldata = 1 Then 
		oblog.execute ("UPDATE oblog_user SET user_upfiles_num = (SELECT count(*) FROM oblog_upfile WHERE userid="&oblog.l_uid & ") WHERE userid="&oblog.l_uid)
	Else 
		Set rsu = oblog.execute ("SELECT count(*) FROM oblog_upfile WHERE userid="&oblog.l_uid )
		user_upfiles_num=RSU(0)
		rsu.close
		oblog.execute ("UPDATE oblog_user set user_upfiles_num = " &user_upfiles_num & " WHERE userid="&oblog.l_uid )
	End if
	blog.progress int(11/p*100),"更新统计数据完成!"
	response.Write("<li><a href='javascript:history.go(-1)'>&lt;&lt; 返回上一页</a></li></ul></div>")
end sub

sub update_alllog()
	dim updateblognum,lastlogid
	lastlogid=trim(request("lastlogid"))
	if lastlogid<>"" then lastlogid=clng(lastlogid) else lastlogid=0
	updateblognum=request.Cookies(cookies_name&"uplognum")("updateblognum")
	if updateblognum="" or isnull(updateblognum) then updateblognum=0
	'If Is_Debug=1 Then updateblognum=0
	If Int(oblog.l_Group(32,0))=0 Then
		updateblognum=0
	Else
		if clng(updateblognum)>=Int(oblog.l_Group(32,0)) and lastlogid=0 then
			oblog.adderrstr("整站更新每天只能进行"&oblog.l_Group(32,0)&"次!")
			oblog.showusererr
			exit sub
		end if
	End if
	if lastlogid=0 then
		if cookies_domain<>"" then Response.Cookies(cookies_name).Domain=cookies_domain
		Response.Cookies(cookies_name&"uplognum")("updateblognum")=updateblognum+1
		Response.Cookies(cookies_name&"uplognum").Expires=Date+1
	end if
	response.Write("<div id=""prompt""><ul>")
	blog.progress_init
	blog.update_alllog oblog.l_uid
	response.Write("<li><a href='user_update.asp'>&lt;&lt; 返回上一页</a></li></ul></div>")
end sub

%>

⌨️ 快捷键说明

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