📄 admin_gonggao.asp
字号:
<%' ==================================================
'// 粑粑工作室留言本
'// 程序版本: 粑粑工作室留言本 v2.1
'// 技术支持: www.gongliyi.cn
'// 程序演示: www.gongliyi.cn/book2
'// 作 者: 龚礼仪(粑粑)
'// 文件信息: admin_gonggao.asp(公告管理文件)
'// 最后修改: 2008.11.23
'// 升级修改: 2009.04.05
' ==================================================
%>
<%
if session("adminname")="" then
response.redirect "admin_login.asp"
response.end
end if
%>
<!--#include file="include/conn.asp"-->
<!--#include file="include/system.asp"-->
<!--#include file="include/function.asp"-->
<!--#include file="ubb.asp"-->
<!--#include file="head.asp"-->
<div id="main">
<div id="submit">
<%if request.QueryString("action")="edit" then%>
<%id=request.QueryString("id")
set rs=server.CreateObject("adodb.recordset")
sql="select * from gonggao where id="&id
rs.open sql,conn,1,3
if rs.eof then
response.write("")
response.end
end if%>
<form action="admin_gonggao.asp?action=edits" method="post" name="form" id="form" onSubmit="return FrontPage_Form1_Validator(this)">
<p><img src="images/i1.gif" /><img src="images/mgonggao.gif" /><br /><br />
<label for="title">公告标题:</label>
<input type="text" id="titles" name="titles" value="<%=rs("titles")%>" />
<span class="STYLE2">*</span> 请填公告标题<br />
<label for="content">公告内容:</label>
<textarea id="content" name="content"><%=rs("content")%></textarea>
<span class="STYLE2">*</span><br />
<label for="comment"> </label>
<span>提交前请按Ctrl+C保存留言内容,以免程序出错而丢失! </span><br />
<input type="submit" id="sbutton" value="确 定" />
<br />
<input name="ac" type="hidden" id="ac" value="edits" />
<%rs.close
set rs=nothing%>
</form>
<%else%>
<form action="admin_gonggao.asp?action=add" method="post" name="form" id="form" onSubmit="return FrontPage_Form1_Validator(this)">
<p><img src="images/i1.gif" /><img src="images/addgonggao.gif" /><br /><br />
<label for="title">公告标题:</label>
<input type="text" id="titles" name="titles" value="" />
<span class="STYLE2">*</span> 请填公告标题<br />
<label for="content">公告内容:</label>
<textarea id="content" name="content"></textarea>
<span class="STYLE2">*</span><br />
<label for="comment"> </label>
<span>提交前请按Ctrl+C保存留言内容,以免程序出错而丢失! </span><br />
<input type="submit" id="sbutton" value="确 定" />
<br />
<input name="ac" type="hidden" id="ac" value="add" />
</form>
<%end if%>
</div>
</div>
<!--#include file="foot.asp"-->
<%
if request("action")="add" then
titles=request.form("titles")
content= Ubbcode(Replace(HTMLEncode(RemoveHTML(CheckStr(Request.Form("content")))),"'","''"))
if titles="" 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 gonggao"
rs.Open sql, Conn, 1, 3
rs.AddNew
rs("titles") = trim(Request("titles"))
rs("content") = content
rs("addtime") = now()
rs("adminname") = session("adminname")
rs.Update
set rs = nothing
Response.write ("<script>alert('添加成功!');window.location='index.asp';</script>")
end if
%>
<%
if request("action")="edits" then
titles=request.form("titles")
content= Ubbcode(Replace(HTMLEncode(RemoveHTML(CheckStr(Request.Form("content")))),"'","''"))
if titles="" 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 gonggao"
rs.Open sql, Conn, 1, 3
rs("titles") = trim(Request("titles"))
rs("content") = content
rs("addtime") = now()
rs("adminname") = session("adminname")
rs.Update
set rs = nothing
Response.write ("<script>alert('修改成功!');window.location='index.asp';</script>")
end if
%>
<%if request("action")="del" then
id=request.QueryString("id")
set rs=server.CreateObject("adodb.recordset")
sql="select * from gonggao where id="&request("id")&""
rs.open sql,conn,1,3
rs.delete
conn.close
set conn=nothing
response.Write("<script>alert('删除成功,点击返回!');window.location='index.asp';</script>")
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -