<%
 data_path="../" 'ACC连接数据库路径，对SQL无效 
  numid="06"
 dir="err.asp"
%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/safe.asp"-->
<!--#include file="../admin/log/add_admin_log.asp"-->
   <%
if issession=0 then
%>
<!--#include file="inc.asp"-->

<%
	If boollogin=false then
              Response.write "<script language='javascript'>"
              Response.write"alert('对不起！请重新登陆！');parent.location.href='"&HOPE_InstallDir&"';</SCRIPT>" 
              Response.End
   End If
  else
	  if session("globalecmaster")="" and  session("masterflag")="" then
              Response.write "<script language='javascript'>"
              Response.write"alert('对不起！请重新登陆！');parent.location.href='"&HOPE_InstallDir&"';</SCRIPT>" 
              Response.End
   End If
  if   session("masterflag")<>"" then 
   '权限验证--------------------------------------------
  if numid<>"no" then 
  	'权限限制^^^^^^^^^^^^^^^^^^^^
	 dim ishavegantadmin
	 ishavegantadmin=false
	 in_str=split(session("masterflag"),",")
	 for each ins in in_str 
	 if trim(ins)=numid  then 
	 ishavegantadmin=true 
	 end if
	 next 
	 if ishavegantadmin=false then 
	 if dir<>"no" then 
	 response.redirect dir
	 response.end
	 end if
	 end if
  end if
   '--------------------------------------------------
 end if
 
 end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>COAD System</title>
<SCRIPT LANGUAGE="JavaScript">
function delad(){
if (confirm("确定要删除这则广告么?删除后不可以再恢复哦!?")){return true;}
return false;
}
</SCRIPT>
<link href="COAD.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<body>
<table width="98%" height="31" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#7EC1FE" bgcolor="#DEEEFE" class="border">
  <tr>
    <td width="445"><form name="formss" method="post" action="list.asp" style="margin:0">
      &nbsp;<select name="modid" size="1" id="modid">
	   <option value="">所有模版</option>
      <%
		  set rst1=server.CreateObject("adodb.recordset")
		  rst1.open "select yx_tempname,id from [yixiang_worldec_Temp] order by yx_selected desc,id desc",conn,1,1
		  Do While not rst1.eof
		  	if cstr(rst1("id"))=request("modid") then
		  		Response.Write "<option value="&rst1("id")&" selected>"&rst1("yx_tempname")&"</option>"
			else
				Response.Write "<option value="&rst1("id")&">"&rst1("yx_tempname")&"</option>"
			end if
		  	rst1.movenext
		  Loop
		  rst1.close
		  set rst1=nothing
		  %>
    </select>
      <label>
      <select name="pagename" id="pagename">
	  <option value="">所有页面</option>
        <option value="网站首页" <%if request("pagename")="网站首页" then response.write "selected"%>>网站首页</option>
        <option value="我要采购" <%if request("pagename")="我要采购" then response.write "selected"%>>找资金</option>
        <option value="我要销售" <%if request("pagename")="我要销售" then response.write "selected"%>>找项目</option>
        <option value="公司库" <%if request("pagename")="公司库" then response.write "selected"%>>公司库</option>
        <option value="产品库" <%if request("pagename")="产品库" then response.write "selected"%>>产品库</option>
        <option value="展会服务" <%if request("pagename")="展会服务" then response.write "selected"%>>展会服务</option>
        <option value="人才招聘" <%if request("pagename")="人才招聘" then response.write "selected"%>>人才招聘</option>
     <option value="商业资讯" <%if request("pagename")="商业资讯" then response.write "selected"%>>商业资讯</option> </select>
      </label>
      
        <label>
          <input name="isstop" type="checkbox" value="stop" <% if request("isstop")="stop" then response.write "checked"%>>
          过期&nbsp;
        <input type="submit" name="Submit" value="查 询">
        </label>
      </form>
    </td>
     <td width="275" align="center"><a href="list.asp">广告管理</a>&nbsp;&nbsp;<a href="add.asp">添加广告</a>&nbsp;&nbsp;<a href="code.asp">调用说明</a></td>
  </tr>
</table>

<%
Dim pagesize,rs,sql,curpage,strcate,i
Dim id,ADID,ADViews,ADHits,ADType,ADSrc,ADLink,ADAlt,ADWidth,ADHeight,ADNote,ADStopViews,ADStopHits,ADStopDate

pagesize=10		'设置每页显示广告树目

If Request.QueryString("page")="" Then
  	curpage = 1
Else
	curpage = cint(Request.QueryString("page"))
End If

Set rs = Server.CreateObject("ADODB.Recordset")
dim adnote_a
adnote_a=request("adnote_a")
sql="SELECT * FROM [yixiang_ad] Where id>0 "
if Request("isstop")="stop" then
	if Database_type=1 then 
	sql = sql & " and (ADStopDate<'"&date()&"' or (ADStopViews<>0 and ADViews>ADStopViews) or (ADStopHits<>0 and ADHits>ADStopHits)) "
	else
	sql = sql & " and (ADStopDate<date() or (ADStopViews<>0 and ADViews>ADStopViews) or (ADStopHits<>0 and ADHits>ADStopHits)) "
	end if
end if
if request("modid")<>"" then sql=sql&" and which_mod="&request("modid")
if request("pagename")<>"" then sql=sql&" and which_page='"&request("pagename")&"'"
sql=sql&" ORDER BY id DESC"
'response.write sql
'response.end
rs.open sql, conn, 1, 1

'监测是否存在错误
If err.number <> 0 Then
	Response.Write err.description
	Response.End
End If

If rs.bof or rs.eof Then
	rs.Close
	if Request.QueryString("action")="stop" Then
	%><br>
	<table width="98%" height="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="DDDDDD">
  <tr>
    <td align="center" bgcolor="f1f1f1"><font color="#990000">暂时没有过期广告！</font></td>
  </tr>
</table>
	<br>
	<%Else%><br>
	<table width="98%" height="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="DDDDDD">
  <tr>
    <td align="center" bgcolor="f1f1f1">暂时没有任何广告！-- <a href=add.asp>立即添加新广告</a></td>
  </tr>
</table>
	<br>
	<%
	End If
	Response.End
End If

rs.pagesize = pagesize
rs.absolutepage = curpage
%>
 <table width='98%' height="22" border=0 align=center cellpadding=0 cellspacing=0 bgcolor="#999999">
<tr>
  <td width="60" height="24" align="center" bgcolor="#7EC1FE"><a href="?page=<%=cstr(curpage)%>&pagesize=<%=pagesize%>&adnote_a=<%=adnote_a%>">[刷新]</a></td>
  <td width="700" height="22" align=right bgcolor="#7EC1FE">
      
      <%If curpage = 1 Then%>
      　    [首页] [上一页]                              
      <%Else%>
      [<a href='?page=1'>首页</a>] [<a href='?page=<%=cstr(curpage-1)%>'>上一页</a>]                              
      <%End If
      If  curpage = rs.pagecount Then%>
      [下一页] [尾页]                              
      <%Else%>
      [<a href='?page=<%=cstr(curpage+1)%>'>下一页</a>] [<a href='?page=<%=cstr(rs.pagecount)%>'>尾页</a>]&nbsp;                    
    <%End If%>  </td>
</tr>
</table>
      <table width='98%' border="0" align=center cellpadding=3 cellspacing=1 bgcolor="#CEE0FF">
        <% Do While NOT rs.eof 
		id=rs("id")
		ADID=rs("ADID")
		ADViews=rs("ADViews")
		ADHits=rs("ADHits")
		ADType=rs("ADType")
		ADSrc=rs("ADSrc")
		ADLink=rs("ADLink")
		ADAlt=rs("ADAlt")
		ADSrc=rs("ADSrc")
		ADWidth=rs("ADWidth")
		ADHeight=rs("ADHeight")
		ADNote=rs("ADNote") 
		ADStopViews=rs("ADStopViews")
		ADStopHits=rs("ADStopHits")
		ADStopDate=rs("ADStopDate")%>
        <tr bgcolor="#c0c0c0"> 
          <td width="25%" height="25" bgcolor="#DEEEFE">名称：<%=ADID%> <%if IsStop(ADViews,ADStopViews,ADStopHits,ADHits,ADStopDate) Then Response.Write(" <font color=red>(已过期)") End If%></td>
          <td width="27%" bgcolor="#DEEEFE"><%
		  
		  
		  set rstemp=server.CreateObject("adodb.recordset")
		  YXsql="select yx_tempname,id from [yixiang_worldec_Temp] where id="&rs("which_mod")
		  rstemp.open YXsql,conn,1,1
		  if not rstemp.eof then
		  
		  Response.write "<a href=?modid="&rs("which_mod")&"><b>"&rstemp("yx_tempname")&"</b></a>-<a href=?modid="&rs("which_mod")&"&pagename="&rs("which_page")&">"&rs("which_page")&"</a>"
           set rstemp=nothing
		  end if%>
		  
		  
		  </td>
          <td width="18%" bgcolor="#DEEEFE">点击：<%=ADHits%></td>
          <td width="30%" bgcolor="#DEEEFE">管理：<a href="edit.asp?id=<%=id%>&page=<%=cstr(curpage)%>&adnote_a=<%=adnote_a%>">编辑</a>&nbsp;&nbsp;<a href="createjs.asp?id=<%=ADID%>">生成JS</a>&nbsp;&nbsp;<a href="del.asp?id=<%=id%>&LogName=17" onclick='return delad();'>删除</a></td>
        </tr>
        <tr bgcolor="e6e6e6"> 
          <td height="25" colspan=2 bgcolor="#EEF7FF">广告类型：<%=ShowAdType(ADType,rs("ADSrc"))%></td>
          <td colspan=2 bgcolor="#EEF7FF">广告所显示(图片等)地址：
          <%If ADType<>6 Then%><a href=<%=ADSrc%> target=_blank><font color="#000000"><%=ADSrc%></a><%else%>不显示<%end if%></td>
        </tr>
        <tr bgcolor="e6e6e6"> 
          <td height="25" colspan=2 bgcolor="#EEF7FF">链接地址：<a href=<%=ADLink%> target=_blank><font color="#000000"><%=ADLink%></a></td>
          <td colspan=2 bgcolor="#EEF7FF">提示文字：<%=ADAlt%></td>
        </tr>
        <tr bgcolor="e6e6e6"> 
          <td colspan=2 height="25" bgcolor="#EEF7FF">广告规格：<%=ADWidth%>×<%=ADHeight%></td>
          <td colspan=2 bgcolor="#EEF7FF">备    注：<%=ADNote%></td>                         
        </tr>
		<%
		if right(weburl,1)<>"/" then weburl=weburl&"/"
		'weburl2=left(weburl,len(weburl)-1)&HOPE_InstallDir
		%>
		<tr>
		  <td colspan=4 bgcolor="#FFFFFF"><span class="STYLE1">&nbsp;本条广告调用代码:<br>&nbsp;纯JS文件代码(需生成JS代码才生效!)：<font color="#0000FF"> &lt;script src=&quot;<%=HOPE_InstallDir%>ads/JS/<%=ADID%>.js&quot;&gt;&lt;/script&gt;</font>
		  <br>&nbsp;JS代码: <font color="#0000FF">&lt;script   src=&quot;<%=HOPE_InstallDir%>ads/ad.asp?adid=<%=ADID%>&quot;&gt;&lt;/script&gt;</font>
		  </span>
		  <br>
		  &nbsp;请将其中的蓝色代码任选其一复制到系统模板页中适当位置即可！
 		  &nbsp;<a href="code.asp">[参阅调用方法]</a></td>
		</tr>
		<tr><td  bgcolor="#666666"  colspan="4" height="1"></td>
        <% 
        i=i+1
		rs.movenext
		If i>=rs.PageSize Then Exit Do     
		Loop
		%>
        <tr align="center" bgcolor="c0c0c0"> 
          <td height="25" colspan=6 bgcolor="#DEEEFE"> <center>  第<%=cstr(curpage)%>页　总<%=cstr(rs.pagecount)%>页　本页<%=cstr(i-1)%>条　总<%=cstr(rs.recordcount)%>条          
      
            <%If curpage = 1 Then%>
　&nbsp;&nbsp;<span class="STYLE1"><%=ADID%></span>    [首页] [上一页]
<%Else%>
[<a href='?page=1'>首页</a>] [<a href='?page=<%=cstr(curpage-1)%>'>上一页</a>]
<%End If
      If  curpage = rs.pagecount Then%>
[下一页] [尾页]
<%Else%>
[<a href='?page=<%=cstr(curpage+1)%>'>下一页</a>] [<a href='?page=<%=cstr(rs.pagecount)%>'>尾页</a>]&nbsp;
<%End If%></td>
        </tr>
</table>
      <br>
      <p></p>
</body>
</html>
<%
rs.close
set rs=nothing
conn.Close
set conn=nothing

'检测是否过期
function IsStop(ADViews,ADStopViews,ADStopHits,ADHits,ADStopDate)
	IsStop=false
	If ( ADStopViews <> 0 and ADViews > ADStopViews) Then 
		IsStop=true
		Exit function
	ElseIf ( ADStopHits <> 0 and ADHits > ADStopHits) Then
		IsStop=true
		Exit function
	ElseIf ( DateDiff("d",Now(),ADStopDate)<1 ) Then	
		IsStop=true
		Exit function
	End If
end function

'判断广告类型
function ShowAdType(ADType,ADSrc)
	Dim ADExt
	ADExt="图片"
	If InStr(1,ADSrc,".swf",1)>0 Then ADExt="FLASH"
	Select Case ADType
		Case 1
			ShowAdType="普通"&ADExt
		Case 2
			ShowAdType="全屏浮动"&ADExt
		Case 3
			ShowAdType="上下浮动 - 右"&ADExt
		Case 4
			ShowAdType="上下浮动 - 左"&ADExt
		Case 5
			ShowAdType="渐隐消失"&ADExt
		Case 6
			ShowAdType="网页对话框"
		Case 7
			ShowAdType="移动透明对话框"
		Case 8
			ShowAdType="打开新窗口"
		Case 9
			ShowAdType="弹出新窗口"
		Case 10 
			ShowAdType="对联式广告"
		Case else
			ShowAdType="<font color=red><b>错误!将不能正确显示</b>"
	End Select
end function
%>