<!--#Include File="WapConfig/WapHeader.asp"-->
<%
'以下为文件正文。
'以下是数据库的设置信息
Forum_id=Request.QueryString("Forum_id")
	if forum_id<>"" then  '防止翻页的时候找不到内容
	session("forum_id")=forum_id
	else
	forum_id=session("forum_id")
	end if
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"))) 'T_subject
	receive_b=Trim(Lcase(request("send_B"))) 'T_Message
	receive_e=session("OnlineName") '发表帖子的人
	receive_d=XML.PhoneIP 'IP
if receive_a="" then
			error_message=Ascii("请输入主题。")
elseif receive_b="" then
			error_message=Ascii("请输入内容。")
else
		XML.strsql="Select Member_id from members where M_name=" & "'" & session("onlineName") & "'" 
		receive_c=XML.MdbShow("Member_id") '查询用户的member_id。
		XML.strsql = "insert into topics (Forum_id, T_subject,T_Message,T_Originator,T_IP, T_Last_Member)  values ('"&forum_id&"','"&receive_a&"','"&receive_b&"','"&receive_c&"','"&receive_d&"','"&receive_e&"')"
		XML.MdbDo		
		XML.strSql= "select Topic_ID from Topics order by T_Last_Post DESC"
		XML.MdbDo
	if not XML.rs.eof then
		LastID=XML.rs("Topic_ID")
		topic_id=LastID
	end if
		XML.strSql = "update forum set F_Last_Post = '" & now() & "',F_Last_Reply = '" & receive_a & "', F_Last_Member = '" & receive_e & "', F_Last_ID = " & LastID & ", F_Count = F_Count +1 where Forum_ID = " & forum_id
		XML.MdbDo
		XML.strsql = "update members set M_LastTime = '" & now() & "',M_LastPost = '" & receive_a & "', M_Num = M_Num + 2, M_Posts=M_Posts + 1 where member_id = " & receive_c
		XML.MdbDo
		XML.strSQl = "Update totals set P_Count=totals.P_Count + 1" '更新帖子的总数量。
		XML.MdbDo
		XML.strSQl = "Update members set M_Num=M_Num +3 Where member_id = " & receive_c '更新用户积分
		XML.MdbDo
		Response.Redirect XML.wappath & "success.asp?todo=NewOk" '表示发表帖子成功
		
End if

End If

XML.WriteRow error_message

XML.WriteOut "<form method='post' action='" & XML.ThisFileName & "?ToDo=New" & "'>"
XML.WriteOut "请输入主题："
XML.WriteRow "<input type='text' name='Send_A' maxlength='16' size='10' value='标题'/>"
XML.WriteOut "请输入内容："
XML.WriteRow "<input type='text' name='Send_B' maxlength='16' size='10' value='内容'/>"
XML.WriteOut "<input type='hidden' name='ToDo' value='New'/>"
XML.WriteOut "<input type='submit' value='提交'/>"
XML.WriteOut "</form>"


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