📄 senddata.asp
字号:
<!--#include file="conn.asp"-->
<%
'检查用户是否已经经过登陆验证了
if session("admin") = "" or session("flag") = "" Then
'如果没有登陆,则输出出错信息
'要求用户进行登陆
response.write " <br><br><br>"
response.write " <table align='center' width='300' border='1' cellpadding='0' cellspacing='0' bordercolor='#999999'>"
response.write " <tr bgcolor='#999999'> "
response.write " <td colspan='2' height='15'> "
response.write " <div align='center'><font color='#FFFFFF'>操作: 确认身份失败!</font></div>"
response.write " </td>"
response.write " </tr>"
response.write " <tr> "
response.write " <td colspan='2' height='23'> "
response.write " <div align='center'><br><br>"
response.write " 非法登陆,您的操作已经被记录!!! <br><br>"
response.write " <a href='javascript:onclick=history.go(-1)'>返回</a>"
response.write " <br><br></div></td>"
response.write " </tr> </table>"
'终止响应
response.end
end If
if session("flag")>2 then
response.write "<br><p align=center>您没有操作的权限</p>"
response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<%
'每页显示记录数
const MaxPerPage=20
'变量定义
dim totalPut,CurrentPage,TotalPages,i,j,idlist
dim sql,rs
'获取信息显示的页数
if not isempty(request("page")) then
currentPage=cint(request("page"))
Else
'默认设置为第一页
currentPage=1
end If
'获得要删除的选项
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
'如果选中多项
if instr(idlist,",")>0 then
dim idarr
'分割字符串
'获得选中要删除的所有项目
idArr=split(idlist)
dim id
'删除每一个选中的项目
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
Else
'删除选中的项目
call deleteannounce(clng(idlist))
end if
end If
%>
<body>
<table border="0" width="92%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><p align="center"><br>
以下是向定制用户发送信息的情况<br>
删除数据请选中相关短信息然后点击删除<br>
<form method=Post action="senddata.asp">
<div align="center">
<%
'获得所有信息发送记录
sql="select * from senddata order by id desc"
'记录集对象
Set rs= Server.CreateObject("ADODB.Recordset")
'打开记录集
rs.open sql,conn,1,1
'如果记录集为空,说明还没有短信发送数据
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 短 信 数 据 ! </p>"
Else
'记录集不为空
'获取总记录数
totalPut=rs.recordcount
'设置当前页数
if currentpage<1 then
currentpage=1
end If
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end If
'显示该页的信息
if currentPage=1 Then
'调用showpage过程
showpage totalput,MaxPerPage,"senddata.asp"
'显示页面内容
showContent
showpage totalput,MaxPerPage,"senddata.asp"
else
if (currentPage-1)*MaxPerPage<totalPut Then
'移动记录集游标的位置
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
'调用showpage过程
showpage totalput,MaxPerPage,"senddata.asp"
'显示页面内容
showContent
showpage totalput,MaxPerPage,"senddata.asp"
else
currentPage=1
'调用showpage过程
showpage totalput,MaxPerPage,"senddata.asp"
'显示页面内容
showContent
showpage totalput,MaxPerPage,"senddata.asp"
end if
end If
'关闭记录集
rs.close
end if
'释放对象
set rs=nothing
'关闭数据库连接,释放对象
conn.close
set conn=nothing
'内容显示过程
sub showContent
dim i
i=0
%>
<div align="center"><center><table border="1" cellspacing="0" width="589" bordercolorlight="#000000" bordercolordark="#FFFFFF" cellpadding="0">
<tr>
<td width="85" align="center" bgcolor="#D0D0D0" height="20"><strong>手机号</strong></td>
<td width="400" align="center" bgcolor="#D0D0D0"><strong>短信息内容</strong></td>
<td width="400" align="center" bgcolor="#D0D0D0"><strong>发送时间</strong></td>
<td width="68" align="center" bgcolor="#D0D0D0"><input type='submit' class=buttonface value='删 除'></td>
</tr>
<%
'循环显示每一项
do while not rs.eof
%>
<tr>
<td height="23" width="46"><p align="center"><%=rs("mobile")%></td>
<td width="400"><p align="center"><%=rs("message")%></td>
<td width="400"><p align="center"><%=rs("senddate")%></td>
<td width="68"><p align="center"><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("ID"))%>'></td>
</tr>
<%
'计数变量加1
i=i+1
'如果超过了每页显示最大数目,则跳出循环
if i>=MaxPerPage then exit Do
'移至下一条记录
rs.movenext
loop
%>
</table>
</center></div>
<%
end sub
'导航栏显示函数
function showpage(totalnumber,maxperpage,filename)
dim n
'求取总页数
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end If
response.write "<p align='center'> "
'根据目前的页数位置来设置各个链接
if CurrentPage<2 then
response.write "<font color='#000080'>首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> "
end If
if n-currentpage<1 then
response.write "<font color='#000080'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end If
response.write "<font color='#000080'> 页次:</font><strong><font color=red>"&CurrentPage&"</font><font color='#000080'>/"&n&"</strong>页</font> "
response.write "<font color='#000080'> 共<b>"&totalnumber&"</b>条记录 <b>"&maxperpage&"</b>条记录/页</font> "
end Function
'删除所选项的函数
sub deleteannounce(id)
dim rs,sql
'记录集对象
set rs=server.createobject("adodb.recordset")
'删除所选择的记录
sql="delete from senddata where id="&cstr(id)
'执行操作
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删除失败!<br>"
else
response.write "操作成功!<br>"
end if
End sub
%>
</div></td>
</tr>
</table></form>
</center></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -