?? admin.asp
字號:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<%
'判斷登陸
if Session("admin") <> "true" Then
Response.Redirect("login.asp")
End If
title=Replace(request("title_txt")," ","")
content=request("content_txt")
if request("action")="save" then
if title="" Then
Response.Write("<script language=""JavaScript"">alert(""錯誤:您沒輸入標題,請返回檢查!!"");history.go(-1);</script>")
response.End
end if
if content="" Then
Response.Write("<script language=""JavaScript"">alert(""錯誤:您沒輸入內容,請返回檢查!!"");history.go(-1);</script>")
response.End
end if
Set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from news"
rs.open sql,conn,1,3
rs.addnew
rs("Title")=title
rs("Content")=content
rs("Times")=date()
rs.update
rs.close
response.Write"<script>alert(""留言成功!"");window.location.href='admin.asp';</script>"
end If
if request("action")="del" and request("id")<>"" Then
set rs=server.createobject("ADODB.RecordSet")
sql="delete from news where ID="&request("id")
rs.open sql,conn,1,3
end if
if request("action")="updata" and request("id")<>"" Then
Set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from news where ID="&request("id")
rs.open sql,conn,1,3
rs("Title")=title
rs("Content")=content
rs("Times")=date()
rs.update
rs.close
response.Write"<script>alert(""修改成功!"");window.location.href='admin.asp';</script>"
end If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>admin</title>
<style type="text/css">
<!--
.input{
background:#000000;
border:1px solid #666666;
color:#666666;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #333333;
}
#Layer1 {
position:absolute;
width:200px;
height:46px;
z-index:1;
left: -2px;
top: 196px;
}
#Layer2 {
position:absolute;
width:200px;
height:45px;
z-index:2;
left: -2px;
top: 259px;
}
#Layer3 {
position:absolute;
width:858px;
height:416px;
z-index:3;
left: 281px;
top: 37px;
}
#Layer4 {
position:absolute;
width:802px;
height:352px;
z-index:4;
left: 308px;
top: 62px;
}
.STYLE1 {color: #FFFFFF}
#Layer5 {
position:absolute;
width:862px;
height:115px;
z-index:5;
left: 282px;
top: 455px;
}
#Layer6 {
position:absolute;
width:807px;
height:576px;
z-index:6;
left: 314px;
top: 463px;
}
.STYLE5 {color: #FFFFFF; font-size: 12px; font-family: "宋體"; }
.STYLE6 {
font-family: "宋體";
font-size: 12px;
}
.STYLE9 {color: #FFFFFF; font-size: 12px; }
.STYLE10 {color: #999999}
.STYLE11 {color: #999999; font-size: 12px; font-family: "宋體"; }
.STYLE13 {color: #CCCCCC; font-size: 12px; font-family: "宋體"; }
.STYLE14 {font-family: "宋體"}
a {
font-family: 宋體;
font-size: 12px;
}
a:link {
text-decoration: none;
color: #999999;
}
a:visited {
text-decoration: none;
color: #999999;
}
a:hover {
text-decoration: none;
color: #999999;
}
a:active {
text-decoration: none;
color: #999999;
}
body,td,th {
font-family: 宋體;
font-size: 12px;
color: #CCCCCC;
}
h1,h2,h3,h4,h5,h6 {
font-family: 宋體;
}
h1 {
font-size: 12px;
color: #999999;
}
h2 {
font-size: 12px;
color: #999999;
}
h3 {
font-size: 12px;
color: #999999;
}
h4 {
font-size: 12px;
color: #999999;
}
h5 {
font-size: 12px;
color: #999999;
}
h6 {
font-size: 12px;
color: #999999;
}
-->
</style></head>
<body>
<img src="img/zuoxianshi.png" width="250" height="1000" />
<div id="Layer3">
<form id="form1" name="form1" method="post" action="">
<img src="img/bianji.png" width="858" height="399" />
</form>
</div>
<div id="Layer4">
<form id="form2" name="form2" method="post" action="">
<table width="790" height="172" border="0">
<tr>
<td width="239" height="26"><div align="center"><span class="STYLE13">標題</span></div></td>
<td width="382"><p align="center" class="STYLE13">添加時間</p> </td>
<td width="155"><div align="center"><span class="STYLE13">管理</span></div></td>
</tr>
<%
Set rsnews=Server.CreateObject("ADODB.RecordSet")
sql="select * from news order by ID desc"
rsnews.open sql,conn,1,1
if rsnews.eof and rsnews.bof then
response.Write("<tr><td colspan='3' align='center'><span class='STYLE1'>暫無留言</span></td></tr>")
else
rsnews.pagesize=10
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rsnews.pagecount then epage=rsnews.pagecount
else
epage=1
end if
rsnews.absolutepage=epage
for i=0 to rsnews.pagesize-1
if rsnews.eof then exit for
%>
<tr>
<td height="27"><div align="center" class="STYLE6">
<div align="left"><span class='STYLE1'> <%= rsnews("Title") %></span></div>
</div></td>
<td><div align="center" class="STYLE14"><span class='STYLE9'><%= rsnews("Times") %></span></div></td>
<td><div align="center"><span class="STYLE1"> <span class='STYLE1'><span class="STYLE6"><a href="admin.asp?action=change&id=<%= rsnews("ID") %>"><span class="STYLE10">修改</span></a>|<a href="admin.asp?action=del&id=<%= rsnews("ID") %>"><span class='STYLE11'>刪除</span></a></span></span></div></td>
</tr>
<%
rsnews.movenext
next
end if
%>
<tr>
<td> </td>
<td colspan="2"><p align="right">
<a href="admin.asp"><span class='STYLE5 STYLE10'> 首頁</span></a><span class="STYLE6 STYLE10">
<a href="admin.asp?page=<%=epage-1%>">前一頁</a>
<a href="admin.asp?page=<%=epage+1%>">后一頁</a> <a href="admin.asp?page=<%=rsnews.pagecount%>"><span class='STYLE1'>末頁</a></span><span class='STYLE5 STYLE10'> <%=epage%>/<%=rsnews.pagecount%></span></p>
</td>
</tr>
</table>
</form>
</div>
<form id="form3" name="form3" method="post" <%if request("action")="change" then%>action="admin.asp?action=updata"<%else%>action="admin.asp?action=save"<%end if%>>
<div id="Layer5">
<img src="img/bianji.png" width="854" height="412" /></div>
<div class="STYLE1" id="Layer6">
<%if request("action")="change" and request("id")<>"" Then
Set rsnews=Server.CreateObject("ADODB.RecordSet")
sql="select * from news where ID="&request("id")
rsnews.open sql,conn,1,1
end if
%>
<table width="771" height="498" border="0" align="left">
<tr>
<td width="41" height="53"><span class="STYLE6">標題:</span></td>
<td width="720" align="left">
<label>
<%if request("action")="change" then%>
<input name="id" type="hidden" value="<%=rsnews("ID")%>" />
<input name="title_txt" type="text" size="40" value="<%=rsnews("Title")%>" class="input" />
<%else%>
<input name="title_txt" type="text" size="40" value="" class="input"/>
<%end if%>
</label>
</td>
</tr>
<tr>
<td height="371" valign="top"><p class="STYLE6"> </p>
<p class="STYLE6">內容:</p></td>
<td align="left" valign="top">
<label>
<div align="center" class="STYLE6">
<%if request("action")="change" then%>
<textarea name="content_txt" cols="100" rows="15" class="input"><%=rsnews("Content")%></textarea>
<%else%>
<textarea name="content_txt" cols="100" rows="15" class="input"></textarea>
<%end if%>
<%if request("action")="change" then%>
<input name="Submit" type="submit" class="input" value="修改" />
<%else%>
<input name="Submit" type="submit" class="input" value="提交" />
<%end if%>
<input name="Submit2" type="reset" class="input" value="重置" />
</div>
</label></td>
</tr>
<tr><td height="39" colspan="2" align="center" valign="top"> </td>
</tr>
</table>
<p align="justify"> </p>
</div>
</form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -