message.asp

来自「小游戏网站演示www.4399.io 拥有4万条游戏数据」· ASP 代码 · 共 551 行 · 第 1/2 页

ASP
551
字号
<!--#include file="config.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/ubbcode.asp"-->
<!--#include file="../inc/cls_editor.asp"-->
<!--#include file="head.inc"-->
<%
Call InnerLocation("用户短信服务")

Dim Rs,SQL,i,Action
Dim smsincept,smscontent,smstopic,sid,sendername,Chatloglist

sid = Newasp.ChkNumeric(Request("sid"))

If CInt(GroupSetting(22)) = 0 Then
	ErrMsg = ErrMsg + "<li>对不起!您没有使用短信服务的权限,如有什么问题请联系管理员。</li>"
	Founderr = True
End If
If Trim(Request("touser")) <> "" Then
	sendername = Newasp.CheckBadstr(Request("touser"))
	smsincept =  Newasp.CheckBadstr(Request("touser"))
Else
	sendername = Newasp.CheckBadstr(Request("sender"))
End If
Chatloglist = ""
Action = LCase(Request("action"))
Select Case Trim(Action)
	Case "del"
		Call DelMessage
	Case "alldel"
		Call DelAllMessage
	Case "save"
		Call SaveMessage
	Case "read"
		Call ReadMessage
	Case "outread"
		Call ReadMessage
	Case "new"
		Call SendMessage
	Case "fw"
		Call SendMessage
	Case "删除收件箱"
		Call Delinbox
	Case "清空收件箱"
		Call DelAllinbox
	Case "删除发件箱"
		Call DelSendbox
	Case "清空发件箱"
		Call DelAllSendbox
	Case Else
		ErrMsg = ErrMsg + "<li>错误的系统参数~!</li>"
		Founderr = True
End Select
If Founderr = True Then
	Call Returnerr(ErrMsg)
End If

Sub SendMessage()
	Call UserMessage
	If Founderr = True Then Exit Sub
%>
<script language=JavaScript>
var _maxCount = '<%=CLng(GroupSetting(23))%>';
function DoTitle(addTitle) {  
 var revisedTitle;  
 var currentTitle = document.myform.incept.value;
 if(currentTitle=="") revisedTitle = addTitle; 
 else { 
  var arr = currentTitle.split(","); 
  for (var i=0; i < arr.length; i++) { 
   if( addTitle.indexOf(arr[i]) >=0 && arr[i].length==addTitle.length ) return; 
  } 
  revisedTitle = currentTitle+","+addTitle; 
 } 

 document.myform.incept.value=revisedTitle;  
 document.myform.incept.focus(); 
 return; 
} 

function doSubmit(){
	var form1 = document.myform;
	if (form1.incept.value==""){
		alert("收件人不能为空!");
		form1.incept.focus();
		return false;
	}
	if (form1.topic.value==""){
		alert("短信标题不能为空!");
		form1.topic.focus();
		return false;
	}
	<%If CInt(GroupSetting(2)) = 1 Then%>
	if (form1.codestr.value==""){
		alert("请填写验证码!");
		form1.codestr.focus();
		return false;
	}
	<%End If%>
	MessageLength = form1.content.value.length;
	if(MessageLength < 2){
		alert("短信内容不能小于2个字符!");
		form1.content.focus();
		return false;
	}
	if(MessageLength > _maxCount){
		alert("短信的内容不能超过"+_maxCount+"个字符!");
		return false;
	}
}
</script>

<table class="Usertableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<form action="message.asp" method="post" onsubmit="return doSubmit()" name="myform">
	<input type="hidden" name="action" value="save"/>
			<tr>
				<th colspan="2">站内短消息</th>
			</tr>
			<%
	Call MessageTop
%>
			<tr>
				<td class="Usertablerow1">收件人</td>
				<td class="Usertablerow1"><input size="50" name="incept" value="<%=smsincept%>" type="text" /> <select onchange="DoTitle(this.options[this.selectedIndex].value)" name="friend">
				<option value="" selected="selected">选择</option>
				</select></td>
			</tr>
			<tr>
				<td class="Usertablerow1">标题</td>
				<td class="Usertablerow1"><input maxlength="70" size="70" name="topic" value="<%=smstopic%>" type="text" /></td>
			</tr>
			<%
	If CInt(GroupSetting(2)) = 1 Then
%>
			<tr>
				<td class="Usertablerow1">验证码</td>
				<td class="Usertablerow1"><input maxlength="5" size="5" name="codestr" type="text" />&nbsp;<img style="cursor: pointer" height="10" alt="验证码,看不清楚?请点击刷新验证码" onclick="this.src='../inc/getcode.asp?t='+(new Date().getTime());" src="../inc/getcode.asp" /></td>
			</tr>
			<%
	End If
%>
			<tr>
				<td class="Usertablerow1" nowrap="nowrap">短信内容</td>
				<td class="Usertablerow1"><%
	Dim oEditor
	Set oEditor = New Editor_Cls
	oEditor.UserMode		= 1
	oEditor.setEditMode		= 1
	oEditor.ChannelID		= 0
	oEditor.Width			= 520
	oEditor.Height			= 300
	oEditor.BasePath		= "../editor/"
	oEditor.ToolbarSet		= "Basic"'Default,AdminMode,Simple,UserMode,Basic
	oEditor.value			= smscontent
	oEditor.InstanceName	= "content"
	oEditor.Execute()
	Set oEditor = Nothing
%></td>
			</tr>
			<tr height="20">
				<td class="Usertablerow1" colspan="2"><strong>说明:</strong>标题最多50个字符,内容最多<%=CLng(GroupSetting(23))%>个字符。</td>
			</tr>
			<tr align="center" height="20">
				<td class="Usertablerow2" colspan="2"><input class="Button" type="button" onclick="javascript:history.go(-1)" name="Submit4" value="返回上一页" />&nbsp; <input class="button" type="reset" name="submit2" value=" 清除 " />&nbsp; <SCRIPT LANGUAGE="JavaScript">
<!--
var reaction='<%=Newasp.CheckStr(Request("reaction"))%>';
var action='new';
if (action=='new')
{
if (reaction=='chatlog')
{
document.write ('<input class="button" type="button" value="关闭聊天记录" name="chatlog" onclick="location.href=\'?action=new&sid=<%=Request("sid")%>&touser=<%=sendername%>\'"/>');
}
else{
document.write ('<input class="button" type="button" value="查看聊天记录" name="chatlog" onclick="location.href=\'?action=new&sid=<%=Request("sid")%>&touser=<%=sendername%>&reaction=chatlog\'"/>');
}
}
//-->
</SCRIPT><input class="button" type="submit" name="Submit1" value=" 发送 " /></td>
			</tr>
			<SCRIPT LANGUAGE="JavaScript">
<!--
var reaction='<%=Newasp.CheckStr(Request("reaction"))%>';
var chatloglist='<%=Chatloglist%>';
var myname='<%=MemberName%>';
var action='new';
if (action=='new')
{
if (reaction=='chatlog')
{
	document.write ('<tr>');
	document.write ('<th colspan=""2"">我与<%=sendername%>的聊天记录</th>');
	document.write ('</tr>');
	if (myname=='')
	{
		document.write ('<tr>');
		document.write ('<td class=""Usertablerow1"" colspan=""2"">自己跟自己的聊天记录没什么好看的:)</td>');
		document.write ('</tr>');
	}
	else{
		document.write (chatloglist);
	}
}
}
//-->
</SCRIPT>
	</form>
</table>
<%
End Sub

Sub MessageTop()
%>
	<tr align="center" height="20">
			<td class="Usertablerow1" colspan="2"><a onclick="showClick('您确定要删除此短信吗?')" href="message.asp?action=del&amp;sid=<%=Request("sid")%>"><img alt="删除消息" border="0" src="images/m_delete.gif" /></a> &nbsp; 
			<a href="message.asp?action=new"><img alt="发送消息" border="0" src="images/m_write.gif" /></a> &nbsp; 
			<a href="message.asp?action=new&amp;touser=<%=sendername%>&amp;sid=<%=Request("sid")%>"><img alt="回复消息" border="0" src="images/replypm.gif" /></a>&nbsp; 
			<a href="message.asp?action=fw&amp;sid=<%=Request("sid")%>"><img alt="转发消息" border="0" src="images/m_fw.gif" /></a></td>
	</tr>

<%
End Sub

Sub ReadMessage()
	If Founderr = True Then Exit Sub
	If Action = "outread" Then
		Set Rs = Newasp.Execute("SELECT * FROM NC_Message WHERE sender='"&MemberName&"' And delSend=0 And id="& CLng(sid))
	Else
		Set Rs = Newasp.Execute("SELECT * FROM NC_Message WHERE (incept='"&MemberName&"' Or flag=1) And id="& CLng(sid))
	End If
	If Rs.BOF And Rs.EOF Then
		ErrMsg = ErrMsg + "<li>错误的系统参数~!</li>"
		Founderr = True
		Set Rs = Nothing
		Exit Sub
	End If
	Dim smsnumber
	If Rs("isRead") = 0 And Action="read" Then
		smsnumber = newincept(Membername) - 1
		if smsnumber < 0 Then smsnumber = 0
		SQL = "UPDATE NC_User SET usermsg=" & smsnumber & " where username='"&Membername&"'"
		Newasp.Execute(SQL)
		if Rs("flag") = 0 Then
			SQL = "UPDATE NC_Message SET isRead=1 where id="& CLng(sid)
			Newasp.Execute(SQL)
		End If
	End If
%>
<table class="Usertableborder" cellspacing="1" cellpadding="3" align="center" bgcolor="#cccccc" border="0">
	<tbody>
		<tr>
			<th>阅读短消息</th>
		</tr>
		<%
	Call MessageTop
%>
		<tr height="20">
			<td class="Usertablerow2"> 在<strong><%=Rs("SendTime")%></strong>, <%
	If Action = "outread" Then
		Response.Write "您给<b>" & Server.HTMLEncode(Rs("incept")) & "</b>发送的消息!"
	Else
		Response.Write "<b>" & Server.HTMLEncode(Request("sender")) & "</b>给您发送的消息!"
	End If
%></td>
		</tr>
		<tr>
			<td class="Usertablerow1"><strong>短信标题:</strong><%=Rs("title")%><hr size="1" />
			<%=ubb.UbbCode(Rs("content"))%></td>
		</tr>
		<tr align="center" height="20">
			<td class="Usertablerow2" colspan="2"><input class="Button" type="button" onclick="javascript:history.go(-1)" name="Submit4" value="返回上一页" />&nbsp;</td>
		</tr>
	</tbody>
</table>
<%
	Set Rs = Nothing
End Sub

⌨️ 快捷键说明

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