%
RecipientUserName=HTMLEncode(Request("RecipientUserName"))
UserName=HTMLEncode(Request("UserName"))
Subject=HTMLEncode(Request("Subject"))
Body=HTMLEncode(Request("Body"))
box=HTMLEncode(Request("box"))
MessageID=RequestInt("MessageID")
ForumID=RequestInt("ForumID")
MaxPrivateMessageSize=SiteConfig("MaxPrivateMessageSize")
if Request("menu")="Post" then
if CookieUserName=empty then Alert("您还未登录论坛")
if MessageID > 0 then
Rs.open "select * from [BBSXP_PrivateMessages] where MessageID="&MessageID&"",conn,1
if not rs.eof then
Subject=Rs("Subject")
Body=replace(Rs("Body"),"
",vbcrlf)
end if
if RecipientUserName<>empty then '回复
Subject="RE: "&Subject
Body=""
else '转发
Body=vbcrlf&vbcrlf&vbcrlf&vbcrlf&"------------------------------------"&vbcrlf&"日期: "&Rs("CreateTime")&vbcrlf&"发件人: "&Rs("SenderUserName")&vbcrlf&"收件人: "&Rs("RecipientUserName")&vbcrlf&"主题: "&Subject&vbcrlf&vbcrlf&Body&""
Subject="FW: "&Subject
end if
Rs.close
end if
Response.clear
%>
发送讯息
<%
elseif Request("menu")="addPost" then
if CookieUserName=empty then Alert("您还未登录论坛")
IsSaveOutbox=RequestInt("IsSaveOutbox")
IsSenderDelete=0
if IsSaveOutbox=0 then IsSenderDelete=1
if Len(Subject)<2 then Alert("标题不能小于 2 字符")
if Len(Body)<2 then Alert("内容不能小于 2 字符")
if RecipientUserName="" or Lcase(RecipientUserName)=Lcase(CookieUserName) then Alert("请输入接收的对象且不能是自己")
if Conn.Execute("Select UserID From [BBSXP_Users] where UserName='"&RecipientUserName&"'").eof Then Alert("系统不存在"&RecipientUserName&"的资料")
if IsSaveOutbox=1 and Conn.Execute("Select count(MessageID) From [BBSXP_PrivateMessages] where RecipientUserName='"&CookieUserName&"' and IsRecipientDelete=0 or SenderUserName='"&CookieUserName&"' and IsSenderDelete=0")(0)>MaxPrivateMessageSize Then Alert("您的短信箱已满不能保存短讯!本次发送失败!")
if Conn.Execute("Select count(MessageID) From [BBSXP_PrivateMessages] where RecipientUserName='"&RecipientUserName&"' and IsRecipientDelete=0 or SenderUserName='"&RecipientUserName&"' and IsSenderDelete=0")(0)>MaxPrivateMessageSize Then Alert("用户"&RecipientUserName&"的短信箱已满!本次发送失败!")
sql="insert into [BBSXP_PrivateMessages](SenderUserName,RecipientUserName,Subject,Body,IsSenderDelete) values ('"&CookieUserName&"','"&RecipientUserName&"','"&Subject&"','"&Body&"',"&IsSenderDelete&")"
Conn.Execute(sql)
Conn.execute("update [BBSXP_Users] set NewMessage=NewMessage+1 where UserName='"&RecipientUserName&"'")
%>
<%
else
if CookieUserName=empty then error("您还未登录论坛")
HtmlTop
RecipientCount=conn.execute("select count(messageID) from [BBSXP_PrivateMessages] where RecipientUserName='"&CookieUserName&"' and IsRecipientDelete=0 or SenderUserName='"&CookieUserName&"' and IsSenderDelete=0")(0)
UsedMessageSize=RecipientCount/MaxPrivateMessageSize*100
%>
<%ClubTree%> → 短信服务
| 文件夹 |
收件箱[<%=conn.execute("select count(messageID) from [BBSXP_PrivateMessages] where RecipientUserName='"&CookieUserName&"' and IsRecipientDelete=0")(0)%>] |
已发送[<%=conn.execute("select count(messageID) from [BBSXP_PrivateMessages] where SenderUserName='"&CookieUserName&"' and IsSenderDelete=0")(0)%>] |
|
<%=UsedMessageSize%>% (<%=RecipientCount%>/<%=MaxPrivateMessageSize%>) |
|
|
<%
select case Request("menu")
case "Read"
ReadMessage
case "Delete"
for each ho in Request("MessageID")
ho=int(ho)
rs.open "select * from [BBSXP_PrivateMessages] where ( RecipientUserName='"&CookieUserName&"' or SenderUserName='"&CookieUserName&"' ) and MessageID="&ho&"",Conn,1,3
if LCASE(rs("RecipientUserName"))=LCASE(CookieUserName) then rs("IsRecipientDelete")=1
if LCASE(rs("SenderUserName"))=LCASE(CookieUserName) then rs("IsSenderDelete")=1
rs.update
rs.close
next
Conn.execute("Delete from [BBSXP_PrivateMessages] where IsRecipientDelete=1 and IsSenderDelete=1")
response.redirect("?")
case else
InOutbox
end select
%> |
<%
Sub InOutbox
MessageMenu=Request("Menu")
if MessageMenu=empty then MessageMenu="Inbox"
if MessageMenu="Inbox" then
tdstr="发件人 | "
sql="select * from [BBSXP_PrivateMessages] where RecipientUserName='"&CookieUserName&"' and IsRecipientDelete=0 order by MessageID Desc"
else
tdstr="收件人 | "
sql="select * from [BBSXP_PrivateMessages] where SenderUserName='"&CookieUserName&"' and IsSenderDelete=0 order by MessageID Desc"
end if
%>
<%
End Sub
Sub ReadMessage
if box="Inbox" then
FieldName="RecipientUserName"
DeleteFieldName="IsRecipientDelete"
else
FieldName="SenderUserName"
DeleteFieldName="IsSenderDelete"
end if
if Request("pageIndex")="previous" then
SQL="select top 1 * from [BBSXP_PrivateMessages] where "&FieldName&"='"&CookieUserName&"' and "&DeleteFieldName&"=0 and MessageID>"&MessageID&" order by messageID"
elseif Request("pageIndex")="next" then
SQL="select top 1 * from [BBSXP_PrivateMessages] where "&FieldName&"='"&CookieUserName&"' and "&DeleteFieldName&"=0 and MessageID<"&MessageID&" order by messageID desc"
else
SQL="select * from [BBSXP_PrivateMessages] where (RecipientUserName='"&CookieUserName&"' or SenderUserName='"&CookieUserName&"') and MessageID="&MessageID&""
end if
Rs.Open SQL,Conn,1,3
if ReturnUrl="" then ReturnUrl="Default.asp"
if Rs.eof then response.redirect ReturnUrl
%>
<%
if LCASE(Rs("RecipientUserName"))=LCASE(CookieUserName) and Rs("IsRead")=0 then Rs("IsRead")=1
Rs.update
Rs.close
End Sub
HtmlBottom
end if
%>