日期:2013-05-27  浏览次数:20989 次

'==================================================================================================
Case "Write"
'==================================================================================================
' 发表文章

%>

<TABLE align=center border=0 cellPadding=7 cellSpacing=0 width=650>
<TR>
<TD class=menu>
<P><A href="/">飞林庄</A>-><A href="<%= ASP_FILE_NAME %>">经验交流</A></P>
<FORM action="<%= ASP_FILE_NAME %>" id=FORM1 method=post name=FORM1>
<INPUT type=hidden name=Job value=Add>
账号:<INPUT id=Userid maxLength=30 name=Userid size=30>
密码:<INPUT id=Password name=Password type=password><BR>
题目:<INPUT id=Title maxLength=80 name=Title size=72><BR>
<TEXTAREA cols=80 id=Content name=Content rows=20></TEXTAREA><BR>
<INPUT id=Mailme name=Mailme value=Yes type=checkbox style="BORDER-BOTTOM: #f0f0d0; BORDER-LEFT: #f0f0d0; BORDER-RIGHT: #f0f0d0; BORDER-TOP: #f0f0d0">有回复时发邮件通知我
<INPUT type=submit value=" 发 表 ">
<INPUT type=reset value=" 重 写 ">
</FORM>
</TD>
</TR>
</TABLE>


<%


'==================================================================================================
Case "Add","Reply"
'==================================================================================================
' 把文章加进数据库

' 检查数据
Userid = Trim(Request("Userid"))
Password = Trim(Request("Password"))
Title = Trim(Request("Title"))
Content = RTrim(Request("Content"))
If Request("Mailme") = "Yes" Then Mailme = 1 Else Mailme = 0

WrongMsg = ""
If Userid = "" Then WrongMsg = WrongMsg + "<DD><LI>请输入你的账号。"
If Password = "" Then WrongMsg = WrongMsg + "<DD><LI>请输入你的密码。"
If Title = "" Then WrongMsg = WrongMsg + "<DD><LI>请输入文章题目。"
If Content = "" Then WrongMsg = WrongMsg + "<DD><LI>请输入内容。"

If WrongMsg = "" Then

Userid = SqlStr( Userid )
Password = SqlStr( Password )
Title = SqlStr( Title )
Content = SqlStr( Content )

' 检察账号与密码
SQL = "SELECT COUNT(*) FROM bbsmember WHERE [账号]='" & Userid & "' AND [密码]='" & Password & "'"
RecMember.Open SQL , Con , 1
If RecMember.Fields(0).Value = 0 Then MemberExist = True Else MemberExist = False
RecMember.Close

If MemberExist Then

WrongMsg = WrongMsg + "<DD><LI>用户名不存在或者密码不对。"

Else ' 加进数据库

If Job = "Add" Then
SQL = "INSERT INTO bbs ([作者],[题目],[内容],[邮件通知]) VALUES('" &_
SqlStr( Userid ) & "','" &_
SqlStr( Title ) & "','" &_
SqlStr( Content ) & "'," &_
Mailme & ")"
Else
' 回复文章数加一
Con.Execute( "UPDATE bbs SET [回复]=[回复]+1 WHERE [序号]=" & Session("BBS_Which") )

'
' 邮件通知原作者
'
SQL = "SELECT [题目],[时间],[邮件通知] FROM bbs WHERE [序号]=" & Session("BBS_Which")
RecBBS.Open SQL , Con , 1
If RecBBS.Fields("邮件通知") Then

FirstTitle = RecBBS.Fields("题目")
WriteTime = RecBBS.Fields("时间")

' 取得原作者邮件地址
SQL = "SELECT [邮件] FROM bbsmember WHERE [账号]='" & SqlStr(Userid) & "'"
RecMember.Open SQL , Con , 1
If Not RecMember.EOF Then
Email = RecMember.Fields("邮件")
If CheckEmail( Email ) Then
' 发出通知邮件(邮件使用HTML)

' 邮件内容
EmailContent = "" &_
"<HTML><HEAD><TITLE>回复通