<!--#include file="bbstop.asp"-->
<!--#include file="bbsinc/code.asp"-->
<!--#include file="bbsinc/form2.asp"-->
<%
if membername="" then
  Errmsg=Errmsg+"<br>"+"<li>您没有<a href=login.asp>登录</a>，没有权限编辑贴子！"
  call error()
else
   	dim AnnounceID
   	dim RootID
   	dim BoardID
   	dim username
   	dim cname
   	cname=membername
   	dim rs
   	dim sql
   	dim rsBoard
   	dim boardsql,sel
   	dim con,content
   	dim olduser,oldpass

	if request("boardid")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定论坛版面。"
	elseif not isInteger(request("boardid")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的版面参数。"
	else
		boardid=request("boardid")
	end if
	if request("id")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
	elseif not isInteger(request("id")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
	else
		AnnounceID=request("id")
	end if
	if request("RootID")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
	elseif not isInteger(request("RootID")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
	else
		RootID=request("RootID")
	end if
	if founderr=true then
		call error()
		response.end
	end if
 
   	set rs=server.createobject("adodb.recordset")
	set rs_old = server.CreateObject ("adodb.recordset")
   	sql="select boardtype from bbs_board where boardID="&BoardID
   	rs.open sql,conn,1,1
   	boardtype=rs("boardtype")
   	rs.close
   	sql="select bbs_content.username,bbs_content.topic,bbs_content.body,[huiyuan].userclass from bbs_content,[huiyuan] where bbs_content.username=[huiyuan].huiyuan and bbs_content.AnnounceID="&AnnounceID
   	rs.open sql,conn,1,1
	topic=rs("topic")
   	con=rs("body")
	if rs("username")<>Trim(cname) then
	if memberclass=user_level8 and rs("userclass")=user_level8 then
		response.write"<script language=Javascript>"
		response.write"alert('错误：同等级用户不能修改。');"
		response.write"location.href = 'javascript:history.back()'"
		response.write"</script>"
		set rs = nothing
   		response.end()
	elseif memberclass=user_level9 and rs("userclass")=user_level9 then
		response.write"<script language=Javascript>"
		response.write"alert('错误：同等级用户不能修改。');"
		response.write"location.href = 'javascript:history.back()'"
		response.write"</script>"
		set rs = nothing
   		response.end()
	elseif memberclass=user_level8 and rs("userclass")=user_level9 then
		response.write"<script language=Javascript>"
		response.write"alert('错误：不能修改等级比你高的用户贴子。');"
		response.write"location.href = 'javascript:history.back()'"
		response.write"</script>"
		set rs = nothing
   		response.end()
	elseif memberclass<>user_level8 and memberclass<>user_level9 then
 		response.write"<script language=Javascript>"
		response.write"alert('错误：您的等级不足以修改别人的贴子。');"
		response.write"location.href = 'javascript:history.back()'"
		response.write"</script>"
		set rs = nothing
   		response.end()
	else
		sql_old = "select huiyuan from [huiyuan] where huiyuan='"&rs("username")&"'"
		rs_old.Open sql_old,conn,1,1
		old_user = rs_old("huiyuan")
		rs_old.Close 
%>
<table cellpadding=4 cellspacing=1 border=0 width="762" align=center bgcolor="#f9f9f9" class=table-zuoyou>
<tr><td height=25 bgcolor=#f9f9f9>&nbsp;现在时间是：<%=now%>&nbsp;&nbsp;您当前的位置：<a href=index.asp><font color=#ff6600>会员社区首页</font></a>&nbsp;&gt;&gt;&nbsp;<a href="list.asp?boardid=<%=boardid%>"><font color=#ff6600><%=boardtype%></font></a>&nbsp;&gt;&gt;&nbsp;<font color=#ff6600>编辑贴子<%=htmlencode(topic)%></font></td></tr>
</tr><tr><td height="1" bgcolor=#efefef></td></tr>
</table>
<%
	call showeditForm()
	end if
	else
		sql_old = "select huiyuan from [huiyuan] where huiyuan='"&rs("username")&"'"
		rs_old.Open sql_old,conn,1,1
		old_user = rs_old("huiyuan")
		rs_old.Close 
%>
<table cellpadding=4 cellspacing=1 border=0 width="762" align=center bgcolor="#f9f9f9" class=table-zuoyou>
<tr><td height=25 bgcolor=#f9f9f9>&nbsp;现在时间是：<%=now%>&nbsp;&nbsp;您当前的位置：<a href=index.asp><font color=#ff6600>会员社区首页</font></a>&nbsp;&gt;&gt;&nbsp;<a href="list.asp?boardid=<%=boardid%>"><font color=#ff6600><%=boardtype%></font></a>&nbsp;&gt;&gt;&nbsp;<font color=#ff6600>编辑贴子<%=htmlencode(topic)%></font></td></tr>
</tr><tr><td height="1" bgcolor=#efefef></td></tr>
</table>
<%
	call showeditForm()
	end if
	set rs_old=nothing
	rs.Close
	set rs=nothing
end if
%>
<!-- #include file="bbsend.asp" -->