📄 admin_article.asp
字号:
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/FORMAT.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/public.asp"-->
<!--#include file="../inc/check.asp"-->
<%
if request.QueryString("╲、衡少゛")="del" then'
SoftID=trim(request("SoftID"))
Action=Trim(Request("Action"))
tab=request("tab")
url=request("url")
if Action="" then
response.Write"<script>alert('参数不足!');</script>"
response.Write"<script>history.go(-1);</script>"
end if
if SoftID="" then
response.Write"<script>alert('请选择要操作的记录!');</script>"
response.Write"<script>history.go(-1);</script>"
end if
call DelSoft()
call closeconn()
sub DelSoft()
if instr(SoftID,",")>0 then
SoftID=replace(SoftID," ","")
sqlDel="select * from "&tab&" where id in (" & SoftID & ")"
else
SoftID=Clng(SoftID)
sqlDel="select * from "&tab&" where id =" & SoftID
end if
Set rsDel= Server.CreateObject("ADODB.Recordset")
rsDel.open sqlDel,conn,1,3
do while not rsDel.eof
rsDel.delete
rsDel.movenext
loop
rsDel.close
set rsDel=nothing
response.Write"<script>alert('恭喜您!批量删除成功!');location.href='"&url&"';</script>"
end sub
end if
if Request.form("MM_insert") then
if request.Form("action")="newartcat" then
sql="select * from Gq_newsclass"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
dim cat_name
cat_name=trim(replace(request.form("cat_name"),"'",""))
if cat_name="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写文章分类');history.back(1);</script>")
else
rs("cat_name")=cat_name
end if
if founderr then
call closeconn()
response.end
else
rs.update
rs.close
set rs=nothing
response.redirect "admin_article.asp"
end if
end if
if request.Form("action")="editartcat" 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 closeconn()
response.End
end if
sql="select * from Gq_newsclass where cat_id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
cat_name=trim(replace(request.form("cat_name"),"'",""))
if cat_name="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写文章分类');history.back(1);</script>")
else
rs("cat_name")=cat_name
end if
if founderr then
call closeconn()
response.end
else
rs.update
rs.close
set rs=nothing
response.redirect "admin_article.asp"
end if
end if
if request.Form("action")="delartcat" 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 closeconn()
response.End
end if
sql="select * from Gq_newsclass where cat_id="&cint(request.form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.delete
rs.close
set rs=nothing
response.redirect "admin_article.asp"
end if
end if
sql="select * from Gq_newsclass order by cat_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="admin_style.css" type=text/css rel=StyleSheet>
<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
</HEAD>
<script src="inc/admin.js" type=""text/javascript""></script>
<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey))>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<tr>
<th>文章管理</th>
</tr>
<tr>
<td class=tablerow1><b>管理选项:</b><a href="?action=cat">文章首页</a> | <a href="?action=newart">添加文章</a> | <a href="admin_article.asp">分类管理</a> | <a href="?action=newartcat">添加分类</a></td>
</tr>
</table>
<br>
<%if request.QueryString("action")="" then%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<tr align="center">
<th width="10%">编号</th>
<th width="70%">分类名称</th>
<th width="20%">操作</th>
</tr>
<%do while not rs.eof%>
<tr>
<td align="center" class="TableRow2"><%=rs("cat_id")%></td>
<td class="TableRow2"><a href="#"><%=rs("cat_name")%></a></td>
<td align="center" class="TableRow2">
<a href="admin_article.asp?id=<%=rs("cat_id")%>&action=editartcat">编辑</a>
<a href="admin_article.asp?id=<%=rs("cat_id")%>&action=delartcat">删除</a></td>
</tr>
<%rs.movenext
loop
if rs.bof and rs.eof then%>
<tr align="center">
<td colspan="3" class="TableRow2">当前没有文章分类!</td>
</tr>
<%end if%>
</table>
<%end if
if request.QueryString("action")="newartcat" then%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<form name="form1" method="post" action="admin_article.asp?action=art&artcat_art=<%=request.querystring("artcat_id")%>">
<tr>
<th>文章分类管理--添加分类</th>
</tr>
<tr>
<td class=tablerow1>分类名称:<input type="text" name="cat_name" size="40"></td>
</tr>
<tr>
<td class=tablerow1 align="center" height="30">
<input type="submit" name="Submit" value="确定新增" class="button">
<input type="reset" name="reset" value="清空重写" class="button">
<input type="button" value="返回" onClick="location.href='admin_article.asp'" class="button"></td>
</tr>
<input type="hidden" name="action" value="newartcat">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
if request.QueryString("action")="editartcat" then
if request.querystring("id")="" then
Response.Write("<script language=javascript>alert('请指定操作的对象!');history.back(1);</script>")
call closeconn()
response.end
else
if not isinteger(request.querystring("id")) then
Response.Write("<script language=javascript>alert('非法的id参数');history.back(1);</script>")
call closeconn()
response.end
end if
end if
sql="select * from Gq_newsclass where cat_id="&cint(request.querystring("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<form name="form1" method="post" action="admin_article.asp">
<tr>
<th>文章分类管理--修改分类</th>
</tr>
<tr>
<td class=tablerow1>分类名称:<input name="cat_name" type="text" class="textarea" id="cat_name" size="40" value="<%=rs("cat_name")%>"></td>
</tr>
<tr>
<td class=tablerow1 align="center" height="30">
<input name="Submit" type="submit" class="button" id="Submit" value="确定修改">
<input type="button" value="返回" onClick="location.href='admin_article.asp'" class="button"></td>
</tr>
<input type="hidden" name="id" value="<%=rs("cat_id")%>">
<input type="hidden" name="action" value="editartcat">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
if request.QueryString("action")="delartcat" then
if request.querystring("id")="" then
Response.Write("<script language=javascript>alert('请指定操作的对象!');history.back(1);</script>")
call closeconn()
response.end
else
if not isinteger(request.querystring("id")) then
Response.Write("<script language=javascript>alert('非法的id参数');history.back(1);</script>")
call closeconn()
response.end
end if
end if
sql="select * from Gq_newsclass where cat_id="&cint(request.querystring("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<form name="form1" method="post" action="admin_article.asp">
<tr>
<th>文章分类管理--删除分类</th>
</tr>
<tr>
<td class=tablerow1>分类名称- <%=rs("cat_name")%></td>
</tr>
<tr>
<td class=tablerow1 align="center" height="30">
<input name="Submit" type="submit" class="button" id="Submit" value="确定删除">
<input type="button" value="返回" onClick="location.href='admin_article.asp'" class="button"></td>
</tr>
<input type="hidden" name="id" value="<%=rs("cat_id")%>">
<input type="hidden" name="action" value="delartcat">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
if request.QueryString("action")="cat" then
%>
<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<form method="post" name="form" id="form" action="?╲、衡少゛=del" onsubmit="return downdel();">
<tr align="center">
<th width="4%">选择</th>
<th width="*">文章标题</th>
<th width="15%">操作</th>
<th width="5%">推荐</th>
<th width="10%">更新日期</th>
</tr>
<tr>
<td class=tablerow1 colspan="5" align="right"><b>文章导航:</b>
<select name="go" style="margin:-3px" onChange='window.location=form.go.options[form.go.selectedIndex].value'>
<option value="admin_article.asp?action=cat">≡全部文章列表≡</option>
<%sql="select * from Gq_newsclass"
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof%>
<option value="admin_article.asp?action=cat&cat_id=<%=rs2("cat_id")%>"><%=rs2("cat_name")%></option>
<%rs2.movenext
loop
if rs2.bof and rs2.eof then%><option value="">当前没有分类</option>
<%end if
rs2.close
set rs2=nothing%>
</select>
</td>
</tr>
<%
sql="select * from Gq_article order by id DESC"
set rs=server.createobject("adodb.recordset")
if request.querystring("cat_id")<>"" then
sql="select * from Gq_article where cat_id="&cint(request.querystring("cat_id"))&" order by id desc"
end if
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<tr align=""center""><td class=tablerow1 colspan=""7"">当前没有任何文章!</td></tr>"
else
rs.pagesize=cint(adminpage)
i=1
mypage=request("page")
if mypage="" then
mypage=1
else
mypage=cint(mypage)
end if
pages=rs.pagecount
rs.absolutepage=mypage
do while not rs.eof
sql="select cat_id,cat_name from Gq_newsclass where cat_id="&rs("cat_id")
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
%>
<tr>
<td class=tablerow1 align="center"><input name='SoftID' type='checkbox' onclick="unselectall()" id="SoftID" value='<%=rs("id")%>'></td>
<td class=tablerow1>[<%=rscat("cat_name")%>] <a href="/showarticle.asp?cat_id=<%=rs("cat_id")%>&id=<%=rs("id")%>" target="_blank"><%=left(rs("art_title"),25)%>...</a></td>
<td class=tablerow1 align="center"><a href="admin_article.asp?id=<%=rs("id")%>&cat_id=<%=rs("cat_id")%>&action=editart">编辑</a> <a href="admin_article.asp?id=<%=rs("id")%>&cat_id=<%=rs("cat_id")%>&action=delart">删除</a></td>
<td class=tablerow1 align="center"><%if rs("isbest")=1 then response.write "<font color=red>√</font>" else response.write "×" end if%></td>
<td class=tablerow1 align="center">
<%if Rs("art_date")>=date() then
Response.Write "<FONT color=""#FF0000"">"&year(Rs("art_date"))&"-"&month(Rs("art_date"))&"-"&day(Rs("art_date"))&"</FONT >" & vbCrLf
else
Response.Write "<FONT color=""#999999"">"&year(Rs("art_date"))&"-"&month(Rs("art_date"))&"-"&day(Rs("art_date"))&"</FONT >" & vbCrLf
end if
%></td>
</tr>
<%
if i=rs.pagesize then exit do end if
i=i+1
rs.movenext
loop%>
<tr>
<td class=tablerow1 colspan="5">
<input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox"> 全选/反选
<input name="submit" type="submit" onClick="document.form.Action.value='Del'" value="批量删除">
<input name="Action" type="hidden" id="Action" value="Del">
<input name="tab" type="hidden" id="tab" value="Gq_article">
<input name="url" type="hidden" id="url" value="admin_article.asp?action=cat"></td>
</tr>
<tr>
<td class=tablerow1 colspan="5"><%call artpage%></td>
</tr>
</form>
</table>
<%end if%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -