📄 dmy.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/function.asp"-->
<%
response.buffer=true
stats="我的日记"
if founderr then
call head()
call head_var("错误信息",Request.ServerVariables("HTTP_REFERER"))
call txl_error()
else
call head()
call head_var("私人日记","d_index.asp")
if founderr then
call txl_error()
else
call main()
if founderr then call txl_error()
end if
end if
if not isempty(request("selAnnounce")) then
dim idlist
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
call foot()
sub main()
dim totalcount,maxpage,page,pagecount
set rs1=server.createobject("adodb.recordset")
sql="Select * from [User] where userid="&userid
rs1.open sql,conn,1,1
realname=rs1("realname")
%>
<table width="<%=txl_body(0)%>" cellpadding="0" cellspacing="0" align="center" style="border:1px <%=txl_body(9)%> solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px;">
<form method=Post action="dmy.asp">
<tr>
<td width=10> </td>
<td width=20% align=center>日 期<hr align="center" noshade size="2" color="#F2B101"></td>
<td width=10% align=center>状 态<hr align="center" noshade size="2" color="#F2B101"></td>
<td width=15% align=center>心 情<hr align="center" noshade size="2" color="#F2B101"></td>
<td width=10% align=center>标 题<hr align="center" noshade size="2" color="#F2B101"></td>
<td width=35% align=center>内容<hr align="center" noshade size="2" color="#F2B101"></td>
<td width=10% align=center>删除<hr align="center" noshade size="2" color="#F2B101"></td>
</tr>
<%
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from diary where postuser='"&realname&"' order by id desc "
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write"<tr><td width=10> </td>"
response.write"<td colspan=5 align=center height=150><font color=#ff0000>你还没有写日记!</font><br><br><br><br><hr size=1 color=#F2B101 align=center></td></tr>"
else
totalcount=rs.recordcount
maxpage=8
page=request("page")
if page="" or page<1 then
page=1
end if
if (totalcount mod maxpage)=0 then
pagecount=totalcount\maxpage
else
pagecount=totalcount\maxpage+1
end if
if Page=1 then
rs.movefirst
showContent
showpage totalcount,maxpage,"dmy.asp"
elseif (page-1)*maxpage<totalcount then
rs.move (page-1)*maxpage
showContent
showpage totalcount,maxpage,"dmy.asp"
else
page=1
showContent
showpage totalcount,maxpage,"dmy.asp"
end if
end if
rs.close
set rs=nothing
rs1.close
set rs1=nothing
end sub
sub showContent
dim maxpage,page,pagecount
do while not rs.eof
%>
<tr>
<td width=10> </td>
<td width=20% align=center><%=rs("addtime")%></td>
<td width=10% align=center><%if rs("private")=1 then%><font color=#0000ff>公开<%else%><font color=#ff0000>保密<%end if%></font></td>
<td width=15% align=center><%=rs("feeling")%></td>
<td width=10%><%if len(rs("title"))>20 then%><%=left(rs("title"),20)%>...<%else%><%=rs("title")%><%end if%></td><td width=35%><%=rs("content")%></td>
<td width=10% align=center><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("id"))%>'></td>
</tr>
<tr>
<td width=10></td>
<td colspan=5 height=1 bgcolor=#F2B101></td>
</tr>
<%
if i>maxpage then exit do
rs.movenext
loop
%>
<tr>
<td colspan=5 height=30 valign=bottom align=right><input type='submit' class=input2 value='删除所选日记'></td>
</tr>
</form>
</table>
<%end sub%>
<%
function showpage(totalcount,maxpage,filename)
dim n,page
if totalcount mod maxpage=0 then
n= totalcount \ maxpage
else
n= totalcount \ maxpage+1
end if
response.write "<center>"
response.write "<form method=Post action="&filename&">"
response.write "<font color='red'></font> "
if Page<2 then
response.write "<font color='#000080'>首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="&(Page-1)&">上一页</a> "
end if
if n-page<1 then
response.write "<font color='#000080'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(Page+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "<font color='#000080'> 页次:</font><strong><font color=red>"&Page&"</font><font color='#000080'>/"&n&"</strong>页</font> "
response.write "<font color='#000080'> 共<b>"&totalcount&"</b> 条记录<b> "&maxpage&"</b>条记录/页</font> "
response.write " <font color='#000080'>转到:</font><input class=lbrltb type='text' name='page' size='2'>"
response.write "<input type='image' src='images/go.gif'></form>"
response.write "</center>"
end function
sub deleteannounce(id)
dim rs,sql
response.write "<center><font color=red>"
set rs=server.createobject("adodb.recordset")
sql="delete from diary where id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删除失败 !<br>"
else
response.write "删除成功!<br>"
end if
response.write "</font></center>"
set rs=nothing
conn.close
set conn=nothing
End sub
%>
</center>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -