user_pm.asp
来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 204 行
ASP
204 行
<%@ LANGUAGE = VBScript CodePage = 936%>
<!--#include file="conn.asp"-->
<!--#include file="inc/class_sys.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/class_blog.asp"-->
<%
dim oblog
set oblog=new class_sys
oblog.start
if not oblog.checkuserlogined() then
response.Redirect("login.asp?fromurl="&replace(oblog.GetUrl,"&","$"))
end If
Dim groupName ,trs ,tsql
Set trs =oblog.execute ("SELECT g_name FROM oblog_groups WHERE groupid = " & oblog.l_uGroupId)
groupName = trs (0)
trs.close
Set trs=Nothing
tsql = "or groups like '"&oblog.l_uGroupId&",%' or groups like '%,"&oblog.l_uGroupId&"' or groups like '%,"&oblog.l_uGroupId&",%' or groups ='"&oblog.l_uGroupId&"'"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=oblog.l_uname%>-短消息管理</title>
<link href="OblogStyle/style.css" rel="stylesheet" type="text/css" />
</head>
<body style="overflow:hidden;background:#fff" scroll="no">
<div class="content">
<div class="content_body">
<%
dim action
action=request("action")
select case action
case "send"
call send
case "save"
call save
case "read0"
call read(0)
case "read1"
call read(1)
end select
%>
</div>
</div>
</body>
</html>
<%
sub send()
dim rs
%>
<SCRIPT language=javascript>
function changincept()
{
document.oblogform.incept.value = document.oblogform.selectincept.value;
}
</SCRIPT>
<form action="user_pm.asp?action=save" method="post" name="oblogform">
<table class='win_pm_table' align='center' border='0' cellpadding='0' cellspacing='1'>
<tr>
<td colspan='2' class='win_pm_table_top'>发送站内短消息</td>
</tr>
<tr>
<td colspan='2'></td>
</tr>
<tr>
<td class='win_pm_table_td'>收件人:</td>
<td>
<input type="text" name="incept" id="incept" width="20" value="<%=trim(request("incept"))%>" />
<select size="1" id="selectincept" onChange='javascript:changincept()'>
<option value="">选择好友</option>
<%
set rs=oblog.execute("select username from oblog_user,oblog_friend where oblog_user.userid=oblog_friend.friendid and oblog_friend.isblack=0 and oblog_friend.userid="&oblog.l_uid)
while not rs.eof
response.Write("<option value='"&oblog.filt_html(rs(0))&"'>"&oblog.filt_html(rs(0))&"</option>")
rs.movenext
wend
set rs=nothing
%>
</select></td>
</tr>
<tr>
<td class='win_pm_table_td'>标题:</td>
<td><input type="text" name="topic" size="35" maxlength="50" value="<%=oblog.filt_html(trim(request("topic")))%>" /></td>
</tr>
<tr>
<td class='win_pm_table_td'>内容:</td>
<td><textarea name="content" cols="35" rows="8"></textarea></td>
</tr>
<tr>
<td colspan='2' align="center"><INPUT type="hidden" name="id" value=""><input type="submit" value=" 提交 "> <input type="button" onClick="window.close();" value=" 关闭 "></td>
</tr>
</table>
</form>
<%
end sub
sub save()
dim incept,content,sql,rs,inceptid,topic
incept=oblog.filt_badstr(trim(request("incept")))
content=trim(request("content"))
topic=trim(request("topic"))
if incept="" then oblog.adderrstr("收件人不能为空")
if content="" then oblog.adderrstr("短消息内容不能为空")
if topic="" then oblog.adderrstr("短消息标题不能为空")
if oblog.errstr<>"" then
oblog.showok replace(oblog.errstr,"_","\n"),""
exit sub
end if
sql="select userid from [oblog_user] where username='"&incept&"'"
set rs=oblog.execute(sql)
if rs.eof then
oblog.showok "无此用户,请检查用户名!",""
exit sub
end if
inceptid=clng(rs(0))
set rs=oblog.execute("select id from oblog_friend where isblack=1 and userid="&inceptid&" and friendid="&oblog.l_uid)
if not rs.eof then
oblog.showok "你在收件人的黑名单中,无法发送短消息!",""
exit sub
end if
sql="select top 1 * from oblog_pm"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("incept")=oblog.Interceptstr(incept,50)
rs("topic")=oblog.Interceptstr(oblog.filt_badword(topic),100)
rs("content")=oblog.Interceptstr(oblog.filt_badword(content),250)
rs("sender")=oblog.l_uname
rs.update
rs.close
set rs=nothing
response.Write("<script>alert('短消息发送成功!');window.close();</script>")
end sub
sub read(sAction)
dim id,rs
id=clng(trim(request("id")))
if sAction="0" Then
set rs=oblog.execute("select * from oblog_pm where (id="&id & " And Incept='"&oblog.l_uname&"' And delR=0) or ((groups like '"&oblog.l_uGroupId&",%' or groups like '%,"&oblog.l_uGroupId&"' or groups like '%,"&oblog.l_uGroupId&",%' or groups ='"&oblog.l_uGroupId&"') and id="&id & ")")
Elseif sAction="1" Then
set rs=oblog.execute("select * from oblog_pm where id="&id & " And sender='"&oblog.l_uname&"' And delS=0")
Else
response.Write("<ul><li>错误的参数,<a href='javascript:window.close();'>关闭窗口</a></li></ul>")
exit sub
End If
if rs.eof then
set rs=nothing
response.Write("<ul><li>无此纪录,<a href='javascript:window.close();'>关闭窗口</a></li></ul>")
exit sub
end if
%>
<table class='win_pm_table' align='center' border='0' cellpadding='0' cellspacing='1'>
<tr>
<td colspan='2' class='win_pm_table_top'>查看短消息</td>
</tr>
<tr>
<td class='win_pm_table_td'>短消息发送时间:</td>
<td><%=rs("addtime")%></td>
</tr>
<tr>
<td class='win_pm_table_td'>短消息标题:</td>
<td><%=oblog.filt_html(rs("topic"))%></td>
</tr>
<tr>
<td class='win_pm_table_td'>短消息内容:</td>
<td><%=oblog.filt_html(rs("content"))%></td>
</tr>
<tr>
<td class='win_pm_table_td'>短消息发件人:</td>
<td><%
If rs("issys")= 1 Then
Response.Write "<font color=red style=font-weight:600>" &rs("sender") &"</font>"
Else
Response.Write oblog.filt_html(rs("sender"))
End If
%></td>
</tr>
<tr>
<td class='win_pm_table_td'>短消息收件人:</td>
<td><%
If rs("incept")="0" Then
response.Write "<font color=green style=font-weight:600>" &groupName& "</font>"
Else
response.Write oblog.filt_html(rs("incept"))
End if%></td>
</tr>
<tr>
<td colspan='2' align="center">
<%If sAction="0" Then%>
<input type="button" onClick="window.location='user_pm.asp?action=send&incept=<%=rs("sender")%>&topic=<%="回复:"&oblog.filt_html(rs("topic"))%>'" value=" 回复 " <%If rs("issys")= 1 Then%>disabled<%End if%>>
<%End If%>
<input type="button" onClick="window.close();" value=" 关闭 ">
</td>
</tr>
</table>
<%
if oblog.l_uname=rs("incept") then
oblog.execute("update oblog_pm set isreaded=1 where id="&id&" and incept='"&oblog.l_uname&"'")
end if
set rs=nothing
end sub
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?