📄 admin_newsdelete.asp
字号:
<!--#include file = "../inc/dbclass.inc.asp" -->
<!--#include file = "../inc/syslogincheck.inc.asp" -->
<%
' =============================================================
' made by xiasp & 智多网络 http://www.cq18.com/ qq群:12403617
' =============================================================
%>
<%
call header("删除信息")
call content()
call footer()
' 本页内容区
sub content()
' 取参数:新闻id
dim stridlist,arridlist,iid,i,action,h_level
h_level = session("sys_level")
if h_level > 1 then
stridlist = getsafestr(trim(request.form("newsid")))
action = getsafestr(trim(request.form("action")))
select case action
case "del"
if not isempty(stridlist) then
arridlist = split(stridlist,",")
for i = 0 to ubound(arridlist)
iid = clng(arridlist(i))
call delnews(iid)
next
call oktowhere("信息删除成功,确认返回!","-1")
else
call oktowhere("请至少选择一条信息记录!","-1")
end if
case "check"
if not isempty(stridlist) then
arridlist = split(stridlist,",")
for i = 0 to ubound(arridlist)
iid = clng(arridlist(i))
oconn.execute("update newsdata set d_num = 1 where d_id="&iid&"")
next
call oktowhere("信息审核成功,确认返回!","-1")
else
call oktowhere("请至少选择一条信息记录!","-1")
end if
case "uncheck"
if not isempty(stridlist) then
arridlist = split(stridlist,",")
for i = 0 to ubound(arridlist)
iid = clng(arridlist(i))
oconn.execute("update newsdata set d_num = 0 where d_id="&iid&"")
next
call oktowhere("信息撤销成功,确认返回!","-1")
else
call oktowhere("请至少选择一条信息记录!","-1")
end if
end select
else
call oktowhere("您的权限不足以进行次操作!","-1")
end if
end sub
sub delnews(idstr)
' 从新闻数据表中取出相关的上传文件
' 上传后保存到本地服务器的路径文件名,多个以"|"分隔
' 删除文件,要取带路径的文件名才可以,并且只要这个就可以了,原来存的原文件名或不带路径的保存文件名可用于其它地方使用
dim ssavepathfilename
ssql = "select d_savepathfilename from newsdata where d_id=" & idstr
ors.open ssql, oconn, 0, 1
if not ors.eof then
ssavepathfilename = ors("d_savepathfilename")
else
goerror "无效的新闻id,请点页面上的链接进行操作!"
end if
ors.close
' 把带"|"的字符串转为数组
dim asavepathfilename
asavepathfilename = split(ssavepathfilename, "|")
' 删除新闻相关的文件,从文件夹中
dim j
for j = 0 to ubound(asavepathfilename)
' 按路径文件名删除文件
call dodelfile(asavepathfilename(j))
next
' 删除新闻
ssql = "delete from newsdata where d_id=" & idstr
oconn.execute ssql
end sub
' 删除指定的文件
sub dodelfile(spathfile)
on error resume next
dim ofso
set ofso = server.createobject("scripting.filesystemobject")
ofso.deletefile(server.mappath(spathfile))
set ofso = nothing
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -