<!--#Include File="WapConfig/WapHeader.asp"-->
<%
'以下为文件正文。

'以下是数据库的设置信息
Topic_ID=Request.QueryString("TopicID")
	if Topic_ID<>"" then  '防止翻页的时候找不到内容
	session("Topic_ID")=Topic_ID
	else
	Topic_ID=session("Topic_ID")
	end if
	forum_id=session("forum_id")'取得论坛的id
	topic_title=session("topic_title") '获得本贴字的题目
if session("OnlineName")="" then
	Response.Redirect XML.WapPath & "success.asp?todo=NoLogin" '表示没有登陆。
end if

if Request.QueryString("ToDo")="New" then
	receive_a=Trim(Lcase(request("send_a"))) 'R_Message
	online_name=session("OnlineName") '发表帖子的人
	receive_d=Request.ServerVariables("REMOTE_ADDR") 'IP
	topic_title=session("topic_title")
if receive_a="" then

			error_message=Ascii("请输入内容。")
else
		XML.strsql="Select Member_id from members where M_name=" & "'" & session("onlineName") & "'" 
		XML.MdbDo
		member_id=XML.Rs("Member_id") '查询用户的member_id。
		XML.StrSql = "insert into Reply (Topic_ID,Forum_id, R_Posted_By,R_Message,R_IP)  values ('"&Topic_ID&"','"&forum_id&"','"&member_id&"','"&receive_a&"','"&receive_d&"')"
		XML.MdbDo

	XML.strSql = "update topics set T_Last_Post = '" & now() & "', T_Last_Member = '" & online_name & "', T_Replies = T_Replies +1 where Topic_ID = " & Topic_ID
	XML.MdbDo
	XML.strSql = "update forum set F_Last_Post = '" & now() & "', F_Last_Reply = '" & topic_title & "', F_Last_Member = '" & online_name & "', F_Last_ID = " & Topic_ID & ", F_RCount = F_RCount +1 where Forum_ID = " & forum_id
	XML.MdbDo

	XML.StrSQl = "Update totals set P_RCount=totals.P_RCount + 1"
	XML.MdbDo
	XML.strsql = "update members set M_LastTime = '" & now() & "',M_LastPost = '" & topic_title & "', M_Num = M_Num + 1, M_Posts=M_Posts + 1 where member_id = " &   member_id 
	XML.MdbDo
	XML.strSQl = "Update members set M_Num=M_Num +1 Where member_id = " &  member_id '更新用户积分
	XML.MdbDo
	Response.Redirect XML.wappath & "Success.asp?todo=NewReplyOk" '表示回复帖子成功
		
End if

End If
XML.WriteRow error_message


XML.WriteOut "<form method='post' action='" & XML.ThisFileName & "?ToDo=New" & "'>"
XML.WriteOut "<h3>内容</h3>"
XML.WriteOut "<input type='text' name='Send_A' value=''/>"

XML.WriteRow "<input type='hidden' name='ToDo' value='" & ListId & "'/>"
XML.WriteOut "<input type='submit' value='提交'/>"
XML.WriteOut "</form>"


'以下为返回链接等信息。
XML.WriteRow XML.ImgA("Images/topt.gif",XML.WapPath,"返回上级")
%>
<!--#Include File="WapConfig/WapFooter.asp"--> 
