📄 pm.asp
字号:
<!--#include file="Connections.asp" -->
<!--#include file="top.asp" -->
<!--#include file="ubb.asp" -->
<%if isuser=false then
errormsg="<li>你还没有登陆,不能操作你的短信,请先<a href=login.asp target=_blank>登陆</a></li>"
call toptitle(l_title,cpbtitle)
call error(errormsg)
call login()
else
cpbtitle="短信中心"
call toptitle(l_title,cpbtitle)
call head(0,cpbusername&"的控制面板首页","userindex.asp",cpbtitle)
dim hpm
sql="select hpm from home"
set rsconn1=conn.execute(sql)
if not rsconn1.eof then
hpm=rsconn1("hpm")
end if
set rsconn1=nothing
%>
<script language="JavaScript">
function CheckForm()
{
if (document.form1.p_take.value.length == 0)
{
alert("请输入接收人的用户名.");
document.form1.p_take.focus();
return false;
}
if (document.form1.p_content.value.length == 0)
{
alert("为了方便,请输入标题.");
document.form1.p_content.focus();
return false;
}
if (document.form1.p_nr.value.length == 0)
{
alert("请输入内容.");
document.form1.p_nr.focus();
return false;
}
return true;
}
function DoTitle(addTitle) {
var revisedTitle;
var currentTitle = document.form1.p_take.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.form1.p_take.value=revisedTitle;
document.form1.p_take.focus();
return;
}
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked;
}
}
</script>
<center>
<table border=1 borderColor=<%=tdc2%> cellPadding=0 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse">
<tr>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="userindex.asp" class=nav1>用户控制面板</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="edituser.asp?action=editbasic" class=nav1>基本资料修改</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="edituser.asp?action=editlink" class=nav1>联系资料修改</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="edituser.asp?action=editpw" class=nav1>用户密码修改</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="friend.asp" class=nav1>编辑好友列表</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="friend.asp?action=badfriend" class=nav1>编辑忽略列表</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="fav.asp" class=nav1>用户收藏管理</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="pm.asp" class=nav1>用户短信服务</a></td>
</tr>
<tr>
<td class=tdc1 align="center" height="23" bgcolor= <%=tcolor1%> colspan=8>
<a href="pm.asp"><img src=image/p_inbox.gif border=0 alt=收件箱></a>
<a href="pm.asp?action=send"><img src=image/p_issend.gif border=0 alt=发件箱></a>
<a href="friend.asp"><img src=image/p_address.gif border=0 alt=地址簿></a>
<a href="pm.asp?action=add"><img src=image/p_write.gif border=0 alt=写邮件></a>
</td>
</tr>
</table>
<center>
<% select case request("action")
case ""
call showrecive()
case "send"
call send()
case "add"
call add()
case "add1"
call add1()
end select
sub add1()
errormsg=""
q_receive=Chktopic(request.form("p_take"))
q_title=Chktopic(request.form("p_content"))
q_content=Chktopic(request.form("p_nr")&request.form("p_nr1"))
if q_receive="" then errormsg="<Li>接收人不能为空</Li>"
if q_title="" or len(q_title)>40 then errormsg=errormsg&"<Li>标题不能为空或者不能超过40字节</Li>"
if q_content="" or len(q_content)>5000 then errormsg=errormsg&"内容不能为空或者不能超过5000字节</Li>"
sql="select u_locksendpm,u_yzreg from user where username='"&cpbusername&"'"
set rs=conn.execute(sql)
if not rs.eof then
if rs("u_locksendpm")=1 then errormsg=errormsg&"<Li>很抱歉,您的发短信权利已经被管理员屏蔽,有什么问题请跟管理员联系</Li>"
if rs("u_yzreg")=1 then errormsg=errormsg&"<Li>很抱歉,您还没有通过管理员的验证,有什么问题请跟管理员联系</Li>"
else
errormsg=errormsg&"<Li>很抱歉,您非法登陆</Li>"
end if
if errormsg="" then
q_receive=split(q_receive,",")
if ubound(q_receive)>4 then errormsg=errormsg&"<Li>很抱歉,群发不能超过5位用户</Li>"
end if
if errormsg="" then
for i=0 to ubound(q_receive)
sql="select username,u_badfriend from user where username='"&q_receive(i)&"'"
set rs=conn.execute(sql)
if rs.eof then
errormsg=errormsg&"<Li>不存在接收人,可能不存在或者已经被管理员删除</Li>"
exit for
else
u_badfrien=rs("u_badfriend")
if instr(u_badfrien,cpbusername)>0 then
errormsg=errormsg&"用户<B>"&q_receive(i)&"</b>拒收您的短信</Li>"
exit for
end if
end if
if cpbusername=q_receive(i) then
errormsg=errormsg&"<Li>很抱歉,不能给自己发短信</Li>"
exit for
end if
next
end if
if errormsg<>"" then
call error(errormsg)
call bq()
response.end
else
for i=0 to ubound(q_receive)
StrSQl="insert into pm (q_receive,q_send,q_time,q_content,q_title) Values ('"
strSql = StrSQl & q_receive(i) & "', '"
strSql = StrSQl & cpbusername & "', '"
strSql = StrSQl & nowtime & "', '"
strSql = StrSQl & q_content & "', '"
strSql = StrSQl & q_title & "')"
conn.Execute (strsql)
next
succmsg="<Li>您的邮件已经发送到对方邮箱,同时一封邮件复制到您的发件箱</Li>"
succmsg=succmsg&"<Li>正在返回您的短信中心,请稍后...<script language=javascript>setTimeout(""location.replace('pm.asp')"",1000)</script></Li>"
call succ(succmsg)
end if
end sub
sub add()
username=chktopic(request("username"))
title=chktopic(request("title"))
content=chktopic(request("content"))
if request("id")<>"" then
sql="select q_content,q_send,q_title from pm where q_id="&chktopic(request("id"))&""
set rs=conn.execute(sql)
if not rs.eof then
title="Fw:"&rs("q_title")
content="---------- 下面是转发信息 ---------"&chr(13)&chr(10)
content=content&"原发件人:"&rs("q_send")&chr(13)&chr(10)
content=content&rs("q_content")&chr(13)&chr(10)
content=content&"-----------------------------"&chr(13)&chr(10)
end if
set rs=nothing
end if
chat=chktopic(request("chat"))
%>
<table border=1 borderColor=<%=tdc2%> cellPadding=4 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse" align=center>
<form name="form1" method="POST" action="pm.asp?action=add1" onSubmit="return CheckForm();" onkeydown='uppm()'>
<tr>
<td colspan="2" height="22" <%=hColor%> class=tdc1 align=center>发送消息
</td>
</tr>
<tr>
<td align="right" width="25%" bgcolor=<%=tColor2%> class=tdc>接收人:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input type="text" class="bdtj" size="40" name="p_take" value="<%=username%>" class="tdc">
<select name=font onchange=DoTitle(this.options[this.selectedIndex].value) class=bdtj3>
<option>好友列表</option>
<%sql="select u_friend from user where username='"&cpbusername&"'"
set rs=conn.execute(sql)
if not rs.eof then u_friend=rs("u_friend")
if not isnull(u_friend) then
u_friendname=split(u_friend,",")
for i=0 to (ubound(u_friendname)-1)
response.write("<option value="&u_friendname(i)&">"&u_friendname(i)&"</option>")
next
end if
%>
</select>
</td>
</tr>
<tr>
<td align="right" width="25%" bgcolor=<%=tColor2%> class=tdc>标题:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input type="text" size="60" name="p_content" class="bdtj" value="<%=title%>">
</td>
</tr>
<tr>
<td align="right" width="25%" valign="top" bgcolor=<%=tColor2%> class=tdc>内容:
<div align=left>
<li>群发用户短信不能超过5位用户</li>
<li>标题不能超过40字符</li>
<li>内容不能超过5000字符</li></div></td>
<td bgcolor=<%=tColor2%> >
<textarea name="p_nr" class=bdtj3 cols="60" rows="8" ><%=content%></textarea>
</td>
</tr>
<tr>
<td bgcolor=<%=tColor2%> class=tdc width="15%"> </td>
<td bgcolor=<%=tColor2%> class=tdc>
<input type="submit" name="Submit" value="发送" class="bdtj" OnClick="this.disabled=true;document.form1.submit();">
<%if chat="" and username<>"" then
response.write("<input type=button name=chatlog value=""查看聊天记录"" class=bdtj onClick=""location.href='?action=add&username="&username&"&title="&title&"&chat=chat'"">")
elseif username<>"" then
response.write("<input type=button name=chatlog value=""关闭聊天记录"" class=bdtj onClick=""location.href='?action=add&username="&username&"&title="&title&"'"">")
end if%>
<input type="button" value="返回" onClick="JavaScript:history.go(-1)" name="Button" class="bdtj">[按CTRL+ENTER 直接发送]
</td>
</tr>
<%if chat<>"" then%>
<tr>
<td colspan="2" height="22" <%=hColor%> class=tdc1 align=center>查看你与 <%=username%> 的聊天记录
</td>
</tr>
<%
sql="select q_send,q_receive,q_title,q_content,q_time from pm where (q_send='"&username&"' and q_receive='"&cpbusername&"') or (q_send='"&cpbusername&"' and q_receive='"&username&"') order by q_time desc"
set rs=conn.execute(sql)
if not rs.eof then
do while not rs.eof%>
<tr>
<td height="21" width="100%" align="left" bgcolor=<%=tColor2%> class=tdc colspan="6">
<B>消息标题:<%=htmlencode(rs("q_title"))%></B> 来自 <b><%=rs("q_send")%></b> 的消息,发于<B><%=rs("q_time")%></B>
</td>
</tr>
<tr>
<td height="21" width="100%" align="left" bgcolor=<%=tColor1%> class=tdc colspan="6"><%=ubbsign(rs("q_content"))%>
</td>
</tr>
<%rs.movenext
loop
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -