<!-- #include file="setup.asp" -->
<%
if Request.Cookies("username")=empty then error2("请登录后再进行操作！")

if Request.ServerVariables("request_method") <> "POST" then
response.write "<form name=BBSxpPOST method=post action=manage.asp?"&Request.ServerVariables("Query_String")&"></form><SCRIPT>if(confirm('您确定要执行该操作?')){returnValue=BBSxpPOST.submit()}else{returnValue=history.back()}</SCRIPT>"
htmlend
end if


top


id=int(Request("id"))
sql="Select * From [forum] where ID="&ID&""
rs.Open sql,Conn,1
forumid=rs("forumid")
ReList=rs("ReList")
rs.close

if membercode > 3 then
pass=1
elseif instr("|"&Conn.Execute("Select moderated From [bbsconfig] where id="&forumid&" ")(0)&"|","|"&Request.Cookies("username")&"|")>0 then
pass=1
end if

if pass<>1 then error("<li>您的权限不够")


username=Conn.Execute("Select username From [forum] where id="&id&"")(0)

select case Request("menu")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "top"
if membercode > 3 then
conn.execute("update [forum] set toptopic=2 where id="&id&"")
succtitle="总置顶主题成功"
else
error("<li>您的权限不够")
end if
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "untop"
if membercode > 3 then
conn.execute("update [forum] set toptopic=0 where id="&id&"")
succtitle="取消总置顶主题成功"
else
error("<li>您的权限不够")
end if
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "movenew"
conn.execute("update [forum] set lasttime='"&now()&"' where id="&id&"")
succtitle="拉前主题成功"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "move"
if Request("moveid")="" then error("<li>您没有选择要将主题移动哪个论坛")
if Conn.Execute("Select pass From [bbsconfig] where id="&Request("moveid")&"")(0)=4 then error("<li>目标论坛为授权发帖状态")
conn.execute("update [bbsconfig] set lasttopic='该帖子已被转移',lastname='"&Request.Cookies("Username")&"',lasttime='"&now()&"',today=today-1 where id="&forumid&"")
conn.execute("update [bbsconfig] set lasttopic='接受转移帖子',lastname='"&Request.Cookies("Username")&"',lasttime='"&now()&"',today=today+1 where id="&Request("moveid")&"")
conn.execute("update [forum] set forumid="&Request("moveid")&",toptopic=0,goodtopic=0,locktopic=0 where id="&id&"")
succtitle="移动主题成功"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "deltopic"
if isnumeric(""&Request("retopicid")&"") then
sql="Select * From [reforum"&ReList&"] where ID="&int(Request("retopicid"))&"":rs.Open sql,Conn,1:if not rs.eof then content=LCase(replace(rs("content"),"\","/")):rs.close
if instr(content,"images/upfile/")>0 and instr(content,"[NO]")=0 then
dk_killupfiles="":content_1=split(content,"images/upfile/")
for i=0 to ubound(content_1)
if instr(content_1(i),"/200")>0 then
content_2=split(content_1(i),"."):dk_filename="images/upfile/"&content_2(0)&"."&left(content_2(1),3)&""
if instr("|"&dk_killupfiles&"|","|"&dk_filename&"|")=0 then:if dk_killupfiles=empty then:dk_killupfiles=""&dk_filename&"":else:dk_killupfiles=""&dk_killupfiles&"|"&dk_filename&"":end if:end if
end if
next:on error resume next
if instr(dk_killupfiles,"|")>0 then
dk_killupfiles_1=split(dk_killupfiles,"|"):dk_killmsg="(贴子中有附件，已一并删除)"
for i=0 to ubound(dk_killupfiles_1)
set MyFileObject=Server.CreateOBject("Scripting.FileSystemObject"):MyFileObject.DeleteFile""&Server.MapPath("./"&dk_killupfiles_1(i)&"")&"":set MyFileObject=nothing
next
else
set MyFileObject=Server.CreateOBject("Scripting.FileSystemObject"):MyFileObject.DeleteFile""&Server.MapPath("./"&dk_killupfiles&"")&"":set MyFileObject=nothing:dk_killmsg="(贴子中有附件，已一并删除)"
end if
end if

conn.execute("delete from [reforum"&ReList&"] where topicid="&id&" and id="&Request("retopicid")&"")
conn.execute("update [forum] set replies=replies-1 where id="&id&"")

succtitle="删除回贴成功"&dk_killmsg&""

else
sql="Select * From [forum] where ID="&int(Request("id"))&"":rs.Open sql,Conn,1,1:if not rs.eof then:content=LCase(replace(rs("content"),"\","/")):dk_ReList=rs("ReList"):dk_replies=rs("replies"):else:error("<LI>该贴子已被删除"):end if:rs.close
if instr(content,"images/upfile/")>0 then
dk_killupfiles="":content_1=split(content,"images/upfile/")
for i=0 to ubound(content_1)
if instr(content_1(i),"/200")>0 then
content_2=split(content_1(i),"."):dk_filename="images/upfile/"&content_2(0)&"."&left(content_2(1),3)&""
if instr("|"&dk_killupfiles&"|","|"&dk_filename&"|")=0 then:if dk_killupfiles=empty then:dk_killupfiles=""&dk_filename&"":else:dk_killupfiles=""&dk_killupfiles&"|"&dk_filename&"":end if:end if
end if
next:on error resume next
if instr(dk_killupfiles,"|")>0 then
dk_killupfiles_1=split(dk_killupfiles,"|"):dk_killmsg="(贴子中有附件，已一并删除)"
for i=0 to ubound(dk_killupfiles_1)
set MyFileObject=Server.CreateOBject("Scripting.FileSystemObject"):MyFileObject.DeleteFile""&Server.MapPath("./"&dk_killupfiles_1(i)&"")&"":set MyFileObject=nothing
next
else
set MyFileObject=Server.CreateOBject("Scripting.FileSystemObject"):MyFileObject.DeleteFile""&Server.MapPath("./"&dk_killupfiles&"")&"":set MyFileObject=nothing
end if
end if
if dk_replies>0 then
sql="Select * From [reforum"&dk_ReList&"] where topicid="&int(Request("id"))&"":rs.Open sql,Conn,1,1:dk_killupfiles=""
if not rs.eof then
do while not rs.eof
content=replace(rs("content"),"\","/"):content=LCase(content)
if instr(content,"images/upfile/")>0 and instr(content,"[NO]")=0 then
content_2=split(content,"images/upfile/")
for ii=0 to ubound(content_2)
if instr(content_2(ii),"/200")>0 then
content_3=split(content_2(ii),".")
dk_filename="images/upfile/"&content_3(0)&"."&left(content_3(1),3)&""
if instr("|"&dk_killupfiles&"|","|"&dk_filename&"|")=0 then:if dk_killupfiles=empty then:dk_killupfiles=""&dk_filename&"":else:dk_killupfiles=""&dk_killupfiles&"|"&dk_filename&"":end if:end if
end if
next:on error resume next
if instr(dk_killupfiles,"|")>0 then:dk_killupfiles_1=split(dk_killupfiles,"|"):for i=0 to ubound(dk_killupfiles_1):dk_killmsg="(贴子中或者回复中有附件，已一并删除)":set MyFileObject=Server.CreateOBject("Scripting.FileSystemObject"):MyFileObject.DeleteFile""&Server.MapPath("./"&dk_killupfiles_1(i)&"")&"":set MyFileObject=nothing:next:else:set MyFileObject=Server.CreateOBject("Scripting.FileSystemObject"):MyFileObject.DeleteFile""&Server.MapPath("./"&dk_killupfiles&"")&"":set MyFileObject=nothing:end if
end if
rs.movenext
loop
end if:rs.close
end if

conn.execute("update [user] set deltopic=deltopic+1 where username='"&username&"'")
conn.execute("update [forum] set toptopic=0,deltopic=1,lastname='"&Request.Cookies("username")&"',lasttime='"&now()&"' where id="&id&" and deltopic=0")
conn.execute("delete from [favorites] where name='"&id&"' and url='topic'")

succtitle="删除主题成功 "&dk_killmsg&""
end if
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "lockpage"
if isnumeric(""&Request("retopicid")&"") then
conn.execute("update [reforum] set lock=1 where topicid="&id&" and id="&Request("retopicid")&"")
succtitle="锁定回贴成功"
else
conn.execute("update [forum] set lock=1 where id="&id&"")
succtitle="锁定主题成功"
end if
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "unlockpage"
if isnumeric(""&Request("retopicid")&"") then
conn.execute("update [reforum] set lock=0 where topicid="&id&" and id="&Request("retopicid")&"")
succtitle="解除锁定回贴成功"
else
conn.execute("update [forum] set lock=0 where id="&id&"")
succtitle="解除锁定主题成功"
end if
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "goodtopic"
if Conn.Execute("Select goodtopic From [forum] where id="&id&" ")(0)=1 then error("<li>此帖子已经加入精华区了，无需重复添加")
conn.execute("update [forum] set goodtopic=1 where id="&id&"")
conn.execute("update [user] set goodtopic=goodtopic+1 where username='"&username&"'")
succtitle="加入精华区成功"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "delgoodtopic"
if Conn.Execute("Select goodtopic From [forum] where id="&id&" ")(0)=0 then error("<li>此帖子已经移出精华区了")
conn.execute("update [forum] set goodtopic=0 where id="&id&"")
conn.execute("update [user] set goodtopic=goodtopic-1 where username='"&username&"'")
succtitle="移出精华区成功"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "toptopic"
conn.execute("update [forum] set toptopic=1 where id="&id&"")
succtitle="置顶主题成功"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "deltoptopic"
conn.execute("update [forum] set toptopic=0 where id="&id&"")
succtitle="取消置顶主题成功"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "locktopic"
conn.execute("update [forum] set locktopic=1 where id="&id&"")
succtitle="关闭主题成功"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "dellocktopic"
conn.execute("update [forum] set locktopic=0 where id="&id&"")
succtitle="开放主题成功"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "lookip"
if isnumeric(""&Request("retopicid")&"") then
sql="Select * From [reforum"&ReList&"] where id="&Request("retopicid")&""
else
sql="Select * From [forum] where id="&id&""
end if

rs.Open sql,Conn,1
username=rs("username")
posttime=rs("posttime")
postip=rs("postip")
rs.close
%>


<table border=0 width=<%=dkuan%> align=center cellspacing=1 cellpadding=4 class=a2>
<tr class=a3>
<td height=25>&nbsp;<img src=images/Forum_nav.gif>&nbsp; <%ClubTree%> → 查看IP</td>
</tr>
</table>
<br>
<table width="333" border="0" cellspacing="1" cellpadding="2" align="center" class=a2>
<tr>
<td width="328" height="25" align="center" class=a1 colspan="2">
查看IP
</td></tr><tr>
<td height="7" width="164" valign="top" align="center" class=a3>
用户名</td>
<td height="7" width="164" valign="top" align="center" class=a3>
<%=username%></td></tr><tr>
<td height="6" width="164" valign="top" align="center" class=a3>
时间</td>
<td height="6" width="164" valign="top" align="center" class=a3>
<%=posttime%></td></tr><tr>
<td height="6" width="164" valign="top" align="center" class=a3>
IP地址</td>
<td height="6" width="164" valign="top" align="center" class=a3>
<%=postip%></td></tr></table>

<br>
<center>
<a href=ShowPost.asp?id=<%=id%>>BACK</a><br>
<%
htmlend

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
end select
if succtitle="" then error("<li>无效命令")

log(""&succtitle&"，主题ID："&id&"")

message="<li>"&succtitle&"<li><a href=ShowForum.asp?forumid="&forumid&">返回论坛</a><li><a href=Default.asp>返回社区首页</a>"
succeed(""&message&"<meta http-equiv=refresh content=3;url=ShowForum.asp?forumid="&forumid&">")
%>