一個BBS的原始碼(四)

來源:互聯網
上載者:User
原始碼 '==================================================================================================
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>回複通知</TITLE></HEAD><BODY style='font-size:9pt'>" & Chr(13) &_
"<PRE>" & Chr(13) &_
"敬愛的使用者:" & Chr(13) & Chr(13) & _
" 你於" & WriteTime & "在<A href=""http://asp.gbsource.net/asp/bbs/" & ASP_FILE_NAME & """>飛林莊“經驗交流”</A>裡發表文章:" &_
FirstTitle & "。" & Chr(13) & Chr(13) &_
" 使用者" & Userid & "於<U>" & Now() & "</U>回複你的文章。" & Chr(13) & Chr(13) & Chr(13) & Chr(13) &_
"_____________________________________________________________" & Chr(13) & Chr(13) &_
"回複如下:" & Chr(13) & Chr(13) &_



相關文章

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

Starter Package

SSD Cloud server and data transfer for only $2.50 a month

Get Started >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。