?? admindiary_body.asp
字號:
<%sub admindiary_body()
dim totaldiary,Currentpage,totalpages,i
sql="select * from diary order by diary_id DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<!--#include file="admintop.asp"-->
<table width="<%=tablewidth%>" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="205" bgcolor="#FFFFFF" valign="top" class="line">
<%call adminmenu()%>
</td>
<td width="565" bgcolor="#FFFFFF" valign="top" align="center" class="linee">
<table width="98%" border="0" cellpadding="0" cellspacing="1" background="images/dh.gif" class="linee">
<tr align="center">
<td width="50%" height="25"> <a href="admin_diary.asp">公告管理</a></td>
<td width="50%"><a href="admin_diary.asp?action=newdiary#newdiary">
新增公告</a></td>
</tr>
</table>
<table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"></td>
</tr>
</table>
<table width="98%" border="1" cellspacing="0" cellpadding="4" bordercolor="#09DD77" style="border-collapse: collapse">
<tr>
<td colspan="3" background="images/dh.gif">公告管理</td>
</tr>
<tr align="center" bgcolor="#E8E8E8">
<td width="10%" bgcolor="#F5F5F5">編號</td>
<td width="75%" bgcolor="#F5F5F5">內(nèi)容</td>
<td width="15%" bgcolor="#F5F5F5">操作</td>
</tr>
<%if not rs.eof then
rs.Movefirst
rs.pagesize=diaryperpage
if trim(request("page"))<>"" then
currentpage=clng(request("page"))
if currentpage>rs.pagecount then
currentpage=rs.pagecount
end if
else
currentpage=1
end if
totaldiary=rs.recordcount
if currentpage<>1 then
if(currentpage-1)*diaryperpage<totaldiary then
rs.move(currentpage-1)*diaryperpage
dim bookmark
bookmark=rs.bookmark
end if
end if
if (totaldiary mod diaryperpage)=0 then
totalpages=totaldiary\diaryperpage
else
totalpages=totaldiary\diaryperpage+1
end if
i=0
do while not rs.eof and i<diaryperpage
%>
<tr>
<td bgcolor="#FFFFFF" align="center"><%=rs("diary_id")%></td>
<td bgcolor="#FFFFFF"><%=cutstr(formatstr(rs("diary_content")),40,false,none)%> <%=rs("diary_date")%></td>
<td bgcolor="#FFFFFF" align="center"><a href="admin_diary.asp?id=<%=rs("diary_id")%>&action=editdiary#editdiary">edit</a>
<a href="admin_diary.asp?id=<%=rs("diary_id")%>&action=deldiary#deldiary">del</a></td>
</tr>
<%i=i+1
rs.movenext
loop
else
If rs.EOF And rs.BOF Then%>
<tr>
<td bgcolor="#FFFFFF" colspan=3 align="center">當前還沒有公告!</td>
</tr>
<%end if
end if%>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<form name="form2" method="post" action="admin_diary.asp">
<tr>
<td height="5"></td>
</tr>
<tr>
<td align="right"><%=currentpage%>/<%=totalpages%>頁,共<%=totaldiary%>條記錄,<%=diaryperpage%>條記錄/每頁.
<%
i=1
dy10=false
showye=totalpages
if showye>10 then
dy10=true
showye=10
end if
for i=1 to showye
if i=currentpage then
%>
<B><%=i%></B>
<%else%>
<a href="admin_diary.asp?page=<%=i%>"><%=i%></a>
<%end if
next
if totalpages>currentpage then
if request("page")="" then
page=1
else
page=request("page")+1
end if%>
<a href="admin_diary.asp?page=<%=page%>" title="下一頁">>></a>
<%end if%>
</td>
</tr>
</form>
</table>
<br>
<%if request.querystring("action")="newdiary" then%>
<table width="98%" border="1" cellspacing="0" cellpadding="4" bordercolor="#09DD77" style="border-collapse: collapse">
<form name="form1" method="post" action="<%=MM_editAction%>">
<tr>
<td background="images/dh.gif"><a name="newdiary">新增公告</a></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<%call ubbshow()%> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<textarea name="textfield" cols="80" rows="19" class="textarea" wrap="VIRTUAL"></textarea>
</td>
</tr>
<tr>
<td bgcolor="#F5F5F5" align="center" height="30">
<input type="submit" name="Submit" value="確定新增" class="button">
<input type="reset" name="Reset" value="清空重寫" class="button">
</td>
</tr>
<input type="hidden" name="action" value="newdiary">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
if request.querystring("action")="editdiary" then
if request.querystring("id")="" then
errmsg=errmsg+"<br>"+"<li>請指定操作的對象!"
call diserror()
response.end
else
if not isinteger(request.querystring("id")) then
errmsg=errmsg+"<br>"+"<li>非法的日記ID參數(shù)!"
call diserror()
response.end
end if
end if
sql="select * from diary where diary_id="&cint(request.querystring("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table width="98%" border="1" cellspacing="0" cellpadding="4" bordercolor="#09DD77" style="border-collapse: collapse">
<form name="form1" method="post" action="<%=MM_editAction%>">
<tr>
<td background="images/dh.gif"><a name="editdiary">修改公告</a></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<%call ubbshow()%> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<textarea cols="80" rows="19" class="textarea" wrap="VIRTUAL" name="textfield"><%=rs("diary_content")%></textarea>
</td>
</tr>
<tr>
<td bgcolor="#F5F5F5" align="center" height="30">
<input type="submit" name="Submit" value="確定修改" class="button">
<input type="reset" name="Reset" value="清空重寫" class="button">
</td>
</tr>
<input type="hidden" name="id" value="<%=rs("diary_id")%>">
<input type="hidden" name="action" value="editdiary">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
if request.querystring("action")="deldiary" then
if request.querystring("id")="" then
errmsg=errmsg+"<br>"+"<li>請指定操作的對象!"
call diserror()
response.end
else
if not isinteger(request.querystring("id")) then
errmsg=errmsg+"<br>"+"<li>非法的公告ID參數(shù)!"
call diserror()
response.end
end if
end if
sql="select * from diary where diary_id="&cint(request.querystring("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table width="98%" border="1" cellspacing="0" cellpadding="4" bordercolor="#09DD77" style="border-collapse: collapse">
<form name="form1" method="post" action="<%=MM_editAction%>">
<tr>
<td background="images/dh.gif"><a name="deldiary">刪除公告</a></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><%=ubb2html(formatStr(autourl(rs("d_content"))), true, true)%>
<div align="right"><br><br><br>
第<%=rs("diary_id")%>篇,發(fā)表于-<%=rs("diary_date")%></div></td>
</tr>
<tr>
<td bgcolor="#F5F5F5" align="center" height="30">
<input type="submit" name="Submit" value="確定刪除" class="button">
[<a href="admin_diary.asp">返回</a>] </td>
</tr>
<input type="hidden" name="id" value="<%=rs("diary_id")%>">
<input type="hidden" name="action" value="deldiary">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if%>
<br>
</td>
</tr>
</table>
<%
rs.close
set rs=nothing
end sub%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -