?? admin_diary.asp
字號:
<%Admin="diary"%>
<!--#include file="check.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="mdb.asp"-->
<!--#include file="inc/FORMAT.asp"-->
<%
if session("adminlogin")<>sessionvar then
Response.Write("<script language=javascript>alert('你尚未登錄,或者超時了!請重新登錄');this.top.location.href='admin.asp';</script>")
response.end
else
if Request.form("MM_insert") then
if request.form("action")="newdiary" then
sql="select * from diary"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
dim d_content
d_content=rtrim(request.form("textfield"))
d_content=trim(replace(d_content," "," "))
if d_content="" then
founderr=true
Response.Write("<script language=javascript>alert('你必須輸入公告內容!');history.back(1);</script>")
else
rs("d_content")=d_content
end if
if not founderr then
rs.update
rs.close
set rs=nothing
sql="update allcount set diarycount = diarycount + 1"
conn.execute(sql)
response.redirect "admin_diary.asp"
else
call diserror()
response.end
end if
end if
if request.form("action")="editdiary" then
if request.form("id")="" then
founderr=true
Response.Write("<script language=javascript>alert('你必須指定操作的對象!');history.back(1);</script>")
else
if not isInteger(request.form("id")) then
founderr=true
Response.Write("<script language=javascript>alert('非法的id參數。');history.back(1);</script>")
end if
end if
if founderr then
call diserror()
response.End
end if
sql="select * from diary where d_id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
d_content=rtrim(request.form("textfield"))
d_content=trim(replace(d_content," "," "))
if d_content="" then
founderr=true
Response.Write("<script language=javascript>alert('你必須輸入公告內容!');history.back(1);</script>")
else
rs("d_content")=d_content
end if
if not founderr then
rs.update
rs.close
set rs=nothing
response.redirect "admin_diary.asp"
else
call diserror()
response.end
end if
end if
if request.form("action")="deldiary" then
if request.form("id")="" then
founderr=true
Response.Write("<script language=javascript>alert('你必須指定操作的對象!');history.back(1);</script>")
else
if not isInteger(request.form("id")) then
founderr=true
Response.Write("<script language=javascript>alert('非法的id參數。');history.back(1);</script>")
end if
end if
if founderr then
call diserror()
response.End
end if
sql="select * from diary where d_id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if not founderr then
rs.delete
rs.close
set rs=nothing
sql="update allcount set diarycount = diarycount - 1"
conn.execute(sql)
response.redirect "admin_diary.asp"
else
call diserror()
response.end
end if
end if
end if
dim totaldiary,adperpage1,Currentpage,totalpages,i
adperpage1=15
sql="select * from diary order by d_id DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<HTML><HEAD><TITLE>管理中心</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="inc/admin.css" type=text/css rel=StyleSheet>
<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
</HEAD>
<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey)) >
<%if request.querystring("action")="" then%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=lanyubk style="border-collapse: collapse">
<tr class=lanyuss>
<td colspan="4">公告管理</td>
</tr>
<tr class=lanyuqs align="center">
<td width="50">編號</td>
<td width="*">內容</td>
<td width="150">時間</td>
<td width="100">操作</td>
</tr>
<%if not rs.eof then
rs.Movefirst
rs.pagesize=adperpage1
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)*adperpage1<totaldiary then
rs.move(currentpage-1)*adperpage1
dim bookmark
bookmark=rs.bookmark
end if
end if
if (totaldiary mod adperpage1)=0 then
totalpages=totaldiary\adperpage1
else
totalpages=totaldiary\adperpage1+1
end if
i=0
do while not rs.eof and i<adperpage1
%>
<tr class=lanyuds>
<td align="center"><%=rs("d_id")%> </td>
<td><%=cutstr(formatstr(rs("d_content")),20,false,none)%></td>
<td align="center"><%=rs("d_date")%></td>
<td align="center"><a href="admin_diary.asp?id=<%=rs("d_id")%>&action=editdiary#editdiary">編輯</a>
<a href="admin_diary.asp?id=<%=rs("d_id")%>&action=deldiary#deldiary">刪除</a></td>
</tr>
<%i=i+1
rs.movenext
loop
else
If rs.EOF And rs.BOF Then%>
<tr class=lanyuds>
<td colspan=4 align="center">當前還沒有公告!</td>
</tr>
<%end if
end if%>
<form name="form2" method="post" action="admin_diary.asp">
<tr class=lanyuqs>
<td colspan=4 align="right"><%=currentpage%>/<%=totalpages%>頁,<%=totaldiary%>條記錄/<%=adperpage1%>篇每頁.
<%
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
%>
<%=i%>
<%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>
<%end if
if request.querystring("action")="newdiary" then%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=lanyubk style="border-collapse: collapse">
<form name="form1" method="post" action="<%=MM_editAction%>">
<tr class=lanyuss>
<td>新的公告</td>
</tr>
<tr class=lanyuds>
<td> <input type="text" name="textfield" size="80" class="textarea">
</td>
</tr>
<tr class=lanyuqs>
<td 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
Response.Write("<script language=javascript>alert('請指定操作的對象!');history.back(1);</script>")
response.end
else
if not isinteger(request.querystring("id")) then
Response.Write("<script language=javascript>alert('非法的ID參數!');history.back(1);</script>")
response.end
end if
end if
sql="select * from diary where d_id="&cint(request.querystring("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=lanyubk style="border-collapse: collapse">
<form name="form1" method="post" action="<%=MM_editAction%>">
<tr class=lanyuss>
<td>修改公告</td>
</tr>
<tr class=lanyuds>
<td> <input type="text" name="textfield" size="80" class="textarea" value="<%=rs("d_content")%>">
</td>
</tr>
<tr class=lanyuqs>
<td 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("d_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
Response.Write("<script language=javascript>alert('請指定操作的對象!');history.back(1);</script>")
response.end
else
if not isinteger(request.querystring("id")) then
Response.Write("<script language=javascript>alert('非法的ID參數!');history.back(1);</script>")
response.end
end if
end if
sql="select * from diary where d_id="&cint(request.querystring("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=lanyubk style="border-collapse: collapse">
<form name="form1" method="post" action="<%=MM_editAction%>">
<tr class=lanyuss>
<td>刪除公告</td>
</tr>
<tr class=lanyuds>
<td><%=ubb2html(formatStr(autourl(rs("d_content"))), true, true)%>
<div align="right">發表于-<span class="newshead"><%=rs("d_date")%></span></div></td>
</tr>
<tr class=lanyuqs>
<td align="center">
<input type="submit" name="Submit" value="確定刪除" class="button">
[<a href="admin_diary.asp">返回</a>] </td>
</tr>
<input type="hidden" name="id" value="<%=rs("d_id")%>">
<input type="hidden" name="action" value="deldiary">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
rs.close
set rs=nothing
end if
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -