<!-- #include file="conn.asp" -->
<!-- #include file="bbsuser.asp" -->
<!-- #include file="inc/htmlencode2.asp"-->
<!--#include file="inc/ubbcode.asp"-->
<%
call FTBBS_HTML_MB
url=Application("FTBBSMB")(10,0)
upfiletype=Application("FTBBSMB")(12,0)
upfilesize=Application("FTBBSMB")(13,0)
htm_ext=Application("FTBBSMB")(32,0)
'+++++++++++++++++++++++++++++++++++
 FileName = request.form("FileName")
 pid = request.form("id")
 postuser = request.form("postuser")
 reid = request.form("reid")
 BoardID_1 = request.form("BoardID_1")
 BoardID_2 = request.form("BoardID_2")
 title = Checkstr((request.form("title")))
 title = htmlencode2(title)
 titlecolor=request.form("titlecolor")
 zhiye = request.form("zhiye")
 ticon = request.form("ticon")
 menu = Checkstr(request.form("menu"))
 bbs_img = request.form("bbs_img")
 bbs_img_display = request.form("bbs_img_display")

 ps = request.form("ps")
 pollYN = request.form("pollYN")
 page = request.form("page")

 if menu="" or len(trim(menu))<1 then
	response.write "<SCRIPT language=JavaScript>alert('内容中不能为空！');"
   	response.write "history.go(-1);"
   	response.write "</script>"        
    response.end 
 end if

set rs_arrest=server.createobject("adodb.recordset")  
Sql_arrest="select * from BBS_arrest where kind='Keyword' order by id asc"
rs_arrest.open sql_arrest,conn,1,1
do while not rs_arrest.eof
	if instr(menu,rs_arrest("content"))<>0 then
		menu=replace(menu,rs_arrest("content"),"*****")		
	end if
rs_arrest.movenext
loop
rs_arrest.close
set rs_arrest=nothing

sql="select top 1 BBS_Cate.BBS_Cate_Manager_Name from BBS_Cate,bbstitle where BBS_Cate.BBS_Cate_ID = bbstitle.BoardID_2 and bbstitle.id="&pid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
myname=rs("BBS_Cate_Manager_Name")
admintobz=0
if InStr(myname,"|")>0 then
   myname=split(myname,"|",-1,1)
   for i=0 to UBound(myname)
     if InStr(myname(i),request.cookies("name"))>0 then
	    admintobz=1
	 end if
   next
elseif myname=request.cookies("name") then
admintobz=1
end if

if (request.cookies("bz")=1 or postuser=request.cookies("name") or admintobz=1) then
menu=htmlencode2(menu)
menu=ftHTMLCode(menu)
menu=ubbcode(menu)
menu=RegExReplace(menu,"\b(script)\b"," $1 ")
menu=RegExReplace(menu,"\b(iframe)\b"," $1 ")
   if reid="" then
   sql="select * from bbstitle where id="&pid
   else
   sql="select * from bbsmenu where id="&reid
   end if

   set rsr=server.createobject("adodb.recordset")
   rsr.open sql,conn,1,3
   if reid="" then
      if postuser<>request.cookies("name") then
	  'if postuser=request.cookies("name") then
      rsr("BoardID_1")=BoardID_1
      rsr("BoardID_2")=BoardID_2
	  end if
      rsr("title")=title	  
      rsr("menu")=menu
      rsr("picture")=ticon
	  rsr("zhiye")=zhiye
	  rsr("titlecolor")=titlecolor
   else 
      rsr("remenu")=menu
   end if
   mod_bbs_img=rsr("bbs_img")
	  '以下是贴子是否修改过的标识与内容
   rsr("img_url")="[此贴子已经被"&request.cookies("bbsuser")&"于"&now()&"编辑过]"
   rsr("img_url_display") = 1
   
  rsr.update
  rsr.close
  set rsr=nothing
'++++++++++++++++++++++++++++++++++
  if reid="" and postuser<>request.cookies("name") then
  sqlstr="update bbsmenu set BoardID_1='"&BoardID_1&"',BoardID_2='"&BoardID_2&"' where pid="&pid
  conn.execute sqlstr
  end if
  if bbs_img_display<>"" then
  sqlstr="update bbstitle set bbs_img_display="&bbs_img_display&",bbs_img='"&bbs_img&"',redate='"&Ftbbs_Time&"' where id="&pid
  else
  sqlstr="update bbstitle set redate='"&Ftbbs_Time&"' where id="&pid
  end if
  conn.execute sqlstr
end if
closedb
response.redirect "ftbbs.asp?id="&pid	
%>