深圳升蓝软件
数据库开发 .Net技术  |  ASP技术 PHP技术 JSP技术 应用技术类   
Hiblue Software

一个BBS的源代码(四)


March 25,2004

    '==============================
    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("时间")
Copyright © 2001-2008 Shenzhen Hiblue Software Team All rights reserved