The source code of a BBS (IV.)

Source: Internet
Author: User
Tags chr mail trim
Source code ' ==================================================================================================
Case "Write"
'==================================================================================================
' Publish an article

%>

<table align=center border=0 cellpadding=7 cellspacing=0 width=650>
<TR>
&LT;TD class=menu>
<p><a href= "/" > Fly Linzhuang </a>-><a href= "<%= asp_file_name%>" > Experience Exchange </A></P>
<form action= "<%= asp_file_name%>" Id=form1 method=post name=form1>
<input Type=hidden name=job value=add>
Account: <input id=userid maxlength=30 Name=userid size=30>
Password: <input id=password name=password type=password><br>
Title: <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 "> Email me when you reply
<input type=submit value= "published" >
<input type=reset value= "Rewrite" >
</FORM>
</TD>
</TR>
</TABLE>


<%


'==================================================================================================
Case "Add", "Reply"
'==================================================================================================
' Add the article into the database

' Check the data
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> Please enter your account number. "
If Password = "" Then wrongmsg = wrongmsg + "<DD><LI> Please enter your password. "
If title = "" Then wrongmsg = wrongmsg + <DD><LI> Please enter the title of the article. "
If content = "Then wrongmsg = wrongmsg +" <DD><LI> Please enter. "

If wrongmsg = "" Then

Userid = Sqlstr (Userid)
Password = Sqlstr (Password)
title = SQLSTR (title)
Content = sqlstr (content)

' Procuratorial account and password
SQL = "Select COUNT (*) from Bbsmember WHERE [Account]= '" & Userid & "and [Password]= '" & 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> username does not exist or the password is incorrect. "

Else ' Add to Database

If Job = "Add" Then
SQL = "INSERT into BBS" ([Author],[topic],[content],[Mail notification]) VALUES (' "&_
Sqlstr (Userid) & "', '" &_
Sqlstr (Title) & "', '" &_
Sqlstr (Content) & "'," &_
Mailme & ")"
Else
' Reply to the article number plus one
Con.execute ("UPDATE bbs SET [reply]=[reply]+1 WHERE [serial number]=" & Session ("Bbs_which"))

'
' Notify the original author of the message
'
SQL = "SELECT [Topic],[time],[Mail notification] from BBS WHERE [serial number]=" & Session ("Bbs_which")
Recbbs.open SQL, Con, 1
If Recbbs.fields ("Mail Notification") Then

Firsttitle = Recbbs.fields ("topic")
Writetime = Recbbs.fields ("Time")

' Get the original author email address
SQL = "SELECT [Mail] from bbsmember WHERE [Account]= '" & Sqlstr (Userid) & "'"
Recmember.open SQL, Con, 1
If not recmember.eof Then
email = Recmember.fields ("Mail")
If Checkemail (Email) Then
' Send a notification message (the message uses HTML)

' Message content
Emailcontent = "" &_
"<HTML><HEAD><TITLE> reply notification </title>"<PRE>" & Chr (&_)
"Dear Users:" & Chr (+) & Chr (a) & _
"You are in" & Writetime & "in <a href=" "http://asp.gbsource.net/asp/bbs/" & Asp_file_name & "" "> Fly Linzhuang" Experience Exchange "& Lt;/a> published an article: "&_
Firsttitle & ". "& Chr (A) & Chr (&_)
"User" & Userid & "<U>" & Now () & "</U>" Reply to your article. "& Chr (A) & Chr (a) & Chr (a) & Chr (a) &_
"_____________________________________________________________" & Chr (A) & Chr (a) &_
"The reply is as follows:" & Chr (A) & Chr (&_)



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.