pm_new_message.asp
来自「简单的asp论坛源码系统,很适用于初学者!界面简洁,功能齐全」· ASP 代码 · 共 547 行 · 第 1/2 页
ASP
547 行
'Else standrd editor is used so convert forum codes
Else
'Call the function to format posts
strMessage = FormatPost(strMessage)
End If
'If the user wants forum codes enabled then format the post using them
If Request.Form("forumCodes") Then strMessage = FormatForumCodes(strMessage)
'Check the message for malicious HTML code
strMessage = HTMLsafe(strMessage)
'Replace swear words with other words with ***
'Initalise the SQL string with a query to read in all the words from the smut table
strSQL = "SELECT " & strDbTable & "Smut.* FROM " & strDbTable & "Smut" & strDBNoLock & ";"
'Open the recordset
rsCommon.Open strSQL, adoCon
'Loop through all the words to check for
Do While NOT rsCommon.EOF
'Replace the swear words with the words in the database the swear words
strMessage = Replace(strMessage, rsCommon("Smut"), rsCommon("Word_replace"), 1, -1, 1)
strSubject = Replace(strSubject, rsCommon("Smut"), rsCommon("Word_replace"), 1, -1, 1)
'Move to the next word in the recordset
rsCommon.MoveNext
Loop
'Release server objects
rsCommon.Close
'Send (save) the private message
'Initalise the SQL string (ADO is used for more security)
strSQL = "SELECT" & strDBTop1 & " " & strDbTable & "PMMessage.* " & _
"FROM " & strDbTable & "PMMessage" & strRowLock & " " & _
"WHERE " & strDbTable & "PMMessage.Author_ID = " & lngToUserID & " " & _
"ORDER BY " & strDbTable & "PMMessage.PM_ID DESC" & strDBLimit1 & ";"
With rsCommon
'Set the Lock Type for the records so that the record set is only locked when it is updated
.LockType = 3
'Open the recordset
.Open strSQL, adoCon
'Check to make sure the message is not already sent to the user
If NOT .EOF Then
If strMessage = rsCommon("PM_Message") Then blnMessageSent = True
End IF
'Save the pm
If blnMessageSent = False Then
'Add new record to recordset
.AddNew
.Fields("Author_ID") = lngToUserID
.Fields("From_ID") = lngLoggedInUserID
.Fields("PM_Tittle") = strSubject
.Fields("PM_Message") = strMessage
.Fields("PM_Message_date") = internationalDateTime(Now())
'Check to see if they want e-mail notification of read pm
If blnLoggedInUserEmail = True AND blnReadEmailNotify = True Then
.Fields("Email_notify") = strDBTrue
Else
.Fields("Email_notify") = strDBFalse
End If
.Update
'Update booleon that message is sent
blnMessageSent = true
'Requery to get message ID
.Requery
lngPmMessageID = .Fields("PM_ID")
End If
'Clean up
.Close
End With
'When calling the updateUnreadPM function next, it can change the number of displayed un-read PM's for the PM sender
'To prevent this bug, we store the number of un-read PM's for the sender in a temp store
intTmpPMno = intNoOfPms
'Update the number of unread PM's for the recepient
Call updateUnreadPM(lngToUserID)
'Restore the number of un-read PM's for the PM sender
intNoOfPms = intTmpPMno
'If the person has requested an email sent to them notifying them of the PM then send it
If blnEmail AND blnPMNotify AND strToEmail <> "" Then
'Set the subject
strEmailSubject = strMainForumName & " " & strTxtNotificationPM
'Initailise the e-mail body variable with the body of the e-mail
strEmailBody = strTxtHi & " " & decodeString(strToUsername) & "," & _
vbCrLf & vbCrLf & strTxtThisIsToNotifyYouThat & " '" & strLoggedInUsername & "' " & strTxtHasSentYouPM & ", '" & decodeString(strSubject) & "', " & strTxtOn & " " & strMainForumName & "." & _
vbCrLf & vbCrLf & strTxtToViewThePrivateMessage & " " & strTxtForumClickOnTheLinkBelow & ": -" & _
vbCrLf & vbCrLf & strForumPath & "pm_message.asp?ID=" & lngPmMessageID
'Call the function to send the e-mail
blnEmailSent = SendMail(strEmailBody, decodeString(strToUsername), decodeString(strToEmail), strMainForumName, decodeString(strForumEmailAddress), decodeString(strEmailSubject), strMailComponent, false)
End If
End If
'Set bread crumb trail
strBreadCrumbTrail = strBreadCrumbTrail & strNavSpacer & "<a href=""pm_welcome.asp" & strQsSID1 & """>" & strTxtPrivateMessenger & "</a>" & strNavSpacer & strTxtSendPrivateMessage
%>
<!-- #include file="includes/browser_page_encoding_inc.asp" -->
<meta name="generator" content="Web Wiz Forums" />
<title><% = strTxtPrivateMessenger & ": " & strTxtSendPrivateMessage %></title>
<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
Response.Write("<!--//" & _
vbCrLf & "/* *******************************************************" & _
vbCrLf & "Software: Web Wiz Forums(TM) ver. " & strVersion & "" & _
vbCrLf & "Info: http://www.webwizforums.com" & _
vbCrLf & "Copyright: (C)2001-2008 Web Wiz(TM). All rights reserved" & _
vbCrLf & "******************************************************* */" & _
vbCrLf & "//-->" & vbCrLf & vbCrLf)
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
%>
<link href="<% = strCSSfile %>default_style.css" rel="stylesheet" type="text/css" />
<!-- #include file="includes/header.asp" -->
<!-- #include file="includes/status_bar_header_inc.asp" -->
<table class="basicTable" cellspacing="0" cellpadding="3" align="center">
<tr>
<td align="left"><h1><% = strTxtPrivateMessenger %></h1></td>
</tr>
</table>
<br />
<table class="basicTable" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="tabTable">
<a href="pm_welcome.asp<% = strQsSID1 %>" title="<% = strTxtPrivateMessenger %>" class="tabButton"> <img src="<% = strImagePath %>messenger.<% = strForumImageType %>" border="0" alt="<% = strTxtPrivateMessenger %>" /> <% = strTxtMessenger %></a>
<a href="pm_inbox.asp<% = strQsSID1 %>" title="<% = strTxtPrivateMessenger & " " & strTxtInbox %>" class="tabButton"> <img src="<% = strImagePath %>inbox_messages.<% = strForumImageType %>" border="0" alt="<% = strTxtPrivateMessenger & " " & strTxtInbox %>" /> <% = strTxtInbox %></a>
<a href="pm_outbox.asp<% = strQsSID1 %>" title="<% = strTxtPrivateMessenger & " " & strTxtOutbox %>" class="tabButton"> <img src="<% = strImagePath %>sent_messages.<% = strForumImageType %>" border="0" alt="<% = strTxtPrivateMessenger & " " & strTxtOutbox %>" /> <% = strTxtOutbox %></a>
<a href="pm_new_message_form.asp<% = strQsSID1 %>" title="<% = strTxtNewPrivateMessage %>" class="tabButtonActive"> <img src="<% = strImagePath %>new_message.<% = strForumImageType %>" border="0" alt="<% = strTxtNewPrivateMessage %>" /> <% = strTxtNewMessage %></a>
</td>
</tr>
</table>
<br /><%
'If the pm has been sent show a message saying so
If blnMessageSent Then
%>
<table cellspacing="1" cellpadding="3" class="tableBorder" align="center">
<tr class="tableLedger">
<td align="left"><% = strTxtSendPrivateMessage %></td>
</tr>
<tr class="tableRow">
<td><% = strTxtYourPrivateMessage %> "<% = Server.HTMLEncode(strSubject) %>", <% = strTxtHasBeenSentTo & " " & strToUsername %>.
<br /><br /><a href="pm_welcome.asp<% = strQsSID1 %>"><% = strTxtReturnToYourPrivateMessenger %></a></td>
</tr>
</table><%
'Else an error has occurred
Else
%>
<form method="post" name="frmEditMessage" id="frmEditMessage" action="pm_new_message_form.asp?code=edit<% = strQsSID2 %>" onSubmit="return CheckForm();" onReset="return ResetForm();">
<table class="errorTable" cellspacing="1" cellpadding="3" align="center">
<tr>
<td><img src="<% = strImagePath %>error.png" alt="<% = strTxtError %>" /> <strong><% = strTxtError %></strong></td>
</tr>
<tr>
<td><%
'Display message to user
If blnToUsernameOK = False Then
'Display an error message
Response.Write(strTxtYourPrivateMessage & " "" & strSubject & "", " & strTxtHasNotBeenSent)
Response.Write("<br /><br />" & strTxtTheUsernameCannotBeFound)
Response.Write("<br /><br /><a href=""javascript:document.frmEditMessage.submit();"">" & strTxtAmendYourPrivateMessage & "</a>")
'Save the pm details so they can be edited
Response.Write(vbCrLf & " <input type=""hidden"" name=""Subject"" id=""Subject"" value=""" & strSubject & """>")
Response.Write(vbCrLf & " <input type=""hidden"" name=""Buddy"" id=""Buddy"" value=""" & strToUsername & """>")
Response.Write(vbCrLf & " <input type=""hidden"" name=""PmMessage"" id=""PmMessage"" value=""" & Request.Form("Message") & """>")
'If the message is blocked
ElseIf blnBlocked Then
'Display an error message
Response.Write(strTxtYourPrivateMessage & " "" & strSubject & "", " & strTxtHasNotBeenSent)
Response.Write("<br /><br />" & strTxtYouAreBlockedFromSendingPMsTo & " " & strToUsername & ".")
Response.Write("<br /><br /><a href=""pm_welcome.asp" & strQsSID1 & """>" & strTxtReturnToYourPrivateMessenger & "</a>")
'Max PM's recieved
ElseIf blnMaxPMsOK = False Then
'Display an error message
Response.Write(strTxtYourPrivateMessage & " "" & strSubject & "", " & strTxtHasNotBeenSent)
Response.Write("<br /><br />" & strToUsername & " " & strTxtHasExceededMaxNumPPMs & ".")
Response.Write("<br /><br /><a href=""pm_welcome.asp" & strQsSID1 & """>" & strTxtReturnToYourPrivateMessenger & "</a>")
'Flood Control
ElseIf blnFloodControl Then
'Display an error message
Response.Write(strTxtYourPrivateMessage & " "" & strSubject & "", " & strTxtHasNotBeenSent)
Response.Write("<br /><br />" & strTxtYouAreOnlyPerToSend & " " & intPmFlood & " " & strTxtYouHaveExceededLimit & ".")
Response.Write("<br /><br /><a href=""pm_welcome.asp" & strQsSID1 & """>" & strTxtReturnToYourPrivateMessenger & "</a>")
'If there is no message body or subject display an error message
ElseIf blnNoSubject Then
'Display an error message
Response.Write(strTxtYourPrivateMessage & " "" & strSubject & "", " & strTxtHasNotBeenSent)
Response.Write("<br /><br />" & strTxtYourMessageNoValidSubjectHeading)
Response.Write("<br /><br /><a href=""pm_new_message_form.asp?code=edit" & strQsSID2 & """>" & strTxtAmendYourPrivateMessage & "</a>")
'Save the pm details so they can be edited
Response.Write(vbCrLf & " <input type=""hidden"" name=""Subject"" id=""Subject"" value=""" & strSubject & """>")
Response.Write(vbCrLf & " <input type=""hidden"" name=""Buddy"" id=""Buddy"" value=""" & strToUsername & """>")
Response.Write(vbCrLf & " <input type=""hidden"" name=""PmMessage"" id=""PmMessage"" value=""" & Request.Form("Message") & """>")
End If
%></td>
</tr>
</table>
</form><%
End If
%>
<br />
<div align="center">
<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
If blnLCode = True Then
If blnTextLinks = True Then
Response.Write("<span class=""text"" style=""font-size:10px"">Bulletin Board Software by <a href=""http://www.webwizforums.com"" target=""_blank"" style=""font-size:10px"">Web Wiz Forums®</a> version " & strVersion & "</span>")
Else
Response.Write("<a href=""http://www.webwizforums.com"" target=""_blank""><img src=""webwizforums_image.asp"" border=""0"" title=""Bulletin Board Software by Web Wiz Forums® version " & strVersion& """ alt=""Bulletin Board Software by Web Wiz Forums® version " & strVersion& """ /></a>")
End If
Response.Write("<br /><span class=""text"" style=""font-size:10px"">Copyright ©2001-2008 <a href=""http://www.webwizguide.com"" target=""_blank"" style=""font-size:10px"">Web Wiz</a></span>")
End If
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
'Release server objects
Call closeDatabase()
'Display the process time
If blnShowProcessTime Then Response.Write "<span class=""smText""><br /><br />" & strTxtThisPageWasGeneratedIn & " " & FormatNumber(Timer() - dblStartTime, 3) & " " & strTxtSeconds & "</span>"
%>
</div>
<!-- #include file="includes/footer.asp" -->
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?