网络寻呼机数据库版显示消息showmessage.asp
程序员文章站
2023-12-25 15:04:03
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>显示自己的信息</title>
<script language=javascript>
<!--
function checks(theform1){
if (theform1.word.value=="")
{
alert("请随便说几句。");
theform1.word.focus();
return false;
}
return true; }
//-->
</script>
</head>
<body>
<br><br>
<%
username=session("username")
set conn=server.createobject("adodb.connection")
provider = "provider=microsoft.jet.oledb.4.0;"
dbpath = "data source=" & server.mappath( "webuser.mdb" )
conn.open provider & dbpath
set rs=server.createobject("adodb.recordset")
sql="select id,fromname,toname,word,adddate,isread from talks where toname="& username &"and isread=0 order by adddate"
rs.open sql,conn,3,3
rs.pagesize=1
page = clng(request("page"))
if page < 1 then page = 1
if page > rs.pagecount then page = rs.pagecount
%>
<form method="post" name=form onsubmit="return checks(form)" action="submitmessage.">
<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="550" id="autonumber1" align="center">
<tr>
<td width="437" colspan="2" height="14"><b><font size="3">发送短消息</font></b></td>
</tr>
<tr>
<td width="437" colspan="2" height="8">
<table border="0" width="540" id="autonumber2">
<% if rs.eof or rs.bof then %>
<tr>
<td width="100%"><% response.write"目前没有你的消息" %></td>
</tr>
<% else %>
<tr>
<td width="100%"><% show rs,page%></td>
</tr>
<tr>
<td width="100%">
<%
sub show( rs, page )
rs.absolutepage = page
%>
<table border="0" cellspacing="0" width="534" cellpadding="0">
<% for ipage = 1 to rs.pagesize %>
<tr >
<td colspan="2"><font color=red><%=rs("fromname")%></font>于<%=rs("adddate")%>传呼于你</td>
</tr>
<tr >
<td colspan="2">
<%
word=replace(rs("word"),vbcrlf,"<br>")
response.write word
%>
</td>
</tr>
<tr>
<td width="82">回复对象</td>
<td width="452">
<input type="text" name="userid" size="15" value=<%=rs("fromname")%> readonly>
</td>
</tr>
<tr>
<td width="82" valign="top">回复信息</td>
<td width="452">
<textarea name=word cols=40 rows="5"></textarea>
</td>
</tr>
<tr>
<td width="82"> </td>
<td width="452">输入的汉字不要超过<font color="#ff0000">200</font>个汉字</td>
</tr>
<%
sql="update talks set isread=-1 where id="&rs("id")
conn.execute(sql)
rs.movenext
if rs.eof then exit for
next %>
</table>
</td>
</tr>
<tr>
<td width="100%">
<% if page <> rs.pagecount then %>
<a href= showmessage.asp?page=<%=(page+1)%>>下一条</a>
<% end if %>
</td>
</tr>
&
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>显示自己的信息</title>
<script language=javascript>
<!--
function checks(theform1){
if (theform1.word.value=="")
{
alert("请随便说几句。");
theform1.word.focus();
return false;
}
return true; }
//-->
</script>
</head>
<body>
<br><br>
<%
username=session("username")
set conn=server.createobject("adodb.connection")
provider = "provider=microsoft.jet.oledb.4.0;"
dbpath = "data source=" & server.mappath( "webuser.mdb" )
conn.open provider & dbpath
set rs=server.createobject("adodb.recordset")
sql="select id,fromname,toname,word,adddate,isread from talks where toname="& username &"and isread=0 order by adddate"
rs.open sql,conn,3,3
rs.pagesize=1
page = clng(request("page"))
if page < 1 then page = 1
if page > rs.pagecount then page = rs.pagecount
%>
<form method="post" name=form onsubmit="return checks(form)" action="submitmessage.">
<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="550" id="autonumber1" align="center">
<tr>
<td width="437" colspan="2" height="14"><b><font size="3">发送短消息</font></b></td>
</tr>
<tr>
<td width="437" colspan="2" height="8">
<table border="0" width="540" id="autonumber2">
<% if rs.eof or rs.bof then %>
<tr>
<td width="100%"><% response.write"目前没有你的消息" %></td>
</tr>
<% else %>
<tr>
<td width="100%"><% show rs,page%></td>
</tr>
<tr>
<td width="100%">
<%
sub show( rs, page )
rs.absolutepage = page
%>
<table border="0" cellspacing="0" width="534" cellpadding="0">
<% for ipage = 1 to rs.pagesize %>
<tr >
<td colspan="2"><font color=red><%=rs("fromname")%></font>于<%=rs("adddate")%>传呼于你</td>
</tr>
<tr >
<td colspan="2">
<%
word=replace(rs("word"),vbcrlf,"<br>")
response.write word
%>
</td>
</tr>
<tr>
<td width="82">回复对象</td>
<td width="452">
<input type="text" name="userid" size="15" value=<%=rs("fromname")%> readonly>
</td>
</tr>
<tr>
<td width="82" valign="top">回复信息</td>
<td width="452">
<textarea name=word cols=40 rows="5"></textarea>
</td>
</tr>
<tr>
<td width="82"> </td>
<td width="452">输入的汉字不要超过<font color="#ff0000">200</font>个汉字</td>
</tr>
<%
sql="update talks set isread=-1 where id="&rs("id")
conn.execute(sql)
rs.movenext
if rs.eof then exit for
next %>
</table>
</td>
</tr>
<tr>
<td width="100%">
<% if page <> rs.pagecount then %>
<a href= showmessage.asp?page=<%=(page+1)%>>下一条</a>
<% end if %>
</td>
</tr>
&