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

📄 admin_postdata.asp

📁 功能强大的一个b/s工作站
💻 ASP
📖 第 1 页 / 共 2 页
字号:
conn.execute("create index search on "&request.form("tablename")&" (boardid,dateandtime,topic,announceid)")

conn.execute("update config set AllPostTable='"&NewAllPostTable&"',AllPostTableName='"&NewAllPostTableName&"'")
response.write "添加表成功,请返回。"
end sub

sub update2()
dim trs
dim ForNum,TopNum
Dim orderby
if request.form("outtablename")=request.form("intablename") then
	Errmsg="<br><li>不能在相同数据表内转移数据。"
	call dvbbs_error()
	exit sub
end if
if (not isnumeric(request.form("selnum"))) or request.form("selnum")="" then
	Errmsg="<br><li>请填写正确的更新数量。"
	call dvbbs_error()
	exit sub
end if
if request.form("top1000")="yes" then
orderby=""
else
orderby=" desc"
end if
TopNum=Clng(request.form("selnum"))
if TopNum>100 then
	ForNum=int(TopNum/100)+1
	TopNum=100
else
	ForNum=1
end if

for i=1 to ForNum
set rs=conn.execute("select top "&TopNum&" topicid from topic where PostTable='"&request.form("outtablename")&"' order by topicid "&orderby&"")
if rs.eof and rs.bof then
	Errmsg="<br><li>您所选择导出的数据表已经没有任何内容"
	call dvbbs_error()
	exit sub
else
	do while not rs.eof
	'读取导出帖子数据表
	set trs=conn.execute("select * from "&request.form("outtablename")&" where rootid="&rs("topicid"))
	if not (trs.eof and trs.bof) then
	do while not trs.eof
	'插入导入帖子数据表
	conn.execute("insert into "&request("intablename")&"(Boardid,ParentID,username,topic,body,DateAndTime,length,rootid,layer,orders,ip,Expression,locktopic,signflag,emailflag,isbest,PostUserID) values ("&trs("boardid")&","&trs("parentid")&",'"&checkstr(trs("username"))&"','"&checkstr(trs("topic"))&"','"&checkstr(trs("body"))&"','"&trs("dateandtime")&"',"&trs("length")&","&trs("rootid")&","&trs("layer")&","&trs("orders")&",'"&trs("ip")&"','"&trs("Expression")&"',"&trs("locktopic")&","&trs("signflag")&","&trs("emailflag")&","&trs("isbest")&","&trs("postuserid")&")")
	'更新主题指定帖子表
	conn.execute("update topic set PostTable='"&request.form("inTableName")&"' where TopicID="&rs("topicid"))
	'删除导出帖子数据表对应数据
	conn.execute("delete from "&request.form("outTableName")&" where AnnounceID="&trs("Announceid"))
	trs.movenext
	loop
	end if
	rs.movenext
	loop
end if
next
set trs=nothing
set rs=nothing
response.write "更新成功!"
end sub

sub search()
dim keyword
dim totalrec
dim n
dim currentpage,page_count,Pcount
currentPage=request("page")
if currentpage="" or not isInteger(currentpage) then
	currentpage=1
else
	currentpage=clng(currentpage)
end if
if request("keyword")="" then
	Errmsg="<br><li>请输入您要查询的关键字。"
	call dvbbs_error()
	exit sub
else
	keyword=replace(request("keyword"),"'","")
end if
if request("username")="yes" then
sql="select * from topic where PostTable='"&request("tablename")&"' and postusername='"&keyword&"' order by LastPostTime desc"
elseif request("topic")="yes" then
sql="select * from topic where PostTable='"&request("tablename")&"' and title like '%"&keyword&"%' order by LastPostTime desc"
else
	Errmsg="<br><li>请选择您查询的方式。"
	call dvbbs_error()
	exit sub
end if
%>
<form method="POST" action="?action=update3">
<input type=hidden name="topic" value="<%=request("topic")%>">
<input type=hidden name="username" value="<%=request("username")%>">
<input type=hidden name="keyword" value="<%=keyword%>">
<input type=hidden name="tablename" value="<%=request("tablename")%>">
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr> 
<td height="23" colspan="6" class=Forumrow><B>说明</B>:<BR>您可以对下列的搜索结果进行转移数据表的操作,不能在相同表内进行转换操作。</td>
</tr>
<tr> 
<th height="23" colspan="6">搜索<%=request("tablename")%>结果</th>
</tr>
<tr> 
<td width="6%" class=forumHeaderBackgroundAlternate align=center><b>状态<B></td>
<td width="45%" class=forumHeaderBackgroundAlternate align=center><B>标题</B></td>
<td width="15%" class=forumHeaderBackgroundAlternate align=center><B>作者</B></td>
<td width="6%" class=forumHeaderBackgroundAlternate align=center><B>回复</B></td>
<td width="22%" class=forumHeaderBackgroundAlternate align=center><B>时间</B></td>
<td width="6%" class=forumHeaderBackgroundAlternate align=center><B>操作</B></td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.bof and rs.eof then
	response.write "<tr> <td class=Forumrow colspan=6 height=25>没有搜索到相关内容。</td></tr>"
else
	rs.PageSize = Forum_Setting(11)
	rs.AbsolutePage=currentpage
	page_count=0
	totalrec=rs.recordcount
	while (not rs.eof) and (not page_count = rs.PageSize)
%>
<tr> 
<td width="6%" class=Forumrow align=center>
<%
if rs("locktopic")=1 then
	response.write "锁定"
elseif rs("isvote")=1 then
	response.write "投票"
elseif rs("isbest")=1 then
	response.write "精华"
else
	response.write "正常"
end if
%>
</td>
<td width="45%" class=Forumrow><%=htmlencode(rs("title"))%></td>
<td width="15%" class=Forumrow align=center><a href="admin_user.asp?action=modify&userid=<%=rs("postuserid")%>"><%=htmlencode(rs("postusername"))%></a></td>
<td width="6%" class=Forumrow align=center><%=rs("child")%></td>
<td width="22%" class=Forumrow><%=rs("dateandtime")%></td>
<td width="6%" class=Forumrow align=center><input type="checkbox" name="topicid" value="<%=rs("topicid")%>"></td>
</tr>
<%
  	page_count = page_count + 1
	rs.movenext
	wend
	dim endpage
	Pcount=rs.PageCount
	response.write "<tr><td valign=middle nowrap colspan=2 class=forumrow height=25>&nbsp;&nbsp;分页: "

	if currentpage > 4 then
	response.write "<a href=""?page=1&action=search&keyword="&keyword&"&topic="&request("topic")&"&username="&request("username")&"&tablename="&request("tablename")&""">[1]</a> ..."
	end if
	if Pcount>currentpage+3 then
	endpage=currentpage+3
	else
	endpage=Pcount
	end if
	for i=currentpage-3 to endpage
	if not i<1 then
		if i = clng(currentpage) then
        response.write " <font color="&Forum_body(8)&">["&i&"]</font>"
		else
        response.write " <a href=""?page="&i&"&action=search&keyword="&keyword&"&topic="&request("topic")&"&username="&request("username")&"&tablename="&request("tablename")&""">["&i&"]</a>"
		end if
	end if
	next
	if currentpage+3 < Pcount then 
	response.write "... <a href=""?page="&Pcount&"&action=search&keyword="&keyword&"&topic="&request("topic")&"&username="&request("username")&"&tablename="&request("tablename")&""">["&Pcount&"]</a>"
	end if
	response.write "</td>"
	response.write "<td colspan=3 class=forumrow>所有结果<input type=checkbox name=allsearch value=yes>"
	response.write "&nbsp;<select name=toTablename>"

	for i=0 to ubound(AllPostTable)
		response.write "<option value="""&AllPostTable(i)&""">"&AllPostTableName(i)& "--" &AllPostTable(i)&"</option>"
	next

	response.write "</select>&nbsp;<input type=submit name=submit value=转换>"
	response.write "</td>"
	response.write "<td class=forumrow align=center><input type=checkbox name=chkall value=on onclick=""CheckAll(this.form)"">"
	response.write "</td></tr>"
end if
rs.close
set rs=nothing
response.write "</table></form><BR><BR>"
end sub

sub update3()
dim keyword,trs
if request.form("tablename")=request.form("totablename") then
	Errmsg="<br><li>不能在相同数据表内进行数据转换。"
	call dvbbs_error()
	exit sub
end if
if request.form("allsearch")="yes" then
	if request("keyword")="" then
		Errmsg="<br><li>请输入您要查询的关键字。"
		call dvbbs_error()
		exit sub
	else
		keyword=replace(request("keyword"),"'","")
	end if
	if request("username")="yes" then
		sql="select topicid from topic where PostTable='"&request("tablename")&"' and postusername='"&keyword&"' order by LastPostTime desc"
	elseif request("topic")="yes" then
		sql="select topicid from topic where PostTable='"&request("tablename")&"' and title like '%"&keyword&"%' order by LastPostTime desc"
	else
		Errmsg="<br><li>请选择您查询的方式。"
		call dvbbs_error()
		exit sub
	end if
else
	if request.form("topicid")="" then
		Errmsg="<br><li>请选择要转移的帖子。"
		call dvbbs_error()
		exit sub
	end if
	sql="select topicid from topic where PostTable='"&request("tablename")&"' and TopicID in ("&request.form("TopicID")&")"
end if

set rs=conn.execute(sql)
if rs.eof and rs.bof then
	Errmsg="<br><li>没有任何记录可转换。"
	call dvbbs_error()
	exit sub
else
	do while not rs.eof
	'取出原表数据
	set trs=conn.execute("select * from "&request("tablename")&" where rootid="&rs("topicid"))
	if not (trs.eof and trs.bof) then
	'插入新表
	do while not trs.eof
	conn.execute("insert into "&request("totablename")&"(Boardid,ParentID,username,topic,body,DateAndTime,length,rootid,layer,orders,ip,Expression,locktopic,signflag,emailflag,isbest,PostUserID) values ("&trs("boardid")&","&trs("parentid")&",'"&checkstr(trs("username"))&"','"&checkstr(trs("topic"))&"','"&checkstr(trs("body"))&"','"&trs("dateandtime")&"',"&trs("length")&","&trs("rootid")&","&trs("layer")&","&trs("orders")&",'"&trs("ip")&"','"&trs("Expression")&"',"&trs("locktopic")&","&trs("signflag")&","&trs("emailflag")&","&trs("isbest")&","&trs("postuserid")&")")
	trs.movenext
	loop
	'更新该主题表名
	conn.execute("update topic set PostTable='"&request("totablename")&"' where topicid="&rs("topicid"))
	'删除原表该帖子数据
	conn.execute("delete from "&request("tablename")&" where rootid="&rs("topicid"))
	end if
	rs.movenext
	loop
end if
set trs=nothing
set rs=nothing
response.write "更新成功!"
end sub
%>
<script language="javascript">
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
</script>

⌨️ 快捷键说明

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