<!-- #include file="conn.asp" -->
<!-- #include file="bbsuser.asp" -->
<!-- #include file="inc/htmlencode2.asp"-->
<!-- #include file="inc/ubbcode.asp"-->
<!-- #include file="touxianfun.asp" -->
<%
dim str,sql,url,upfiletype,upfilesize,getcodeoff,htm_ext,ip,pid,remenu,Sql_arrest,zhiye,bbs_img,jingyuan,touxian
dim P_display,TitleID,retitle,postuser,user_id,rep,postnum,BoardID_1,BoardID_2,menu,indate,bbs_img_text
call FTBBS_HTML_MB
url=Application("FTBBSMB")(10,0)
upfiletype=Application("FTBBSMB")(12,0)
upfilesize=Application("FTBBSMB")(13,0)
getcodeoff=Application("FTBBSMB")(30,0)
htm_ext=Application("FTBBSMB")(32,0)

if request.cookies("payuser")=3 then
   response.write "<SCRIPT language=JavaScript>alert('你的用户名被管理员封锁,请联系管理员！');history.go(-1);</script>"        
   response.end
end if

if session(FTBBS&"RePostTime")="" then
   session(FTBBS&"RePostTime")=now()
else
   if datediff("s",session(FTBBS&"RePostTime"),now())<=Application("FTBBSMB")(19,0) then
	  response.write "<SCRIPT language=JavaScript>alert('连续回帖间隔时间不能少于"&Application("FTBBSMB")(19,0)&"秒！');history.go(-1);</script>"        
      response.end
   else
      session(FTBBS&"RePostTime")=now()
   end if
end if
'+++++++++++++++++++++++++++++++++++++
ip=request.servervariables("remote_addr")
pid=request.form("id")
remenu=Checkstr(trim(request.form("remenu")))
 
Sql_arrest="select * from BBS_arrest where kind='IP' order by id asc"
set rs_arrest=server.createobject("adodb.recordset")
rs_arrest.open sql_arrest,conn,1,1
do while not rs_arrest.eof
	if rs_arrest("content")=ip then
		response.write "<SCRIPT language=JavaScript>alert('对不起，你无权发表话题！');"
   	    response.write "history.go(-1);"
   		response.write "</script>"        
        response.end
	end if
rs_arrest.movenext
loop
rs_arrest.close

'阻止关键字
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(remenu,rs_arrest("content"))<>0 then
		remenu=replace(remenu,rs_arrest("content"),"*****")		
	end if
rs_arrest.movenext
loop
rs_arrest.close
set rs_arrest=nothing

'++++++++++++++++引用+++++++++++++++++++
if InStr(remenu,"[quote]")>0 then
	wz = InStr(remenu,"[/quote]") - (InStr(remenu,"[quote]")+7)		'id位数
	plkey = Mid(remenu,InStr(remenu,"[quote]")+7,wz)				'求出引用ID关键字	
	keyLY2=Mid(remenu,InStr(remenu,"[quote]"),7+8+InStr(remenu,"[/quote]") - (InStr(remenu,"[quote]")+7))		'求出欲替换的字符串				  	
	set rs1=server.createobject("adodb.recordset")
	rs1.open "select top 1 * from bbsmenu where id="& plkey,conn,1,1
	keyxx="<font color=#568AC2>引用回复: "& rs1("user_id")&"</font>" '" ["& left(rs1("ip"),InStrRev(rs1("ip"),".")) &"*" &"] :</font>"
	keyLY="<table width=99% border=0 align=center cellpadding=4 cellspacing=1 bgcolor=#999999><tr><td bgcolor=#ffffee>"& keyxx &"<br>"& rs1("remenu") &"</td></tr></table>"  '取出欲引用内容即替换后内容
	rs1.close
	set rs1=nothing
	remenu=Replace(remenu,keyLY2,keyLY)
end if
'+++++++++++++++++++++++++++++++++++++++ 
 rebbs_img_text = trim(request.form("bbs_img_text"))
 img_url = trim(request.form("img_url"))
 img_url_text = trim(request.form("img_url_text"))
 pollYN = request.form("poll")
 
 if request.cookies("name")="" then
	rename=bbsuser
 else
	rename=request.cookies("name")
 end if
 
sqk="select * from bbstitle where id="&pid&""
set rers=server.createobject("adodb.recordset")
rers.open sqk,conn,3,1
htmfilename=rers("htmfilename")
If getcodeoff=1 Then
   If Not codepass Then
      call ftbbs_msg("验证码错误，请重新输入!",htmfilename)
  end if
End If
P_display=rers("P_display")
TitleID=rers("id")
retitle=rers("title")
postuser=rers("name")
user_id=rers("user_id")
rep=rers("rep")
postnum=rers("postnum")

BoardID_1=rers("BoardID_1")
BoardID_2=rers("BoardID_2")
menu=rers("menu")

indate=rers("dateh")
zhiye=rers("zhiye")
bbs_img_display=rers("bbs_img_display")
bbs_img=rers("bbs_img")
bbs_img_text=rers("bbs_img_text")

if rers("img_url_display")=1 then
   img_url=rers("img_url")
else
   img_url=""
end if
fd=rers("flag")'活动贴标识
dbreinfo=rers("reinfo")
rers.close
set rers=nothing
if len(remenu)<3 or remenu="" then
   call ftbbs_msg("你输入的内容太少，最少为3个字!",htmfilename)
end if
if P_display="0" then
   call ftbbs_msg("该主题贴被禁止回贴!",htmfilename)
end if
 fldarray=split(htmfilename,"/",-1,1)
 infolder=fldarray(0)
 filename=fldarray(1)

remenu = htmlencode2(remenu)
remenu = fthtmlcode(remenu)
remenu = ubbcode(remenu)

remenu = RegExReplace(remenu,"\b(script)\b"," $1 ")
remenu = RegExReplace(remenu,"\b(iframe)\b"," $1 ")
'==========================================================
call FTBBS_BZ_NAME(BoardID_1)
BBS_Cate_Name1=Application("BBS_Cate_Name1")
BBS_Cate_QS1=Application("BBS_Cate_QS1")
call FTBBS_BZ_NAME2(BoardID_1,BoardID_2)
BBS_Cate_Name2=Application("BBS_Cate_Name2")
BBS_Cate_Manager_Name=Application("BBS_Cate_Manager_Name")
BBS_Cate_QS2=Application("BBS_Cate_QS2")
if (request.cookies("bz")<>1 and request.cookies("bbsadmin")<>1) and (BBS_Cate_QS1=5 or BBS_Cate_QS2=5) then
   call ftbbs_msg("你权限太低不能回贴!",htmfilename)
end if
'+++++++++++++++新版新加取出主题贴用户资料
 str="update clubuser set jingyuan=jingyuan+2 where clubuser_name='"&postuser&"'"
 conn.execute str
 pagenum=Application("FTBBSMB")(6,0)
 k=(rep+1)/pagenum
 dim page
 if int(k)=k and int(k)<>0 then
   page=k
 else
   page=int(k)+1
 end if
 set bbs=server.createobject("adodb.recordset")
 sql="select * from bbsmenu where (id is null)"
 bbs.open sql,conn,1,3
 bbs.addnew
 bbs("pid")=pid
 bbs("BoardID_1")=BoardID_1
 bbs("BoardID_2")=BoardID_2
 bbs("user_id")=rename
 bbs("rename")=rename
 bbs("remail")=remail
 bbs("remenu")=remenu
 bbs("retel")=retel
 bbs("reip")=ip
 reindate=Ftbbs_Time
 bbs("dateh")=reindate
 bbs("kind")=0
 bbs("usertype")=usertype'用户类型 0:注册用户 1:过客

 bbs("img_url")=img_url
 bbs("img_url_text")=img_url_text
 bbs("img_url_display")=0
 bbs("deleted")=0
 bbs.update
 bbs.close
 set bbs=nothing
 datetime=reindate
'******主题回复+1,redate=getdate()************
reinfo=dbreinfo&"|"&reindate&","&rename&"|"
if session("bbs_img_display")<>"" then
   bbs_img_display=session("bbs_img_display")
   bbs_img=session("bbs_img")
end if
if bbs_img_display<>"" then
strsql="update bbstitle set bbs_img_display="&bbs_img_display&",bbs_img='"&bbs_img&"',rep=rep+1,postnum=postnum+1,redate='"&reindate&"',reinfo='"&reinfo&"' where id="&pid
else
strsql="update bbstitle set rep=rep+1,postnum=postnum+1,redate='"&reindate&"',reinfo='"&reinfo&"' where id="&pid
end if
conn.execute(strsql)
strsql="update BBS_Cate set BBS_Cate_Reply=BBS_Cate_Reply+1 where BBS_Cate_ID='"&BoardID_1&"'"
conn.execute(strsql)

if BoardID_2<>"" then'二级类别
   strsql="update BBS_Cate set BBS_Cate_Reply=BBS_Cate_Reply+1 where BBS_Cate_ID='"&BoardID_2&"'"
   conn.execute(strsql)
end if

session("bbs_img_display")=""
session("bbs_img")=""
'++++++++++++++++++++++++++++++++++++++++
rsql="update clubuser set jingyuan=jingyuan+5,tili=tili-10 where clubuser_name='"&request.cookies("name")&"'"
conn.execute(rsql)

conn.close
set conn=nothing
if page>1 then
tourl="ftbbs.asp?page="&page&"&id="&pid
else
tourl="ftbbs.asp?id="&pid
end if
response.redirect tourl
%>

