<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'微信公众号 ip126com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<%
dim Result,Selectid
Dim ix,tempx,selectx,len_idx
Result=request.QueryString("Result")
SelectID=request.Form("SelectID")

select case Result
  case "Administrators"
    select case Trim(Request.Form("batch"))
	case "批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Admin set Working = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Admin set Working = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" then  conn.execute "delete from TianTianCMS_Admin where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
	End Select
  case "LoginLog"
    if SelectID<>"" then  conn.execute "delete from TianTianCMS_AdminLog where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
  case "MemGroup"
    if SelectID<>"" then  conn.execute "delete from TianTianCMS_MemGroup where GroupID in ('"&SelectID&"')"
	conn.execute "Update TianTianCMS_About set GroupID='2011721738397008' , Exclusive='>=' where GroupID = '"&SelectID&"'"
	conn.execute "Update TianTianCMS_Download set GroupID='2011721738397008' , Exclusive='>=' where GroupID = '"&SelectID&"'"
	conn.execute "Update TianTianCMS_Members set GroupID='2011721738397008' , GroupName='临时游客' where GroupID = '"&SelectID&"'"
	conn.execute "Update TianTianCMS_Article set GroupID='2011721738397008' , Exclusive='>=' where GroupID = '"&SelectID&"'"
	conn.execute "Update TianTianCMS_Services set GroupID='2011721738397008' , Exclusive='>=' where GroupID = '"&SelectID&"'"
	conn.execute "Update TianTianCMS_Products set GroupID='2011721738397008' , Exclusive='>=' where GroupID = '"&SelectID&"'"
    response.redirect request.servervariables("http_referer")
  case "Members"
    select case Trim(Request.Form("batch"))
	case "批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Members set Working = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Members set Working = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Members where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
	End Select

  case "About"'关于我们
	select case Trim(Request.Form("batch"))
	case "批量修改排序"
	Abo_id=request("Abo_id")
	Sequence=request("Sequence")
	arr_id=Split(Replace(Abo_id," ",""),",")
	arr_Sequence=Split(Replace(Sequence," ",""),",")
	For i = 0 To UBound(arr_id)
	conn.execute("update TianTianCMS_About set Sequence='"&arr_Sequence(i)&"' where id="&arr_id(i)&"")
	Next
	response.redirect request.servervariables("http_referer")
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_About set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_About set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_About set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_About set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_About where id in ("&SelectID&")"
If ISHTML = 1 Then
SelectID=replace(SelectID," ","")
str=split(SelectID,",")
for i=0 to ubound(str)
Call DoDelslhtml("ch/html/"&AboutName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Call DoDelslhtml("en/html/"&AboutName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Next
	End If
    response.redirect request.servervariables("http_referer")
	End Select

  case "Products"'企业产品
    select case Trim(Request.Form("batch"))
	case "批量修改产品参数"
	pro_id=request("pro_id")
	ProductNo=request("ProductNo")
	ProductName=request("ProductName")
	N_Price=request("N_Price")
	P_Price=request("P_Price")
	ProductModel=request("ProductModel")
	Stock=request("Stock")
	arr_id=Split(Replace(pro_id," ",""),",")
	arr_ProductNo=Split(Replace(ProductNo," ",""),",")
	arr_ProductName=Split(Replace(ProductName," ",""),",")
	arr_N_Price=Split(Replace(N_Price," ",""),",")
	arr_P_Price=Split(Replace(P_Price," ",""),",")
	arr_ProductModel=Split(Replace(ProductModel," ",""),",")
	arr_Stock=Split(Replace(Stock," ",""),",")
	For i = 0 To UBound(arr_id)
	conn.execute("update TianTianCMS_Products set ProductNo='"&arr_ProductNo(i)&"' where id="&arr_id(i)&"")
	conn.execute("update TianTianCMS_Products set ProductName='"&arr_ProductName(i)&"' where id="&arr_id(i)&"")
	conn.execute("update TianTianCMS_Products set N_Price="&arr_N_Price(i)&" where id="&arr_id(i)&"")
	conn.execute("update TianTianCMS_Products set P_Price="&arr_P_Price(i)&" where id="&arr_id(i)&"")
	conn.execute("update TianTianCMS_Products set ProductModel='"&arr_ProductModel(i)&"' where id="&arr_id(i)&"")
	conn.execute("update TianTianCMS_Products set Stock="&arr_Stock(i)&" where id="&arr_id(i)&"")
	Next
	response.redirect request.servervariables("http_referer")
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Products set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Products set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Products set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Products set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
case "删除所选"
'================删除相关大小图片
		ix=0
		SelectIDP=replace(SelectID," ","")'过滤空格
		len_idx=len(SelectIDP)'计算字符数
		tempx=tempx&left(SelectIDP,1)'截第一个
		Do While ix<len_idx
			ix=ix+1
			tempx=left(SelectIDP,1)
			If tempx="," Then
			Call DoDelslhtml(""&conn.Execute("Select BigPic From TianTianCMS_Products Where id="&CInt(selectx)&"")(0)&"")'删除相关大图片
	        Call DoDelslhtml(""&conn.Execute("Select SmallPic From TianTianCMS_Products Where id="&CInt(selectx)&"")(0)&"")'删除相关小图片				
				selectx=""
			Else
				selectx=selectx&tempx
			End If
			if len_idx-ix=0 Then
			Call DoDelslhtml(""&conn.Execute("Select BigPic From TianTianCMS_Products Where id="&CInt(selectx)&"")(0)&"")'删除相关大图片
	        Call DoDelslhtml(""&conn.Execute("Select SmallPic From TianTianCMS_Products Where id="&CInt(selectx)&"")(0)&"")'删除相关小图片			
			End if
			SelectIDP=right(SelectIDP,len_idx-ix)
		Loop
'=================删除相关大小图片END
	
if SelectID<>"" Then conn.execute "delete from TianTianCMS_Products where id in ("&SelectID&")"'删除产品标题

If ISHTML = 1 Then
SelectID=replace(SelectID," ","")
str=split(SelectID,",")
for i=0 to ubound(str)
Call DoDelslhtml("ch/html/"&ProName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Call DoDelslhtml("en/html/"&ProName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Next
End If
    response.redirect request.servervariables("http_referer")
End Select

  case "News"'新闻
    select case Trim(Request.Form("batch"))
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Article set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Article set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Article set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Article set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Article where id in ("&SelectID&")"
If ISHTML = 1 Then
SelectID=replace(SelectID," ","")
str=split(SelectID,",")
for i=0 to ubound(str)
Call DoDelslhtml("ch/html/"&NewName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Call DoDelslhtml("en/html/"&NewName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Next
End If
    response.redirect request.servervariables("http_referer")
	End Select

  case "Download"'下载资源
    select case Trim(Request.Form("batch"))
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Download set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Download set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Download set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Download set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Download where id in ("&SelectID&")"
If ISHTML = 1 Then
SelectID=replace(SelectID," ","")
str=split(SelectID,",")
for i=0 to ubound(str)
Call DoDelslhtml("ch/html/"&DownName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Call DoDelslhtml("en/html/"&DownName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Next
End If
    response.redirect request.servervariables("http_referer")
	End Select

  case "video"'视频
    select case Trim(Request.Form("batch"))
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_video set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_video set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_video set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_video set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_video where id in ("&SelectID&")"
If ISHTML = 1 Then
SelectID=replace(SelectID," ","")
str=split(SelectID,",")
for i=0 to ubound(str)
Call DoDelslhtml("ch/html/"&videoName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Call DoDelslhtml("en/html/"&videoName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Next
End If
    response.redirect request.servervariables("http_referer")
	End Select

  case "Jobs"'企业招聘
    select case Trim(Request.Form("batch"))
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Recruitment set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Recruitment set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Recruitment set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Recruitment set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Recruitment where id in ("&SelectID&")"
If ISHTML = 1 Then
SelectID=replace(SelectID," ","")
str=split(SelectID,",")
for i=0 to ubound(str)
Call DoDelslhtml("ch/html/"&JobName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Call DoDelslhtml("en/html/"&JobName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Next
End If
    response.redirect request.servervariables("http_referer")
	End Select
  case "Message"
    select case Trim(Request.Form("batch"))
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Message set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Message set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Message set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Message set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Message where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
	End Select
  case "Order"'删除订单
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Order where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")

  case "purse"'会员财务流水
    select case Trim(Request.Form("batch"))
	case "批量通过审核"
	if SelectID<>"" Then conn.execute "update TianTianCMS_financiallog set audit = "&DN_True&" where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "批量取消审核"
	if SelectID<>"" Then conn.execute "update TianTianCMS_financiallog set audit = "&DN_False&" where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_financiallog where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
	End Select

  case "Talents"'删除应聘
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Talents where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")

  case "Navigation"'企业公告
    select case Trim(Request.Form("batch"))
	case "批量修改排序"
	Nav_id=request("Nav_id")
	Sequence=request("Sequence")
	arr_id=Split(Replace(Nav_id," ",""),",")
	arr_Sequence=Split(Replace(Sequence," ",""),",")
	For i = 0 To UBound(arr_id)
	conn.execute("update TianTianCMS_Navigation set Sequence='"&arr_Sequence(i)&"' where id="&arr_id(i)&"")
	Next
	response.redirect request.servervariables("http_referer")
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Navigation set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Navigation set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Navigation set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Navigation set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Navigation where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
	End Select

  case "FriendLink"'友情链接
    select case Trim(Request.Form("batch"))
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_FriendLink set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_FriendLink set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_FriendLink set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_FriendLink set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_FriendLink where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
	End Select

  case "Others"'服务信息
    select case Trim(Request.Form("batch"))
	case "中文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Services set ViewFlagCH = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Services set ViewFlagEN = 1 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "中文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Services set ViewFlagCH = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "英文批量不显示"
	if SelectID<>"" Then conn.execute "update TianTianCMS_Services set ViewFlagEN = 0 where id in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" Then conn.execute "delete from TianTianCMS_Services where id in ("&SelectID&")"
If ISHTML = 1 Then
SelectID=replace(SelectID," ","")
str=split(SelectID,",")
for i=0 to ubound(str)
Call DoDelslhtml("ch/html/"&OtherName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Call DoDelslhtml("en/html/"&OtherName&""&Separated&""&cstr(str(i))&"."&HTMLName&"")
Next
End If
    response.redirect request.servervariables("http_referer")
	End Select
	
	case "ADs"'广告
    if SelectID<>"" then  
		'调用删除广告中相关文件	代码开始
	if instr(SelectID,",")>0 then
		idArr=split(SelectID)
		for i = 0 to ubound(idArr)
			call DelArticlepic(clng(idarr(i)))
		next
	else
		call DelArticlepic(clng(SelectID))
	end if
	'调用删除广告中相关文件	代码结束
	conn.execute "delete from TianTianCMS_ADs where id in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
	end if
	
 case "NoHackSql"
    select case Trim(Request.Form("batch"))
	case "批量锁定"
	if SelectID<>"" Then conn.execute "update TianTianCMS_sqlin set Kill_ip="&DN_True&" where SqlIn_ID in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "批量解锁"
	if SelectID<>"" Then conn.execute "update TianTianCMS_sqlin set Kill_ip="&DN_False&" where SqlIn_ID in ("&SelectID&")"
	response.redirect request.servervariables("http_referer")
	case "删除所选"
    if SelectID<>"" then  conn.execute "delete from TianTianCMS_sqlin where SqlIn_ID in ("&SelectID&")"
    response.redirect request.servervariables("http_referer")
	End Select
  case else
end select

sub DelArticlepic(SelectID)
	   dim rs,sql,fso,strUploadFiles,arrUploadFiles,i
       Set rs= Server.CreateObject("ADODB.Recordset")
       sql= "select * from TianTianCMS_"&Result&" where id in ("&SelectID&")"
       rs.open sql,conn,1,3
	   strUploadFiles=rs("UploadFiles")
			if strUploadFiles<>"" then
				Set fso = CreateObject("Scripting.FileSystemObject")
				if instr(strUploadFiles,"|")>1 then
					arrUploadFiles=split(strUploadFiles,"|")
					for i=0 to ubound(arrUploadFiles)
						if fso.FileExists(server.MapPath("" & arrUploadfiles(i))) then
							fso.DeleteFile(server.MapPath("" & arrUploadfiles(i)))
						end if
					next
				else
					if fso.FileExists(server.MapPath("" & strUploadfiles)) then
						fso.DeleteFile(server.MapPath("" & strUploadfiles))
					end if
				end if
				Set fso = nothing
			end if
end sub
%>