<!-- #include file="../inc/conn.asp" -->
<!-- #include file="../inc/htmlencode2.asp"-->
<!--#include file="upload_5xsoft.inc"-->
<%
'图片名称
function makefilename(fname)
  fname = now()
  fname = replace(fname,"-","")
  fname = replace(fname," ","") 
  fname = replace(fname,":","")
  fname = replace(fname,"PM","")
  fname = replace(fname,"AM","")
  fname = replace(fname,"上午","")
  fname = replace(fname,"下午","")
  makefilename=fname
end function 
'图片后缀
function GetExtendName(FileName)
  dim ExtName
  ExtName = LCase(FileName)
  ExtName = right(ExtName,3)
  ExtName = right(ExtName,3-Instr(ExtName,"."))
  GetExtendName = ExtName
end function
'+++++++++++++++++++++++++++++++++++++++++++++
dim upload,file,formName,formPath
set upload=new upload_5xSoft ''建立上传对象
ip=request.servervariables("remote_addr")'ip地址
'表单提交信息
BoardID_1 = upload.form("BoardID_1") 'BoardID_1
BoardID_2 = upload.form("BoardID_2") 'BoardID_2
if BoardID_1="" then
	response.write "<BR><BR><BR><center>对不起，请先选择主论坛类别！</center>"
	response.end
end if

title = trim(upload.form("title")) '主题
if title="" then
	response.write "<BR><BR><BR><center>"
	response.write "主题必须填写！"
	response.write "</center>"
	response.end
end if
menu = trim(upload.form("menu"))'内容
ticon = trim(upload.form("ticon"))'头像
tel=trim(upload.form("tel"))'电话
bbs_img_text = trim(upload.form("bbs_img_text"))'图片1文字说明
img_url = trim(upload.form("img_url"))'图片连接地址
img_url_text = trim(upload.form("img_url_text"))'图片2文字说明
BBS_Return_Url = upload.form("BBS_Return_Url")'发布返回地址
'用户超时
if request.cookies("bbsuser")="" then
	response.redirect "fbht.asp?BoardID_1="&BoardID_1&"&BoardID_2="&BoardID_2
end if
'阻止ip
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 "<center>对不起，你无权发表话题！</center>"
		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(menu,rs_arrest("content"))<>0 or instr(title,rs_arrest("content"))<>0) then
		response.write "<center>对不起，你无权发表话题！</center>"
		response.end
	end if
rs_arrest.movenext
loop
rs_arrest.close
set rs_arrest=nothing
'===========================图片信息
formPath="upfile"'上传目录
'在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
for each formName in upload.file ''列出所有上传了的文件
	set file=upload.file(formName)'图片
	filesize=file.FileSize'图片大小

	if filesize>0 then         ''如果 FileSize > 0 说明有文件数据
		if filesize>204800 then'图片限制大小100k
			response.write "<BR><BR><center>图片大小限制在100k以下<center>"
			response.end
		end if
		vfname = makefilename(now())
		'随机数
		Randomize
		Random=Int((1000 - 100 + 1) * Rnd + 100)'3位随机数
		vfname=vfname&"_"&Random'图片名称

		FileExt=GetExtendName(file.FileName)'图片类型
		if FileExt<>"jpg" and FileExt<>"gif" then
			response.write "<BR><BR><center>只能上传Jpg、Gif类型的图片<center>"
			response.end
		end if

		fname = vfname & "." & GetExtendName(file.FileName)'图片名称
		file.SaveAs Server.mappath(formPath&fname)   ''保存文件
	end if

'输出信息
	'response.write "图片名称："&fname&"<BR>"
	'response.write "图片类型："&FileExt&"<BR>"
	'response.write "图片大小："&filesize
	'response.end
next
'==========================================================
   rsql="update clubuser set jingyuan=jingyuan+10,tili=tili-10 where clubuser_nickname='"&request.cookies("bbsuser")&"'"
   conn.execute(rsql)  

 str="select * from clubuser where clubuser_nickname='"&request.cookies("bbsuser")&"'"
 set rs=server.createobject("adodb.recordset")
 rs.open str,conn,3,1

 sql="select * from bbstitle where (id is null)"
 set rsr=server.createobject("adodb.recordset")
 rsr.open sql,conn,1,3
 rsr.addnew
 rsr("name")=rs("clubuser_name")
 rsr("user_id")=rs("clubuser_nickname")
 rsr("BoardID_1")=BoardID_1
 rsr("BoardID_2")=BoardID_2
 rsr("mail")=rs("clubuser_email")
 rsr("title")=title'主题
 rsr("menu")=htmlencode2(menu)'内容
 rsr("tel")=tel'电话
 rsr("ip")=ip
 rsr("dateh")=now()'发表时间
 rsr("hit")=0
 rsr("rep")=0
 rsr("redate")=now()'最后跟贴时间
 if filesize>0 then'如果有图片
	rsr("bbs_img")=fname'图片名称
 end if
 rsr("bbs_img_text")=bbs_img_text'图片1文字说明
 rsr("img_url")=img_url'图片连接地址
 rsr("img_url_text")=img_url_text'图片2文字说明
 rsr("bbs_img_display")=0'上传图片1显示标志，不显示
 rsr("img_url_display")=0'上传图片2显示标志，不显示
 rsr("picture")=ticon
rsr.update
'
 TitleID=cstr(rsr("id"))
 htmfilename="fileid"&TitleID&".htm"
 rsr("htmfilename")=htmfilename
 rsr.Update 
'
rsr.close
set rsr=nothing
'========================更新统计信息
'一级类别
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
   rsql="update clubuser set jingyuan=jingyuan+10,tili=tili-10 where clubuser_name='"&request.cookies("name")&"'"
   conn.execute(rsql)
'===================================
'+++++++++++++++++++++++++++++++++++++++++++++
top="<HTML><HEAD><META content=""text/html; charset=gb2312"" http-equiv=Content-Type><LINK href=""../css/xmwuye.css"" rel=stylesheet type=text/css><script language=""javascript"" src=""../js/resizeImages.js""></script><META content=""MSHTML 5.00.3700.6699"" name=GENERATOR></HEAD><BODY leftMargin=8 topMargin=5>"
top=top&"<TABLE align=center bgColor=#a4b6d7 border=0 cellPadding=0 cellSpacing=0 width=""99%""><TR><TD height=25 width=""65%""><IMG src=""../images/bbs_t1.gif""> 主题位置：<A href=http://chenht/xmwuye/bbs/main.asp?BoardID_1=A_1>专题论坛</A> &gt;&gt;<a href=http://chenht/xmwuye/bbs/main.asp?layer_1=A_1&amp;layer_2=A_1_23>情感天空</A></TD>"
top=top&"<TD bgColor=#a4b6d7 height=22 width=""35%""><IMG align=absMiddle height=16 src=""images/posttitle.gif"" width=16> 排 序：<A href=""http://chenht/xmwuye/bbs/rebbs.asp?id=6928"">顺序</A>--<A href=""http://chenht/xmwuye/bbs/rebbs2.asp?id=6928"">逆序</A>--不分页</TD></TR></TABLE>"
top=top&"<TABLE align=""center"" bgColor=""#a4b6d7"" border=0 cellPadding=0 cellSpacing=0 width=""99%""><TBODY><TR bgColor=#f2f8ff><TD bgColor=#e8f5ff class=font10_5 rowSpan=2 vAlign=top width=""20%""><DIV align=center>"
top=top&"<TABLE border=0 cellPadding=0 cellSpacing=0 width=""100%"">"
top=top&"<TBODY>"
top=top&"<TR>"
top=top&"<TD>"
top=top&"<DIV align=center><IMG height=84 src=""userheadimg/cache37.gif"" width=84></DIV></TD></TR>"
top=top&"<TR>"
top=top&"<TD height=20>·网名：<A href=""http://chenht/xmwuye/bbs/rebbs.asp?id=6928#"">陈先生</A></TD></TR>"
top=top&"<TR>"
top=top&"<TD height=20>·头衔：小野人 </TD></TR>"
top=top&"<TR>"
top=top&"<TD height=20>·级别：<IMG height=10 src=""userheadimg/class1.gif"" width=63></TD>"
top=top&"</TR>"
top=top&"<TR>"
top=top&"<TD height=20>·资历：90</TD></TR>"
top=top&"<TR>"
top=top&"<TD height=20>·经验：10</TD></TR>"
top=top&"<TR>"
top=top&"<TD height=12>&nbsp;</TD></TR></TBODY></TABLE></DIV></TD>"
top=top&"<TD bgColor=#f3f5ff class=new14 height=22><B> 主 题：testetsete</B></TD>"
top=top&"</TR>"
top=top&"<TR bgColor=#f2f8ff>"
top=top&"<TD bgColor=#f6f6f6 class=new14 vAlign=top>"
top=top&"<TABLE border=0 cellPadding=3 cellSpacing=3 width=""100%"">"
top=top&"<TBODY>"
top=top&"<TR>"
top=top&"<TD class=new14 height=105 vAlign=top>内 容：tedfghfghgjhk" 
top=top&"</TD>"
top=top&"</TR></TBODY></TABLE>"
top=top&"<TABLE border=0 cellPadding=0 cellSpacing=5 width=""100%"">"
top=top&"<TBODY>"
top=top&"<TR>"
top=top&"<TD background=""images/bg_text1.gif"" height=""1""></TD></TR>"
top=top&"<TR>"
top=top&"<TD>"
top=top&"<TABLE border=0 cellPadding=0 cellSpacing=0 width=""100%"">"
top=top&"<TBODY>"
top=top&"<TR>"
top=top&"<TD height=36 vAlign=top width=60>"
top=top&"<DIV align=center><IMG height=32 src=""userheadimg/icon3.gif"" width=45></DIV></TD>"
top=top&"<TD class=C03><FONT color=#568ac2></FONT></TD></TR></TBODY></TABLE></TD></TR>"
top=top&"<TR>"
top=top&"<TD background=""images/bg_text1.gif"" height=""1""></TD></TR>"
top=top&"<TR>"
top=top&"<TD align=left class=C04>"
top=top&"<DIV align=right><IMG src=""../images/bbs_ip.gif""><B></B><B></B>&nbsp; 2004-12-25 23:21:11</DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY>"
top=top&"</TABLE>"
top=top&"<!--0--><!--FileBZ-->"
'*********************************
'写入回贴代码htmfilename
   DIM myFile
   Const ForReading = 1
   Const Forwriting = 2
   Const ForAppending = 8
   myFile="bbs"&TitleID&"/"+htmfilename
   myFolder=TitleID
   myFile = Server.MapPath(myFile)
   myFolder=server.MapPath(myFolder)
   set fileStreamObj = CreateObject("Scripting.FileSystemObject")
   if fileStreamObj.FolderExists(myFolder) then
    Response.Write ""
   else
    fileStreamObj.CreateFolder(myFolder)
   end if
   fileStreamObj.CreateTextFile(myFile)
   set textStream = fileStreamObj.OpenTextFile(myFile,ForWriting,False)
   textStream.Write "88888ok" '(nl)
   textStream.Close()
'*********************************
top=top&"<TABLE align=center bgColor=#a4b6d7 border=0 cellPadding=0 cellSpacing=0 width=""99%"">"
top=top&"<TBODY>"
top=top&"<TR bgColor=#f2f8ff>"
top=top&"<TD bgColor=#f3f5ff class=font10_5 vAlign=top>"
top=top&"<DIV align=center>"
top=top&"<TABLE align=center border=0 cellPadding=0 cellSpacing=0 width=""100%"">"
top=top&"<FORM action=recheck.asp encType=multipart/form-data method=post name=form1 onsubmit=""return check(this)"">"
top=top&"<TR>"
top=top&"<TD bgColor=#a4b6d7 class=font10_5 colSpan=2 height=25>"
top=top&"<DIV align=center><B>回 复：testetsete</B></DIV></TD></TR>"
top=top&"<tr>" 
top=top&"<td width=""20%"" align=""right"" height=""25"">用户名：</td>"
top=top&"<td width=""80%"">" 
top=top&"<p> <input type=""text"" name=""bbsuser"" size=""20""  maxlength=""20"">"
top=top&"·<a href=""register.asp"">如果您还没有在论坛注册用户，请先注册!</a> </p>"
top=top&"</td>"
top=top&"</tr>"
top=top&"<tr>" 
top=top&"<td width=""20%"" align=""right"" height=""25"">密 &nbsp;码：</td>"
top=top&"<td width=""80%"">" 
top=top&"<input type=""password"" name=""password"" size=""20""  maxlength=""15"">"
top=top&"·<a href=""#"" onClick=""javascript:popwin('getpwd.asp?mode=1')"">忘记密码?</a></td>"
top=top&"</tr>"
top=top&"<TR>"
top=top&"<TD align=right vAlign=top width=""20%"">回复内容：</TD>"
top=top&"<TD width=""80%""><TEXTAREA name=remenu cols=59 rows=8 id=""remenu""></TEXTAREA>" 
top=top&"</TD></TR><INPUT name=retel2 type=hidden>" 
top=top&"<TR>"
top=top&"<TD height=""25"" align=right>上 传 图 片：</TD>"
top=top&"<TD><INPUT name=bbs_img type=file><FONT color=#990000>(请上传100K以下的Jpg、Gif图片)</FONT></TD></TR>"
top=top&"<TR>"
top=top&"<TD height=""25"" align=right>图片文字说明：</TD>"
top=top&"<TD><INPUT maxLength=100 name=bbs_img_text size=60> </TD></TR>"
top=top&"<TR>"
top=top&"<TD height=23></TD>"
top=top&"<TD>&nbsp;<FONT color=#990000>说明：您上传的图片需经过网站的审核通过后，才能在论坛显示。</FONT></TD></TR>"
top=top&"<TR>"
top=top&"<TD align=right width=""20%"">　</TD>"
top=top&"<TD width=""80%""><INPUT name=Login_sign2 type=hidden value=1>"
top=top&"<INPUT name=id2 type=hidden value=6928> <INPUT name=BoardID_12 type=hidden value=A_1> <INPUT name=BoardID_22 type=hidden value=A_1_23> <INPUT class=button name=B12 type=submit value=提交回复>" 
top=top&"&nbsp;&nbsp;&nbsp; <INPUT class=button name=B22 type=reset value=全部重写>" 
top=top&"&nbsp;&nbsp;&nbsp;" 
top=top&"</TD></TR></FORM></TABLE></DIV></TD></TR>"
top=top&"</TABLE>"

'response.write top
'response.end

'关闭记录集与数据库
rs.close
set rs=nothing
conn.close
response.redirect BBS_Return_Url
%>