⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendmess.asp

📁 电子商务网络购物系统
💻 ASP
字号:
<% Option Explicit %>
<!-- #include file="includes/header.asp" -->
<!--#include file="functions/formatpost.asp" -->
<!--#include file="includes/emoticons.asp" -->
<!--#include file="functions/sendmail.asp" -->
<%
Response.Buffer = True

Dim strToUsername
Dim lngToUserID		
Dim strSubject
Dim strMessage
Dim blnReadEmailNotify	
Dim blnToUsernameOK
Dim blnMaxPMsOK
Dim blnMessageSent	
Dim strEmailSubject
Dim strEmailBody
Dim blnEmailSent
Dim blnBlocked
Dim blnNoSubject
Dim intForumID
Dim strToEmail
Dim blnPMNotify

blnToUsernameOK = False
blnMaxPMsOK = False
blnMessageSent = False
blnBlocked = False
blnNoSubject = False

If bannedIP() Then
	Set rsConn = Nothing
	adoCon.Close
	Set adoCon = Nothing
	Response.Redirect("nopermission.asp?M=IP")
End If

If blnPrivateMessages = False Then
	Set rsConn = Nothing
	adoCon.Close
	Set adoCon = Nothing
	Response.Redirect("index.asp")
End If

If intGroupID = 2 OR blnActiveMember = False Then
	Set rsConn = Nothing
	adoCon.Close
	Set adoCon = Nothing
	Response.Redirect("nopermission.asp")
End If

strSubject = Trim(Mid(Request.Form("subject"), 1, 41))
strMessage = Request.Form("Message")
blnReadEmailNotify = CBool(Request.Form("email"))
strToUsername = Trim(Request.Form("member"))

If strToUsername = "" Then strToUsername = Trim(Request.Form("selectMember"))
strToUsername = Trim(Mid(strToUsername, 1, 15))
strToUsername = disallowedMemberNames(strToUsername)
strToUsername = formatSQLInput(strToUsername)
If strSubject = "" OR strMessage = "" Then blnNoSubject = True
strSQL = "SELECT timesuser.userid, timesuser.Username, timesuser.useremail, timesuser.messnotify "
strSQL = strSQL & "FROM timesuser "
strSQL = strSQL & "WHERE timesuser.Username = '" & strToUsername & "';"
rsConn.Open strSQL, adoCon
If NOT rsConn.EOF Then
	blnToUsernameOK = True
	lngToUserID = CLng(rsConn("userid"))
	strToEmail = rsConn("useremail")
	blnPMNotify = CBool(rsConn("messnotify"))
	If (lngToUserID = 2 OR intGroupID = 2) Then
		rsConn.Close
		Set rsConn = Nothing
		adoCon.Close
		Set adoCon = Nothing
		Response.Redirect("nopermission.asp")
	End If
	rsConn.Close
	strSQL = "SELECT timesfriend.friendid FROM timesfriend "
	strSQL = strSQL & "WHERE timesfriend.Block = 1 AND timesfriend.friendid = " & lngLoggedInUserID & " AND timesfriend.userid = " & lngToUserID & ";"
	rsConn.Open strSQL, adoCon
	If NOT rsConn.EOF AND blnAdmin = False Then blnBlocked = True
	rsConn.Close
	strSQL = "SELECT Count(timesmess.messid) AS CountOfPM FROM timesmess "
	strSQL = strSQL & "GROUP BY timesmess.userid "
	strSQL = strSQL & "HAVING timesmess.userid=" & lngToUserID & ";"
	rsConn.Open strSQL, adoCon
	If NOT rsConn.EOF Then
		If (CInt(rsConn("CountOfPM")) < intNumPrivateMessages) OR lngLoggedInUserID = 1 OR lngToUserID = 1 Then blnMaxPMsOK = True
	Else
		blnMaxPMsOK = True
	End If
	rsConn.Close
Else
	rsConn.Close
End If
If blnToUsernameOK AND blnMaxPMsOK AND blnBlocked = False AND blnNoSubject = False Then
	If Request.Form("browser") = "IE" Then
		strMessage = WYsiWYGFormatPost(strMessage)
	Else
		strMessage = FormatPost(strMessage)
	End If
	If Request.Form("forumCodes") Then strMessage = FormatForumCodes(strMessage)
	strMessage = checkHTML(strMessage)
	strSubject = removeAllTags(strSubject)
	strSubject = formatInput(strSubject)
	strSQL = "SELECT timesword.* FROM timesword"
	rsConn.Open strSQL, adoCon
	Do While NOT rsConn.EOF
		strMessage = Replace(strMessage, rsConn("mist"), rsConn("okworld"), 1, -1, 1)
		strSubject = Replace(strSubject, rsConn("mist"), rsConn("okworld"), 1, -1, 1)
		rsConn.MoveNext
	Loop
	rsConn.Close
	strSQL = "SELECT TOP 1 timesmess.* FROM timesmess WHERE timesmess.userid = " & lngToUserID & " ORDER BY timesmess.messdtm DESC;"

	With rsConn
		.CursorType = 2
		.LockType = 3
		.Open strSQL, adoCon
		If NOT .EOF Then
			If strMessage = rsConn("messmessage") Then blnMessageSent = True
		End IF
		If blnMessageSent = False Then
			.AddNew
			.Fields("userid") = lngToUserID
			.Fields("bbsid") = lngLoggedInUserID
			.Fields("messtitle") = strSubject
			.Fields("messmessage") = strMessage
			If blnLoggedInUserEmail = True AND blnReadEmailNotify = True Then
				.Fields("enotify") = 1
			Else
				.Fields("enotify") = 0
			End If
			.Update
		End If
		.Close
	End With
	If blnEmail AND blnPMNotify AND strToEmail <> "" Then
	
		strEmailSubject = strMainForumName & " 短信提醒"
		strEmailBody = "Hi" & " " & decodeString(strToUsername) & ","
		strEmailBody = strEmailBody & vbCrLf & vbCrLf &"这是提醒你"&" " & strLoggedInUsername & " 给你发了短信, " & decodeString(strSubject) 
		strEmailBody = strEmailBody & vbCrLf & vbCrLf & "要查看新短信" & " 单击下面的链接: -"
               
			    strEmailBody = strEmailBody & vbCrLf & vbCrLf & strForumPath & "/welcome.asp"
		blnEmailSent = SendMail(strEmailBody, decodeString(strToUsername), decodeString(strToEmail), strMainForumName, decodeString(strForumEmailAddress), strEmailSubject, strMailComponent, false)
	End If
End If
%>

<html>
<head>


<title>短信:发送新短信</title>

  <table width="96%" border="0" cellspacing="0" cellpadding="3" align="center">
 <tr>
  <td width="71%" class="bold"><img src="images/open.gif" border="0" align="absmiddle">&nbsp;<a href="index.asp" target="_self" class="boldLink"><% = strMainForumName %></a><% = strNavSpacer %><a href="index.asp" target="_self" class="boldLink">发送新短信</a><br /></td>
  </tr>
</table>
<table width="96%" border="0" cellspacing="0" cellpadding="4" align="center">
 <tr>
  <td width="60%"><span class="lgText"><img src="images/subject.gif" width="26" height="26" alt="主题" align="absmiddle"> 短信: 发送新短信</span></td>
  <td align="right" width="40%"><a href="inbox.asp" target="_self"><img src="images/inbox.gif" alt="短信: 收件夹" border="0"></a><a href="outbox.asp" target="_self"><img src="images/outbox.gif" alt="短信: 发件夹" border="0"></a><a href="friendlist.asp" target="_self"><img src="images/friends.gif" alt="通讯录" border="0"></a><a href="newmess.asp" target="_self"><img src="images/newmess.gif" alt="写新短信" border="0"></a></td>
 </tr>
</table>
<div align="center">
 <br />
 <br />
 <span class="text">
 <form method="post" name="frmEditMessage" action="newmess.asp?code=edit" onSubmit="return CheckForm();" onReset="return ResetForm();"><%
If blnToUsernameOK = False Then %>
<span class="lgText">你的短信 &quot;<%= strSubject %>&quot;, 没有发送!</span>
<br /><br />找不到你所输入的用户名
<br /><br /><a href="javascript:document.frmEditMessage.submit();">修改你的短信</a>
<input type="hidden" name="Subject" value="<%= strSubject %>">
<input type="hidden" name="Buddy" value="<%= strToUsername %>">
<input type="hidden" name="PmMessage" value="<%= Request.Form("Message") %>">
<% ElseIf blnBlocked = True Then %>
<span class="lgText">你的短信 &quot;<%= strSubject %>&quot;, 没有发送!</span>
<br /><br />你已被禁止给&nbsp;<b><%= strToUsername %></b>&nbsp;发短信
<br /><br /><a href="welcome.asp">回到你的信箱</a>
<% ElseIf blnMaxPMsOK = False Then %>
<span class="lgText">你的短信 &quot;<%= strSubject %>&quot;, 没有发送!</span>
<br /><br /><%= strToUsername %> 的信箱已满
<br /><br /><a href="welcome.asp">回到你的信箱</a>
<% ElseIf blnNoSubject = True Then %>
<span class="lgText">你的短信  &quot;<%= strSubject %>&quot;, 没有发送!</span>
<br /><br />你的短信缺少主题或者内容
<br /><br /><a href="newmess.asp?code=edi">修改你的短信</a>
<input type="hidden" name="Subject" value="<%= strSubject %>">
<input type="hidden" name="Buddy" value="<%= strToUsername %>">
<input type="hidden" name="PmMessage" value="<%= Request.Form("Message") %>">
<% Else %>
<span class="lgText"><img src="images/messsent.gif" width="32" height="32" align="absmiddle"> 你的短信 &quot;<%= strSubject %>&quot;, 成功发送给<%= strToUsername %>.</span>
<br /><br /><a href="welcome.asp">回到你的信箱</a>
<%
End If
%></form>
 </span>

<%
Set rsConn = Nothing
adoCon.Close
Set adoCon = Nothing
%>
 </div>
  <!-- #include file="includes/footer.asp" -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -