Send Messages Among System
- 综合知识
- 2006-11-23
- 47热度
- 0评论
发送消息代码部分:
<%@language=vbscript%>
<!--#include file="conn.asp"-->
<!--#include file="top.asp"-->
<%
if session("shenfen")="" then
response.redirect"denglu.asp"
response.end
end if
content=request("xiaoxi")
if content<>"" then
duixiang=request("laiziid")
if duixiang="" and xuanze<>"请选择" then
xuanze=request("xuanze")
'加入人查询代码
set rsq=server.createobject("adodb.recordset")
rsq.activeconnection=conn
rsq.cursortype=2
rsq.locktype=3
rsq.source="select * from fujia where xsxm='" & xuanze & "'"
rsq.open
duixiang=rsq("xsxh")
rsq.close
set rsq=nothing
end if
'查询结束
if duixiang="" and xuanze="请选择" then
response.write"<body bgcolor=#ffffff BACKGROUND=tbg.gif>"
%>
<script language=vbscript>
<!--
msgbox"接收对象不能为空!请输入接收方的学号或者从下拉表里选择!"
history.back()
-->
</script>
<%
response.end
end if
%>
<!--检查数据库里是否有资料存在发送对象-->
<%
set rs=server.createobject("adodb.recordset")
rs.activeconnection=conn
rs.cursortype=2
rs.locktype=3
rs.source="select * from fujia where xsxh='" & duixiang & "'"
rs.open
if rs.eof or rs.bof then
response.write"<body bgcolor=#ffffff BACKGROUND=tbg.gif>"
%>
<script language=vbscript>
<!--
msgbox"接收对象输入错误!数据库里不存在该对象!请正确输入接收方的学号!"
history.back()
-->
</script>
<%
rs.close
set rs=nothing
response.end
end if
xsxh=session("shenfen")
set rsf=server.createobject("adodb.recordset")
rsf.activeconnection=conn
rsf.cursortype=2
rsf.locktype=3
rsf.source="insert into message(xsxh,laizi,laiziid,dateandtime,content,leibie,inout) values('" & duixiang & "','" & session("yonghu") & "','" & xsxh & "','" & date() & "','" & content & "','消息','in')"
rsf.open
set rsf=nothing
response.write"<meta http-equiv=refresh content=2;url=zhujiemian.asp>"
response.write"<body BACKGROUND=images/background.gif>"
response.write"<center><br><BR><font color=orange>恭喜您!短消息发送成功!<br>"
response.write"<center><font color=blue>欢迎您继续使用本系统发送短消息"
response.write"<font color=red><center>系统将在2秒内自动返回…………"
response.end
else
response.write"<body bgcolor=#ffffff BACKGROUND=tbg.gif>"
%>
<script language=vbscript>
<!--
msgbox"发送消息内容不能为空!!!"
history.back()
-->
</script>
<%
end if
%>
==========================
接收消息显示部分:
<!--#include file="top.asp"-->
<!--#include file="jinzhi.asp"-->
<!--#include file="login_check.asp"-->
<!--#include file="conn.asp"-->
<%
xsxh=session("shenfen")
dim rs
set rs=server.createobject("adodb.recordset")
rs.activeconnection=conn
rs.cursortype=2
rs.locktype=3
rs.source="select * from message where xsxh='" & xsxh & "' and inout='in' order by dateandtime desc"
rs.open
%>
<p align="center">短消息查收中心</p>
<div align="center">
<center>
<table border="1" width="80%">
<tr>
<td width="21%" align="center"><font color=red>来自</td>
<td width="18%" align="center"><font color=red>发送时间</td>
<td width="12%" align="center"><font color=red>主要内容</td>
<td width="15%" align="center"><font color=red>立即阅读</td>
<td width="17%" align="center"><font color=red>回复消息</td>
<td width="17%" align="center"><font color=red>删除消息</td>
</tr>
<%if not rs.eof then%>
<% do while not rs.eof%>
<tr>
<td width="21%" align="center"><font color=navy> <%=rs("laizi")%></td>
<td width="18%" align="center"><font color=navy> <%=rs("dateandtime")%></td>
<td width="12%" align="center"><font color=navy> <%=rs("leibie")%></td>
<td width="15%" align="center"> <a href="yuedu.asp?messageID=<%=rs("id")%>"><font color=blue>立即阅读</a></td>
<td width="17%" align="center"><font color=red> <a href="yuedu.asp?messageID=<%=rs("id")%>"><font color=blue>回复消息</a></td>
<td width="17%" align="center"><font color=red> <a href="yuedu.asp?action=del&messageID=<%=rs("id")%>"><font color=blue>删除消息</a></td>
</tr>
<%rs.movenext%>
<%loop%>
<%end if%>
<!--释放数据库资源-->
<%rs.close%>
<%set rs=nothing%></table></center></div>
<!--#include file="buttom.asp"-->