📄 admin_class.asp
字号:
<!--#include file=conn.asp-->
<!--#include file=admin_cookie.asp-->
<!--#include file=head.asp-->
<!--#include file=tohtml.asp-->
<%
self=request.servervariables("ulr")
%>
<%
function ok(a)
response.write "<br><table width=90% align=center cellpadding=3 cellspacing=1 bgcolor=black><tr><td bgcolor=white valign=middle height=120 align=center>"&a&"</table><meta http-equiv='refresh' content='1 url=admin_class.asp'>"
response.end
end function
%>
<%
if request("xgclass2")<>"" then
session("cla")="" '提交文章的默认。。
xgclass1=server.htmlencode(trim(request("xgclass1")))
classnum1=server.htmlencode(trim(request("classnum1")))
id1=request.cookies("id")
xiugaiclass=request.cookies("xiugaiclass")
if xgclass1="" or classnum1="" then ok("所填项目不能为空!返回!")
if not isnumeric(classnum1) then ok("序号必须全部为数字!")
set conn=server.createobject("adodb.connection")
conn.open connstr
if conn.execute("select * from class where id="&id1&"").eof then ok("没有这个类别,可能已经被删除了!")
if xgclass1<>xiugaiclass and not conn.execute("select * from class where class='"&xgclass1&"'").eof then ok("这个类别已经有了,请改名")
conn.execute("update class set class='"&xgclass1&"',num="&classnum1&" where id="&id1&"")
if conn.execute("select * from wz where class='"&xiugaiclass&"'").eof then ok("修改成功,本类别没有文章!")
'修改文章中的类别,将文章重写!/不完善!
function w(a,b)
set fso=server.createobject("scripting.filesystemobject")
set fp=fso.createtextfile(server.mappath(a))
fp.write(b)
end function
set rs=conn.execute("select * from wz where class='"&xiugaiclass&"'")
do while not rs.eof
main= "<head><link href=../t.css rel=stylesheet></link><title>"&webtitle&":"&rs("title")&"--Powerd by www.51Dr.com</title></head>"&adtop&" <table width=90% align=center><tr><td class=td1><br>  <a href=../> "&webtitle&"</a> "&xgclass1&"<table width=90% align=center border=0 cellpadding=0 cellspacing=0><tr><td></table><h3 align=center>"&rs("title")&"</h3> <hr size=1 width=90% align=center ><p align=center><font color=silver size=2>文:"&rs("user")&" 发表时间"&rs("date")&"</font></p><table width=90% align=center cellpadding=0 cellspacing=0><tr><td bgcolor=white>"&to_html(rs("nr"))&"</table><table width=90% align=center cellpadding=0 cellspacing=0><tr><td> <br><br><br></table></table>"&adbottom&adfloat&"<iframe src=../count.asp?num="&rs("num")&" frameborder=0 scrolling=no width=0 height=0></iframe>"
w "58down/"&rs("num")&".htm",main
rs.movenext
loop
conn.execute("update wz set class='"&request("xgclass1")&"' where class='"&xiugaiclass&"'")
ok("修改成功!!")
conn.close
response.end
end if
%>
<%
if request("action")="xg" then
if request("cla")="" then ok("未知的错误!")
set conn=server.createobject("adodb.connection")
conn.open connstr
if conn.execute("select * from class where class='"&request("cla")&"'").eof then ok("没有这个类别,可能已经被删除了!")
set rs=conn.execute("select * from class where class='"&request("cla")&"'")
clas=rs("class")
classnum=rs("num")
id=rs("id")
conn.close
response.cookies("id")=id
response.cookies("xiugaiclass")=clas
%>
<br>
<form method=post action=<%=self%>>
<table width=90% align=center cellpadding=3 cellspacing=1 bgcolor=black>
<tr><td colspan=2 bgcolor=white align=center>修改分类</tr>
<tr><td bgcolor=white>分类名:<td bgcolor=white><input class="inpute" name=xgclass1 value=<%=clas%>>
<tr><td bgcolor=white>序号:<td bgcolor=white><input class="inpute" name=classnum1 value=<%=classnum%>><br>(浏览的顺序,与大小成正比!)
<tr><td bgcolor=white align=center colspan=2><input type=submit class=input1 value=提交 name=xgclass2>  <input class="input1" type=reset ></table>
<%
response.end
end if
%>
<%
if request("action")="del" then
delclass=server.htmlencode(trim(request("cla")))
if delclass="" then ok("未知错误!")
set conn=server.createobject("adodb.connection")
conn.open connstr
if conn.execute("select * from class where class='"&delclass&"'").eof then ok("你要操作的类别可能已经被删除!")
conn.execute("delete * from class where class='"&delclass&"'")
set rs=server.createobject("adodb.recordset")
rs.open "select * from wz where class='"&delclass&"'",conn,1,1
if rs.eof then ok("删除类别成功")
for i=1 to rs.recordcount
if rs.eof then exit for
set fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(server.mappath("58down/"&rs("num")&".htm")) then
fso.deletefile(server.mappath("58down/"&rs("num")&".htm"))
end if
set fso=nothing
rs.movenext
next
conn.execute("delete * from wz where class='"&delclass&"'")
conn.close
ok("删除类别成功!")
response.end
end if
%>
<%
if request("add")<>"" then
addclass=server.htmlencode(trim(request("addclass")))
if addclass="" then ok("错误,你的类别不能为空!")
set conn=server.createobject("adodb.connection")
conn.open connstr
if not conn.execute("select * from class where class='"&addclass&"'").eof then ok("你要添加的类别已经有了啊!")
set rs=server.createobject("adodb.recordset")
rs.open "select * from class",conn,1,3
rs.addnew
rs("class")=addclass
rs.update
conn.close
ok("添加新类别成功!")
response.end
end if
%>
<style>
a:link{text-decoration:none;color:blue}
a:visited{text-decoration:none;color:blue}
a:hover{text-decoration:underline;color:red}
</style>
<div align=center>类别管理</div>
<table width=90% align=center cellpadding=3 cellspacing=1 bgcolor=black><tr><td bgcolor=white>
<form method=post action=<%=self%>>
添加类别:<input class="inpute" name=addclass size=13><input type=submit class="input1" value="提交" name="add">
</table>
<br><table width=90% align=center cellpadding=3 cellspacing=1 bgcolor=black><tr><td bgcolor=white align=center>类别名称<td bgcolor=white align=center>顺序<td bgcolor=white align=center>修改
<td bgcolor=white align=center>删除
<%
set conn=server.createobject("adodb.connection")
conn.open connstr
set rs=conn.execute("select * from class order by num asc")
do while not rs.eof
response.write "<tr><td bgcolor=white><a class=SoftMeun target=_blank href=default.asp?class="&rs("class")&">"&rs("class")&"</a><td bgcolor=white>"&rs("num")&"<td bgcolor=white><a class=SoftMeun href="&self&"?action=del&cla="&rs("class")&">删除</a><td bgcolor=white><a class=SoftMeun href="&self&"?action=xg&cla="&rs("class")&">修改</a>"
rs.movenext
loop
conn.close
%>
</table>
<br><table width=90% align=center cellpadding=3 cellspacing=1 bgcolor=black><tr><td height=120 bgcolor=white>
说明:<br>
 1.<font color=red>如果删除类别,将删除本类别的所有文章!如果修改,由于是生成静态页面,如果类别文章过多,可能在修改页面时很慢!甚至丢失数据</font><br>
 2.如果要修改类别顺序,请进入修改!
</ol>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -