<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<!-- #include file="inc/wenda_reset.asp" -->
<!-- #include file="session.asp" -->
<%
dim id,Content,f_user,f_title
if(request.form("id")<>"") then
	id=Clng(request.form("id"))	
else
	id=0
end if
Content=request.Form("Content")
if  Cstr(request.Form("vertcode")) <> Cstr(Session("GetCode"))  then 
	response.Write("<script>alert(""验证码错误！请返回刷新页面后再试。"");history.back();</script>")
	Response.End
end if
if(len(Content)<1) then
	response.Write("<script>alert('请填写回答的内容!');history.back();</script>")
	response.End()
end if
if(id>0) then
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select Title,UserId from t_wenda where id="&id,conn,3,1
	if not rs.eof then
		f_title=rs(0)
		f_user=rs(1)
	end if
	rs.close
	set rs=nothing
	if(f_user=checkusername) then
		response.Write("<script>alert('不能回答自己的提问!');history.back();</script>")
		response.End()
	else
		set rs=server.CreateObject("adodb.recordset")
		rs.open "select * from t_reply where 1=0",conn,3,3
		rs.addnew
		rs("Title")=f_title
		rs("AskId")=id	
		rs("UserId")=checkusername
		rs("Content")=tohtml(Content)
		rs("PubIp")=request.ServerVariables("REMOTE_ADDR")
		rs("PubDate")=now()
		rs("IsAnswer")=0
		rs.update
		rs.close
		set rs=nothing
		conn.execute("update t_wenda set ReplyNum=ReplyNum+1,LastReply='"&checkusername&"' where id="&id)
		
	end if
end if
'SetShowHtm(id)
response.Redirect(request.ServerVariables("HTTP_REFERER"))
call connclose()
%>
