网络寻呼机数据库版显示历史消息history.asp
程序员文章站
2023-01-23 23:09:41
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>历史消息</title>
<script language="javascript">
<!--
function checkall(form) {
for (var i=0;i<document.checkboxform1.length;i++) {
var e = document.checkboxform1[i];
if (e.name != chkall) e.checked = form.chkall.checked;
}
}
// 检查是否选择了记录
function checkbox1(form)
{
var thelength;
var i,j;
thelength = form.id.length;
i = 0;
j = 0;
while(i<thelength){
if (form.id[i].checked)
j ++ ;
i ++ ;
}
if (j==0 && !form.id.checked){
alert("请先选择删除记录");
return false ;
}
return true ;
}
// 单击“删除”按钮时触发
function del(form)
{
if (!checkbox1(form)){
return false;
}
else
if (confirm(您确信要删除这些记录吗)){
window.location.href="deletemessage.?page=<%=clng(page)%>"}
}
-->
</script>
</head>
<body>
<br><br><%
set conn=server.createobject("adodb.connection")
provider = "provider=microsoft.jet.oledb.4.0;"
dbpath = "data source=" & server.mappath( "webuser.mdb" )
conn.open provider & dbpath
username=session("username")
if username<>"" then
sql="select * from talks where fromname="& username & "or toname="& username & " order by adddate desc"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,3,3
rs.pagesize=15
page = clng(request("page"))
if page < 1 then page = 1
if page > rs.pagecount then page = rs.pagecount
%>
<table border="0" cellspacing="0" width=590 cellpadding="0" align=center height="75">
<tr>
<td width="100%" height="24"><font size="2">查看我的历史消息(<b><font color="#ff0000">聊天记录仅保存一周内容,请自行备份</font></b>)</font></td>
</tr>
<% if rs.eof or rs.bof then %>
<tr>
<td width="100%" height="20"><font color="#ff0000">没有你的历史纪录,赶快和大家交流</font>!!!</td>
</tr>
<% else %>
<tr>
<td width="100%" align="center">
<form action=history.asp name=f1>
<% if page <> 1 then %>
<a href=history.asp?page=1> 第一页</a>
<a href=history.asp?page=<%=(page-1)%>>上一页</a>
<% end if
if page <> rs.pagecount then %>
<a href=history.asp?page=<%=(page+1)%>>下一页</a>
<a href=history.asp?page=<%=rs.pagecount%>>最后一页</a>
<% end if %>
页次:<font color="red"><%=page%>/<%=rs.pagecount%></font>
<input type=text size=4 maxlength=4 name=page>
</form>
</td>
</tr>
<tr>
<td ><% show rs, page %></td>
</tr>
<% end if %>
<tr>
<td width="100%" height="16">
<%
sub show( rs, page )
rs.absolutepage =page
count=rs.pagesize
%>
<form name="checkboxform1" onsubmit="return del(checkboxform1)" method=post action="deletemessage.asp?page=<%=clng(page)%>">
<table border="0" cellspacing="0" width="590" cellpadding="0" align=center>
<%
do while not r
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>历史消息</title>
<script language="javascript">
<!--
function checkall(form) {
for (var i=0;i<document.checkboxform1.length;i++) {
var e = document.checkboxform1[i];
if (e.name != chkall) e.checked = form.chkall.checked;
}
}
// 检查是否选择了记录
function checkbox1(form)
{
var thelength;
var i,j;
thelength = form.id.length;
i = 0;
j = 0;
while(i<thelength){
if (form.id[i].checked)
j ++ ;
i ++ ;
}
if (j==0 && !form.id.checked){
alert("请先选择删除记录");
return false ;
}
return true ;
}
// 单击“删除”按钮时触发
function del(form)
{
if (!checkbox1(form)){
return false;
}
else
if (confirm(您确信要删除这些记录吗)){
window.location.href="deletemessage.?page=<%=clng(page)%>"}
}
-->
</script>
</head>
<body>
<br><br><%
set conn=server.createobject("adodb.connection")
provider = "provider=microsoft.jet.oledb.4.0;"
dbpath = "data source=" & server.mappath( "webuser.mdb" )
conn.open provider & dbpath
username=session("username")
if username<>"" then
sql="select * from talks where fromname="& username & "or toname="& username & " order by adddate desc"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,3,3
rs.pagesize=15
page = clng(request("page"))
if page < 1 then page = 1
if page > rs.pagecount then page = rs.pagecount
%>
<table border="0" cellspacing="0" width=590 cellpadding="0" align=center height="75">
<tr>
<td width="100%" height="24"><font size="2">查看我的历史消息(<b><font color="#ff0000">聊天记录仅保存一周内容,请自行备份</font></b>)</font></td>
</tr>
<% if rs.eof or rs.bof then %>
<tr>
<td width="100%" height="20"><font color="#ff0000">没有你的历史纪录,赶快和大家交流</font>!!!</td>
</tr>
<% else %>
<tr>
<td width="100%" align="center">
<form action=history.asp name=f1>
<% if page <> 1 then %>
<a href=history.asp?page=1> 第一页</a>
<a href=history.asp?page=<%=(page-1)%>>上一页</a>
<% end if
if page <> rs.pagecount then %>
<a href=history.asp?page=<%=(page+1)%>>下一页</a>
<a href=history.asp?page=<%=rs.pagecount%>>最后一页</a>
<% end if %>
页次:<font color="red"><%=page%>/<%=rs.pagecount%></font>
<input type=text size=4 maxlength=4 name=page>
</form>
</td>
</tr>
<tr>
<td ><% show rs, page %></td>
</tr>
<% end if %>
<tr>
<td width="100%" height="16">
<%
sub show( rs, page )
rs.absolutepage =page
count=rs.pagesize
%>
<form name="checkboxform1" onsubmit="return del(checkboxform1)" method=post action="deletemessage.asp?page=<%=clng(page)%>">
<table border="0" cellspacing="0" width="590" cellpadding="0" align=center>
<%
do while not r