·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 一个BBS的源代码(四)

一个BBS的源代码(四)

类别: ASP教程  评论数:0 总得分:0
\'==============================
Case "Write"
\'==============================
\' 发表文章

%>

<TABLE align=center border=0 cellPadding=7 cellSpacing=0 width=650>
<TR>
<TD class=menu>
<P><A href="/">飞林庄</A>-&gt;<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("时间")
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1