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

📄 sms.asp

📁 程序网络论坛HigroupBBS v4.00 默认管理员帐号密码都是Marcos
💻 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>&nbsp; <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 + -