<!--#include file="../inc/checklogin.asp"-->
<!--#include file="../../inc/conn.asp"-->
<!--#include file="../../../inc/charfunction.asp"-->
<%
	action=chkstr(request("action_news"))
	userid=chkstr(request("newsid"))
	on error resume next
	if len(userid)=0 then
		response.Write"<script language='javascript'>alert('请选择要操作的对象！');history.back();</script>"
		response.End()
	end if
	
	if action="del" then
		call user_del()
	elseif action="check" then
		call user_check()
	elseif action="open" then
		call nolock()
	elseif action="close" then
		call yeslock()
	end if
	call closeconn()
	response.Redirect request.ServerVariables("HTTP_REFERER")
	
	sub user_del()
		set fso=server.CreateObject("scripting.filesystemobject")
		set rs=server.CreateObject("adodb.recordset")
		if instr(userid,",") then
			userid=replace(userid," ","")
			arrid=split(userid,",")
			for i=0 to ubound(arrid)
				sql="select newsimage from web_news where id="&arrid(i)
				rs.open sql,conn,1,3
				if not rs.eof then
					newsimage=rs("newsimage")
				end if
				filepath=server.MapPath("../upload/"&newsimage)
				if fso.FileExists(filepath) then
					fso.DeleteFile(filepath)
				end if	
				rs.delete
				rs.close
			next
		else
			sql="select newsimage from web_news where id="&userid
			rs.open sql,conn,1,3
			if not rs.eof then
				newsimage=rs("newsimage")
			end if
			filepath=server.MapPath("../upload/"&newsimage)
			if fso.FileExists(filepath) then
				Fso.DeleteFile(filepath)
			end if
			rs.delete
			rs.close
		end if
		set fso=nothing
		set rs=nothing
	end sub
	
	sub user_check()
		if instr(userid,",") then
			userid=replace(userid," ","")
			sql="update web_news set ispassed=1 where id in("&userid&")"
		else
			sql="update web_news set ispassed=1 where id="&userid
		end if
		conn.execute sql
	end sub
	
	sub nolock()
		sql="update web_news set topinfo=0 where id="&userid
		conn.execute sql
	end sub
	
	sub yeslock()
		sql="update web_news set topinfo=1 where id="&userid
		conn.execute sql
	end sub
%>