?? sms.asp
字號:
<!--#include file="MarcosCB.asp"-->
<%
getConn()
isIn()
dim page,mood,smsId,userId,theAct,oldAct,title,content,toUser,smsInfo,fromUser,userName
page=getPost("page")
smsId=getPost("smsId")
userId=getPost("userId")
theAct=getPost("theAct")
oldAct=getPost("oldAct")
mood=getPost("mood")
title=getPost("title")
content=getPost("content")
toUser=split(replace(getPost("toUser"),"'","''"),",")
fromUser=getValue("userName")
userName=replace(getPost("userName"),"'","''")
if not isNumeric(page) then
page=1
end if
if getValue("userMessage")<>"" then
setValue "userMessage",""
end if
if userId="" or not isNumeric(userId) then
userId=getValue("userId")
end if
if theAct="" then
theAct="inBox"
end if
if userId<>getValue("userId") then
isAdmin()
end if
select case theAct
case "add"
for i=0 to uBound(toUser)
if not isExists(toUser(i)) then
echo "<script>alert('對不起,請確認接收方全部存在!');history.back();</script>"
closeConn()
response.end
end if
if lcase(toUser(i))=lcase(getValue("userName")) then
echo "<script>alert('自己發給自己?系統還沒學會哦~~');history.back();</script>"
closeConn()
response.end
end if
next
if getPost("toUser")="" or title="" or content="" then
echo "<script>alert('請完整填寫短信接收者,標題及內容!');history.back();</script>"
closeConn()
response.end
end if
if request.cookies("smsTitle")=title or request.cookies("smsContent")=content then
echo "<script>alert('短信正在發送,請不要著急!');history.back();</script>"
closeConn()
response.end
end if
if getStrLen(title)>255 or getStrLen(content)>255 then
echo "<script>alert('對不起,短信標題和正文各自最多只能接受255個字符!');history.back();</script>"
closeConn()
response.end
end if
for i=0 to uBound(toUser)
sql="Marcos_Message"
rs.open sql,conn,1,3
rs.addNew
rs("fromUser")=fromUser
rs("toUser")=toUser(i)
rs("smsTitle")=title
rs("smsContent")=content
rs("smsMood")=mood
rs("smsTime")=now()
rs.update
rs.close
next
response.cookies("smsTitle")=title
response.cookies("smsContent")=content
echo "<script>alert('發送成功!');location.href='sms.asp?theAct=outBox&userId="&userId&"';</script>"
closeConn()
response.end
case "del"
if lcase(userName)<>lcase(replace(getValue("userName"),"'","''")) then
isAdmin()
end if
if oldAct="inBox" then
sql="update Marcos_Message set toRecycled=true,smsTime='"&now()&"' where toUser='"&userName&"' and smsId="&smsId
end if
if oldAct="outBox" then
sql="update Marcos_Message set fromRecycled=true,smsTime='"&now()&"' where fromUser='"&userName&"' and smsId="&smsId
end if
if oldAct="recycledBox" then
sql="select fromRecycled,toRecycled from Marcos_Message where smsId="&smsId
set rs_sys=conn.execute(sql)
if rs_sys.eof then
echo "錯誤的短信參數!"
closeConn()
response.end
end if
if rs_sys(0)=true and rs_sys(1)=true then
sql="delete from Marcos_Message where (fromUser='"&userName&"' or toUser='"&userName&"') and smsId="&smsId
else
echo "<script>alert('對不起,對方還沒有刪除該短信,所以無法執行完全刪除.');history.back();</script>"
closeConn()
response.end
end if
end if
conn.execute(sql)
locate "sms.asp?theAct="&oldAct&"&userId="&userId&"&page="&page
case "setRead"
if lcase(userName)<>lcase(getValue("userName")) then
isAdmin()
end if
sql="update Marcos_Message set isRead=True where smsId="&smsId
conn.execute(sql)
locate "sms.asp?theAct=inBox&page="&page&"&userId="&userId
case "unRead"
if lcase(userName)<>lcase(replace(getValue("userName"),"'","''")) then
isAdmin()
end if
sql="update Marcos_Message set isRead=False where smsId="&smsId
conn.execute(sql)
locate "sms.asp?theAct=inBox&page="&page&"userId="&userId
end select
str=getMainCode(mySkinId)
pageTitle="<a href=""sms.asp?userId="&userId&""">用戶短信服務</a>"
pageOther="<script>document.title+=' - 用戶短信服務';</script>"
nowWhere "用戶短信服務","javascript:;"
showHead str,pageTitle,pageOther
select case theAct
case "inBox","outBox","recycledBox"
showBody()
case "new","reply"
showNew()
end select
showFoot str
sub showBody()
pageCode=getPageCode(mySkinId,"PageShow")
PageSMS=split(pageCode,"$$$")
body=PageSMS(0)
sql="select count(smsId) from Marcos_Message where toUser='"&replace(getValue("userName"),"'","''")&"' and toRecycled=false"
set rs_sys=conn.execute(sql)
if rs_sys(0)>80 then
sql="select top "&(rs_sys(0)-80)&" smsId from Marcos_Message where toUser='"&replace(getValue("userName"),"'","''")&"' and toRecycled=false order by isRead,smsTime"
set rs_sys=conn.execute(sql)
do until rs_sys.eof
conn.execute("delete from Marcos_Message where smsId="&rs_sys(0))
rs_sys.movenext
loop
end if
queryTimes=queryTimes+1
select case theAct
case "inBox"
theBox="收件箱"
case "outBox"
theBox="發件箱"
case "recycledBox"
theBox="回收站"
end select
body=replace(body,"標題:{$topicTitle}","我的短信"&theBox&"{$smsInfo}")
body=replace(body,"{$pageList}","<a href=""?theAct=new&userId="&userId&""">發短信|</a><a href=""?theAct=inBox&userId="&userId&""">收件箱|</a><a href=""?theAct=outBox&userId="&userId&""">發件箱|</a><a href=""?theAct=recycledBox&userId="&userId&""">回收站|</a>")
select case theAct
case "inBox"
sql="select Marcos_Message.*,Marcos_User.* from Marcos_Message,Marcos_User where fromUser=Marcos_User.userName and toUser='"&replace(getValue("userName"),"'","''")&"' and toRecycled=false order by isRead desc,smsTime desc"
case "outBox"
smsInfo=" <font class=warningColor>(不占用您的空間)</color>"
sql="select Marcos_Message.*,Marcos_User.* from Marcos_Message,Marcos_User where toUser=Marcos_User.userName and fromUser='"&replace(getValue("userName"),"'","''")&"' and fromRecycled=false order by isRead desc,smsTime desc"
case "recycledBox"
smsInfo=" <font class=warningColor>(系統定期清空,不占用您的空間)</color>"
sql="select Marcos_Message.*,Marcos_User.* from Marcos_Message,Marcos_User where (toUser='"&replace(getValue("userName"),"'","''")&"' and toRecycled=true and fromUser=Marcos_User.userName) or (fromUser='"&replace(getValue("userName"),"'","''")&"' and fromRecycled=true and toUser=Marcos_User.userName) order by isRead desc,smsTime desc"
end select
rs.open sql,conn,1,1
rs.pageSize=showNum
if not rs.eof then
rs.absolutePage=page
else
body=body&"<tr height=""180""><td align=center colspan=2>當前"&theBox&"中無內容</td></tr>"
end if
for i=1 to rs.pageSize
if rs.eof then
exit for
end if
body=body&PageSMS(1)
body=replace(body,"發表","發送")
body=replace(body,"引用","回復")
body=replace(body,"編輯","刪除")
if rs("fromUser")=getValue("userName") then
colUser="toUser"
colUserRev="fromUser"
body=replace(body,"{$userName}","接收:"&rs("toUser"))
else
colUser="fromUser"
colUserRev="toUser"
body=replace(body,"{$userName}","發送:"&rs("fromUser"))
end if
body=replace(body,"{$content}","<img src=""" & rs("smsMood") & """>" & rs("smsTitle") & "<br>" & mUbb(rs("smsContent")))
body=replace(body,"{$addTime}",mid(rs("smsTime"),3))
body=replace(body,"{$userArticle}",rs("userArticle"))
body=replace(body,"{$userWealth}",rs("userWealth"))
body=replace(body,"{$userLevelTxt}",getUserLevel(rs("userWealth"),rs("userLevel")))
body=replace(body,"{$userGroup}",rs("userGroup"))
body=replace(body,"{$regTime}",rs("regDate"))
body=replace(body,"{$userSign}",rs("userSign"))
userPic=fixNull(rs("userPic"))
body=replace(body,"{$userPic}",getUserPic(userPic))
if theAct="inBox" then
smsInfo=" <font class=warningColor>(共"&rs.recordCount&"條,上限80條,超限自動刪除)</color>"
if rs("isRead") then
otherLink="<a href=""?theAct=unRead&userId="&userId&"&userName="&rs(colUserRev)&"&page="&page&"&smsId="&rs("smsId")&""">已閱|</a>"
else
otherLink="<a href=""?theAct=setRead&userId="&userId&"&userName="&rs(colUserRev)&"&page="&page&"&smsId="&rs("smsId")&"""><font color=warningColor>未閱|</font></a>"
end if
end if
editLink="?theAct=del&oldAct="&theAct&"&page="&page&"&userId="&userId&"&userName="&rs(colUserRev)&"&smsId="&rs("smsId")
quotaLink="?theAct=reply&title="&rs("smsTitle")&"&toUser="&rs(colUser)&"&content="&rs("smsContent")
body=replace(body,"{$editLink}",editLink)
body=replace(body,"{$otherLink}",otherLink)
body=replace(body,"{$quotaLink}",quotaLink)
rs.movenext
next
for i=1 to rs.pageCount
pageList=pageList&"<a href=""?theAct="&theAct&"&page="&i&"&userId="&userId&"""><font {$pageNum"&i&"}>"&i&"</font></a> "
next
pageList=replace(pageList,"{$pageNum"&page&"}","class=warningColor")
rs.close
queryTimes=queryTimes+1
body=body&PageSMS(2)
body=replace(body,"{$smsInfo}",smsInfo)
body=replace(body,"{$pageList}",pageList)
body=replace(body,"{$newReply}","<img src=""Images/{$styleRoot}/newReply.gif""><a href=""?theAct=new&userId="&userId&""">發送短信</a>")
echo body
end sub
sub showNew()
pageCode=getPageCode(mySkinId,"PageFormX")
PageSMS=split(pageCode,"$$$")
body="<tr><td align=right height=20>接收:</td><td> <input type=text name=toUser value=""{$toUser}""> 多個用戶請用"",""隔開</td></tr>"
body=PageSMS(0)&body&PageSMS(2)
select case theAct
case "new"
body=replace(body,"{$formTitle}","發送新短信")
body=replace(body,"{$title}","")
body=replace(body,"{$moodSelected}","")
body=replace(body,"{$content}","")
body=replace(body,"{$toUser}","")
body=replace(body,"{$theAct}","add")
body=replace(body,"{$boardId}","0")
body=replace(body,"{$boardName}","用戶短信服務")
body=replace(body,"帖子內容","短信正文")
case "reply"
body=replace(body,"{$formTitle}","發送新短信(回復)")
body=replace(body,"{$title}","RE:"&title&"")
body=replace(body,"{$moodSelected}","")
body=replace(body,"{$content}",vbNewLine&vbNewLine&"[quota][b]以下是您的短信內容:[/b]"&vbNewLine&content&"[/quota]")
body=replace(body,"{$toUser}",getPost("toUser"))
body=replace(body,"{$boardId}","0")
body=replace(body,"{$boardName}","用戶短信服務")
body=replace(body,"{$theAct}","add")
body=replace(body,"帖子內容","短信正文")
end select
echo body
end sub
closeConn()
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -