<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="CheckAdmin.asp"-->
<!--#include file=../ads/Html2Js.asp-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'微信公众号 ip126com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<%Server.ScriptTimeOut = 1000
conn.commandtimeout=10000
if Instr(session("AdminPurview"),"|51,")=0 then 
  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
  response.end
end if
'========判断是否具有管理权限
%>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="Images/Admin.css">
<script language="javascript" src="../Script/Admin.js"></script>
<style type="text/css">
<!--
.STYLE1 {color: #2f2f2f}
.STYLE2 {color: #FF0000}
-->
</style>
<TITLE>删除垃圾图片</TITLE>
<%Dim key
key=Request("key")
If key="" then%>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <th>清理无用上传图片与生成文件</th>
  </tr>
  <tr>
    <td height="24" align="center" nowrap="nowrap"  class="forumrow">：注意：以下操作将检查硬盘相关目录文件与数据库比对是否关联存在，不相关的全部删除，若有其它图片需要的请先备份。文件多时非常占用空间资源，谨慎使用！时间取决于文件多少，稍等即是......</td>
  </tr>
</table>
<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <TR>
    <TD height="20" align="center" class="forumrow"><FONT color="#FFFFFF" style="font-size:14px">清 理 无 用 上 传 图 片 与 生 成 文 件</FONT></TD>
  </TR>
  <TR>
    <TD bgcolor="#FFFFFF">
	<A href="?key=about" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;一、一键删除关于我们无用图片</a><p>
	<A href="?key=news" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;二、一键删除新闻资讯无用图片</a><p>
	<A href="?key=product" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;三、一键删除产品无用图片</a><p>
	<A href="?key=download" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;四、一键删除资源下载无用图片文件</a><p>
	<A href="?key=services" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;五、一键删除服务资源无用图片文件</a><p>  	
	<A href="?key=link" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;六、一键删除友情链接无用图片</a><p>	
    <A href="?key=adjs" onClick="return confirm('确定要删除无用JS文件吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;七、一键删除天天广告无用JS文件</a><p>
	<A href="?key=hd" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;八、一键删除幻灯广告无用图片</a><p>
	<A href="?key=flv" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;九、一键删除FLV广告无用图片</a><p>
	<A href="?key=adfp" onClick="return confirm('确定要删除无用图片吗？\n\n该操作不可恢复！')">&nbsp;&nbsp;&nbsp;&nbsp;十、一键删除翻牌广告无用图片</a><p>
	</TD>
  </TR>
</TABLE>
<%End If
If key<>"" then%>
 <TABLE width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#799AE1">
  <TR>
    <TD height="20" align="center" bgcolor="#799AE1"><FONT color="#FFFFFF" style="font-size:14px">被 删 除 图 片 文 件</FONT></TD>
  </TR>
  <TR>
    <TD bgcolor="#FFFFFF">
      <TABLE width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D6DFF7">
<%
Dim strSql,currentPath,Fles,Item,FlesName,s,tname,iTemp  
Dim Fso  
Set Fso = Server.CreateObject("Scripting.FileSystemObject")  
Dim Fol
If key="about" Then tname="关于我们"
If key="news" Then tname="新闻资讯"
If key="product" Then tname="产品"
If key="download" Then tname="资源下载"
If key="services" Then tname="服务资源"
If key="link" Then tname="友情链接"
If key="adjs" Then tname="天天标准代码方式广告"
If key="hd" Then tname="幻灯广告"
If key="flv" Then tname="FLV广告"
if key="adfp" Then tname="翻牌广告"


'＝＝＝＝＝＝＝＝＝＝＝＝mf设置＝＝＝＝＝＝＝＝＝
If key="about" Then currentPath = Server.MapPath("..\UploadFiles\about")
If key="news" Then currentPath = Server.MapPath("..\UploadFiles\news")
If key="product" Then currentPath = Server.MapPath("..\UploadFiles\product")
If key="download" Then currentPath = Server.MapPath("..\UploadFiles\download")
If key="services" Then currentPath = Server.MapPath("..\UploadFiles\services")
If key="link" Then currentPath = Server.MapPath("..\UploadFiles\link")
If key="adjs" Then currentPath = Server.MapPath("..\ads\js")
If key="hd" Then currentPath = Server.MapPath("..\UploadFiles\hd")
If key="flv" Then currentPath = Server.MapPath("..\UploadFiles\flv")
If key="adfp" Then currentPath = Server.MapPath("..\UploadFiles\adfp")

iTemp=0
If Fso.FolderExists(currentPath) Then
Set RS = Server.CreateObject("ADODB.RecordSet") 
Set Fol=Fso.GetFolder(currentPath)  
Set Fles=Fol.Files 
s=0

Dim rs2,data,Sql
set rs=server.createobject("adodb.recordset")
For Each Item In Fles

If key="about" Then strSql = "Select * from TianTianCMS_About where ContentCH like '%" & Item.Name & "%' or ContentEN like '%" & Item.Name & "%'"
If key="news" Then strSql = "Select * from TianTianCMS_Article where ContentCH like '%" & Item.Name & "%' or ContentEN like '%" & Item.Name & "%'"
If key="product" Then strSql = "Select * from TianTianCMS_Products where SmallPic like '%" & Item.Name & "%' or BigPic like '%" & Item.Name & "%' or ContentCH like '%" & Item.Name & "%' or ContentEN like '%" & Item.Name & "%'"
If key="download" Then strSql = "Select * from TianTianCMS_Download where FileUrl like '%" & Item.Name & "%' or ContentCH like '%" & Item.Name & "%' or ContentEN like '%" & Item.Name & "%'"
If key="services" Then strSql = "Select * from TianTianCMS_Services where ContentCH like '%" & Item.Name & "%' or ContentEN like '%" & Item.Name & "%'"
If key="link" Then strSql = "Select * from TianTianCMS_FriendLink where LinkFaceCH='"&SysRootDir&"UploadFiles/link/" & Item.Name & "' or LinkFaceEN='"&SysRootDir&"UploadFiles/link/" & Item.Name & "'"
If key="adjs" Then strSql = "Select * from TianTianCMS_ad where adsjs='" & Item.Name & "'"
If key="hd" Then strSql = "Select * from TianTianCMS_Slide where pic1CH='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic1EN='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic2CH='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic2EN='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic3CH='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic3EN='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic4CH='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic4EN='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic5CH='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "' or pic5EN='"&SysRootDir&"UploadFiles/hd/" & Item.Name & "'"
If key="flv" Then strSql = "Select * from TianTianCMS_Slide where flv like '%"& Item.Name & "%'"
If key="adfp" Then strSql = "Select * from TianTianCMS_adfp where imgurl like '%"& Item.Name & "%'" 

RS.Open strSql,conn
FlesName=Item.Name
If RS.EOF Then
If Left(FlesName,4)<>"hdCh" and Left(FlesName,4)<>"hdEn" And FlesName<>"sinaflash.js" and FlesName<>"sinaflashfp.js" then
Fso.DeleteFile currentPath & "\" & Item.Name
s=s+1
Response.Write "<TR align=""center"" bgcolor=""#FFFFFF"" height=""26"">"
Response.Write "<TD width=""20%"">已删除"&tname&"无用图片文件名称</TD>"
Response.Write "<TD width=""20%"">"&FlesName&"</TD></TR>"
End If
End if
RS.Close
Next
Set RS = nothing 
Else  
Response.Write "目录不存在。"  
Response.End  
End If
set fso=Nothing
Call CloseDB
'＝＝＝＝＝＝＝＝＝＝＝＝mf设置END＝＝＝＝＝＝＝＝＝%>

     </TABLE>
    <BR>&nbsp;&nbsp;共删除<%=s%>个<%=tname%>无用的图片或文件 <p align='center'><a href='delpic.asp'>【返回】</a></p></TD>
  </TR>
</TABLE>
<%End If%>