<!--#include file="Inc.asp"-->
<%

call head()

call saycarda("编辑帖子")
%>

<!--#include file="ydzq.asp"-->
<!--#include file="forbbs.asp"-->
<!--#INCLUDE file="newguest.asp"-->

<%

dim page,bbsid,tid,newContent,TP,newtitle,act
act=clng(request("act"))
if page="" then page="1"
bbsid=request("bbsid")
tid=request("tid")
newtitle=Forbbs(request("newtitle"))
newContent=forbbs(request("newContent"))

if tid="" or IsNumeric(tid)=False then
  Call Error("ID无效！")
  end if
if bbsid="" or IsNumeric(bbsid)=False then
  Call Error("ID无效！")
  end if


TP=request("TP")
if TP<>"" then

if act=2 then
if newtitle="" then
  Call Error("标题不能为空！")
  end if
  end if

if newContent="" then
  Call Error("内容不能为空！")
  end if
  	newContent=replace(newContent,"sid=sid","sid=@@sid@@")
 Dim tt1122 	
set rs11=Server.CreateObject("ADODB.Recordset")
rs11.open"select * from sell where id="&tid,conn,1,1

tt1122=Right(rs11("txt"),1)
rs11.close
set rs11=nothing
	
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from sell where id="&tid,conn,1,2


if rs("fid")<>myid and keys<>1 And keys<>3  And keys<>2 and adminzone<>abs(bbsid) then
  Call Error("很抱歉！您没有权限进行操作！！如果您是管理员或者该版斑竹，请联系ID1认证您的管理权限1！")
end if
if rs("fid")<>myid and keys<>1 And keys<>3  And keys<>2 and adminzone<>abs(bbsid) then
  Call Error("权限不足！")
  end if
if act=1 then
rs("txt")=rs("txt")+"[续]"+newContent
ElseIf tt1122="]" Then
rs("name")=newtitle
rs("txt")=newContent
else

rs("name")=newtitle
rs("txt")=newContent+"[br]["&fordate(now)&"被"&myni&"编辑]"
end if
rs.update
rs.close
set rs=nothing
response.write"编辑成功！<br/>"
else
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select * from sell where id="&tid,conn,1,1
if rs("fid")<>myid and keys<>1 And keys<>3  And keys<>2 and adminzone<>abs(bbsid) then
  Call Error("很抱歉！您没有权限进行操作！！如果您是管理员或者该版斑竹，请联系ID1认证您的管理权限2！")
end if
if rs("fid")<>myid and keys<>1 And keys<>3  And keys<>2 and adminzone<>abs(bbsid) then
  Call Error("权限不足！")
  end if
if saytk<>1 then
	Response.write "<form name=""form"" method=""post"" action=""editbbs.asp?bbsid="&bbsid&"&amp;tid="&tid&"&amp;sid="&sid&"&amp;saytk="&saytk&"&amp;TP=1"">"
end if
if act=1 then
 Response.Write "续写内容：<br/>"

if saytk<>1 then
 Response.Write "<input name=""newContent"" value=""""/><br/>"
else
 Response.Write "<input name=""newContent"&tt&""" value=""""/><br/>"
end if
else

dim V_content
V_content=rs("txt")
V_content=replace(V_content,"sid=@@sid@@","sid=sid")

 Response.Write "帖子标题：<br/>"
if saytk<>1 then
 Response.Write "<input name=""newtitle"" value="""&ubb(rs("name"))&"""/><br/>"
else
 Response.Write "<input name=""newtitle"&tt&""" value="""&ubb(rs("name"))&"""/><br/>"
end if
 Response.Write "帖子内容：<br/>"
if saytk<>1 Then
Response.write "内容:(5000字以内)<br/><textarea name=""newContent"" emptyok=""true"" rows=""15"" cols=""15"">"&ubb(V_content)&"</textarea><br/>"

else
 Response.Write "<input name=""newContent"&tt&""" value="""&ubb(V_content)&"""/><br/>"
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
if saytk<>1 then
response.write "<input type=""hidden"" name=""act"" value="""&act&"""/>"%>
<input type="submit" name="Submit" value="确定提交"></form><br/>
<%else
Response.Write "<anchor>[确定提交]"
 Response.Write "<go href=""editbbs.asp?bbsid="&bbsid&"&amp;tid="&tid&"&amp;sid="&sid&"&amp;saytk="&saytk&""" method=""post"" accept-charset='utf-8'>"
if act=2 or saytk=3 then
 Response.Write "<postfield name=""newtitle"" value=""$(newtitle"&tt&")""/>"
end if
 Response.Write "<postfield name=""newContent"" value=""$(newContent"&tt&")""/>"
 Response.Write "<postfield name=""TP"" value=""1""/>"
 Response.Write "<postfield name=""act"" value="""&act&"""/>"
 Response.Write "</go></anchor><br/>"
end if
 Response.Write "<a href='file.asp?bbsid="&bbsid&"&amp;tid="&tid&"&amp;up=3&amp;sid="&sid&"&amp;saytk=2'>我要编辑或增加帖子附件</a><br/>"
end if

 Response.Write "<a href='topic.asp?sid="&sid&"&amp;tid="&tid&"&amp;saytk="&saytk&"'>返回上级</a>"
%>
<!--#include file="fanhui.asp"-->
<%call head1()%>