<!-- #include file="conn.asp" -->
<!-- #include file="bbsuser.asp" -->
<!-- #include file="inc/htmlencode2.asp"-->
<!--#include file="inc/ubbcode.asp"-->
<!-- #include file="touxianfun.asp" -->
<%
call FTBBS_HTML_MB
url=Application("FTBBSMB")(10,0)
upfiletype=Application("FTBBSMB")(12,0)
upfilesize=Application("FTBBSMB")(13,0)
getcodeoff=Application("FTBBSMB")(30,0)
ftbbsuser=request.cookies("name")
if session(FTBBS&"LastPostTime")="" then
   session(FTBBS&"LastPostTime")=now()
else
   if datediff("s",session(FTBBS&"LastPostTime"),now())<=Application("FTBBSMB")(18,0) then
	  response.write "<SCRIPT language=JavaScript>alert('连续发帖间隔时间不能少于"&Application("FTBBSMB")(18,0)&"秒！');history.go(-1);</script>"        
      response.end
   else
      session(FTBBS&"LastPostTime")=now()
   end if
end if
'+++++++++++++++++++++++++++++++++++++++++++++
ip=request.servervariables("remote_addr")
BoardID_1 = request.form("BoardID_1")
BoardID_2 = request.form("BoardID_2")
returnurl="main.asp?layer_1="&BoardID_1&"&layer_2="&BoardID_2
refbhturl="bbspoll.asp?layer_1="&BoardID_1&"&layer_2="&BoardID_2
if request.cookies("payuser")=3 then
   call ftbbs_msg("你的用户名被管理员封锁,请联系管理员！",returnurl)
end if
'+++++++++++++++++++++++++++++++++++++++++++++
If getcodeoff=1 Then
   codestr = Trim(request.form("codestr"))
   codename = Trim(request.form("codename"))
   If CStr(Session("GetCode"&codename)) <> CStr(codestr) Then
   call ftbbs_msg("验证码错误，请重新输入！",refbhturl)
  end if
End If
'++++++++++++++++++++++++++++++++
call FTBBS_BZ_NAME(BoardID_1)
BBS_Cate_Name1=Application("BBS_Cate_Name1")
call FTBBS_BZ_NAME2(BoardID_1,BoardID_2)
BBS_Cate_Name2=Application("BBS_Cate_Name2")
BBS_Cate_Manager_Name=Application("BBS_Cate_Manager_Name")
'++++++++++++++++++++++++++++++++
tptype=request.form("tptype")
tpnl1=Checkstr(request.form("tpnl1"))
tpnl2=Checkstr(request.form("tpnl2"))
tpnl3=Checkstr(request.form("tpnl3"))
tpnl4=Checkstr(request.form("tpnl4"))
tpnl5=Checkstr(request.form("tpnl5"))
tpnl6=Checkstr(request.form("tpnl6"))
tpnl7=Checkstr(request.form("tpnl7"))
tpnl8=Checkstr(request.form("tpnl8"))
tpnl9=Checkstr(request.form("tpnl9"))
tpnl10=Checkstr(request.form("tpnl10"))
'++++++++++++++++++++++++++++++++
title = trim(request.form("title"))
title=htmlencode2(title)
title=Checkstr(title)
menu = Checkstr(trim(request.form("menu")))
ticon = trim(request.form("ticon"))
tel=trim(request.form("tel"))

daynum = trim(request.form("daynum"))
FileName = session("filename") 'trim(request.form("FileName"))

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
	   call ftbbs_msg("对不起，你无权发表话题!",returnurl) 
	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(menu,rs_arrest("content"))<>0 or instr(title,rs_arrest("content"))<>0) then
		title=replace(title,rs_arrest("content"),"*****")
		menu=replace(menu,rs_arrest("content"),"*****")		
	end if
rs_arrest.movenext
loop
rs_arrest.close
set rs_arrest=nothing

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

menu=htmlencode2(menu)
menu=ftHTMLCode(menu)
menu=ubbcode(menu)
menu=RegExReplace(menu,"\b(script)\b"," $1 ")
menu=RegExReplace(menu,"\b(iframe)\b"," $1 ")
'+++++++++++++++++++++++++++++++++++++++++++++++
 indate=now()
 htmfilename=inFolder&"/"&FileName
 sql="select * from bbstitle where (id is null)"
 set rsr=server.createobject("adodb.recordset")
 rsr.open sql,conn,1,3
 rsr.addnew
 rsr("name")=ftbbsuser
 rsr("user_id")=ftbbsuser
 rsr("BoardID_1")=BoardID_1
 rsr("BoardID_2")=BoardID_2
 rsr("title")=title'主题
 rsr("menu")=menu
 rsr("tel")=tel
 rsr("ip")=ip
 rsr("dateh")=indate
 rsr("hit")=0
 rsr("rep")=0
 rsr("redate")=indate
 rsr("picture")=ticon
 rsr("htmfilename")=htmfilename
 rsr("flag")=1
rsr.update

 sql="select top 1 id,dateh from bbstitle order by id desc"
 set rsr=server.createobject("adodb.recordset")
 rsr.open sql,conn,1,3
 indate=rsr("dateh")
 TitleID=rsr("id")
 rsr.close
 set rsr=nothing

'+++++++++++++++++++++++++++++++++++++++++++++++
if title<>"" and tptype<>"" and tpnl1<>"" and tpnl2<>"" then
 adddate=now()
 Set rs = Server.CreateObject("ADODB.Recordset")
 sql="SELECT top 11 * FROM BBS_Poll "
 rs.open sql,conn,1,3
 rs.addnew
 rs("pid")=TitleID
 rs("投票类型")=tptype
 rs("选项内容")=title
 rs("发布日期")=adddate
 rs("发起日期")=adddate
 rs("到期日期")=DateAdd("d", daynum, adddate)
if tptype=1 then
  rs.addnew
  rs("pid")=TitleID
  rs("选项内容")=tpnl1
  rs.addnew
  rs("pid")=TitleID
  rs("选项内容")=tpnl2
  if tpnl3<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl3
  end if
  if tpnl4<>"" then 
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl4
  end if
  if tpnl5<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl5
  end if
  if tpnl6<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl6
  end if
  if tpnl7<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl7
  end if
  if tpnl8<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl8
  end if
  if tpnl9<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl9
  end if
  if tpnl10<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl10
  end if
  tpnl="<SCRIPT language=javascript src=../Dirpoll.asp?TitleID="&TitleID&"></SCRIPT>"
else
  rs.addnew
  rs("pid")=TitleID
  rs("选项内容")=tpnl1
  rs.addnew
  rs("pid")=TitleID
  rs("选项内容")=tpnl2
  if tpnl3<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl3
  end if
  if tpnl4<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl4
  end if
  if tpnl5<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl5
  end if
  if tpnl6<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl6
  end if
  if tpnl7<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl7
  end if
  if tpnl8<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl8
  end if
  if tpnl9<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl9
  end if
  if tpnl10<>"" then
   rs.addnew
   rs("pid")=TitleID
   rs("选项内容")=tpnl10
  end if
  tpnl="<SCRIPT language=javascript src=../Dirpoll.asp?TitleID="&TitleID&"></SCRIPT>"
 end if
 rs.update
 rs.close
 set rs=nothing
end if
 'nl=tpnl&menu
'========================更新统计信息
'一级类别
strsql="update BBS_Cate set BBS_Cate_Topic=BBS_Cate_Topic+1 where BBS_Cate_ID='"&BoardID_1&"'"
conn.execute(strsql)

if BoardID_2<>"" then'二级类别
	strsql="update BBS_Cate set BBS_Cate_Topic=BBS_Cate_Topic+1 where BBS_Cate_ID='"&BoardID_2&"'"
	conn.execute(strsql)
end if
closedb
if returnurl<>"" then
response.redirect returnurl
else
response.redirect "main.asp"
end if
%>