<%
 data_path="../" 'ACC连接数据库路径，对SQL无效 
  numid="no"
 dir="no"
%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/safe.asp"-->
<!--#include file="../inc/filesystem.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>
<link href="COAD.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript" src="images/js.js"></SCRIPT>
</head>

<body>
<table width="760" height="31" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="f1f1f1" class="border">
  <tr>
    <td width="445"><form name="formss" method="post" action="list.asp" style="margin:0">
      <select name="modid" size="1" id="modid">
        <option value="">所有模版</option>
        <%
		  set rst1=server.CreateObject("adodb.recordset")
		  rst1.open "select yx_tempname,id from [Websen_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="40" valign="bottom">&nbsp;</td>
    <td width="275"><a href="list.asp">广告管理</a>&nbsp;&nbsp;<a href="add.asp">添加广告</a>&nbsp;&nbsp;<a href="code.asp">调用说明</a></td>
  </tr>
</table>
<br>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F4FBFF">
  <tr>
    <td>
	<br>
	<%
	
	page=trim(request("page"))
	adnote_a=trim(request("adnote_a"))
	Function DangerEncode(fString)
If not isnull(fString) Then
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10), "")
	fString = replace(fString, "'", """")
    fString = Trim(fString)
    DangerEncode = fString
End If
End Function
On Error Resume Next
Dim rs,sql,id,rs1
If Request.QueryString("id")<> "" Then

id=DangerEncode(Request.QueryString("id"))
'打开/更新广告数据
oldpic=Replace_Text(request("oldpic"))
picture=DangerEncode(Request.Form("ADSrc"))
 Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from [Websen_ad] where id=" & id
rs.Open sql,conn,1,3
'是否更新
If Request.Form("ChangeAD") = "确 定" Then
	'rs("ADID")=DangerEncode(Request.Form("ADID"))
	rs("ADType")=DangerEncode(Request.Form("ADType"))
 	
	if Replace_Text(Request("cimg"))=1 then
   '删除新上传的而又不使用的图片^^^^^^^^^^^^^^^^^^ 
    if picture<>oldpic then
	if instr(picture,"nopicture.gif")<=0 then
   	 call FileDel(picture)
	 end if
 	end if
   '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   end if
  if Replace_Text(Request("cimg"))=2 then
 	rs("ADSrc")=picture
     '删除原有图片^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    if picture<>oldpic then
		if instr(oldpic,"nopicture.gif")<=0 then

   	 call FileDel(oldpic)
	 end if
  	end if
   '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  end if
	
	
	
	rs("ADdate")=TRIM(Request.Form("ADdate"))
	rs("ADMark")=TRIM(Request.Form("ADMark"))
	rs("ADHeight")=TRIM(Request.Form("ADHeight"))
	rs("ADWidth")=TRIM(Request.Form("ADWidth"))
	rs("ADLink")=DangerEncode(Request.Form("ADLink"))
	rs("ADAlt")=DangerEncode(Request.Form("ADAlt"))
	rs("ADStopViews")=TRIM(Request.Form("ADStopViews"))
	rs("ADStopHits")=TRIM(Request.Form("ADStopHits"))
	rs("ADStopDate")=TRIM(Request.Form("ADStopDate"))
	rs("ADNote")=DangerEncode(Request.Form("ADNote"))
	rs("which_mod")=TRIM(Request.Form("which_mod"))
	rs("which_page")=TRIM(Request.Form("which_page"))
	If Request.Form("ADRESET")="YES" Then
		rs("ADViews")=0
		rs("ADHits")=0
	End If
	rs.Update
	Response.Write "<script language=javascript>alert('更改成功');location.href='list.asp?page="&page&"&adnote_a="&adnote_a&"';</script>"
	response.end
End If
If Err <> 0 Then
			Response.Write "<font color=red size=2>错误:"&Err.Description
			Response.End
End If
%>
<br>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#BADFFE">
  <form name=form action=edit.asp?id=<%=id%>  method=post onsubmit="return chkinput()">
  <input type=hidden value=<%=page%> name="page">
  <input type=hidden value=<%=adnote_a%> name="adnote_a">
  <tr align="center" bgcolor="c0c0c0">
    <td colspan="2" bgcolor="#83B1FE">修 改 广 告</td>  
  </tr>
  <tr>
    <td width="95" height="25" align="right" bgcolor="#F4FBFF">广告 &nbsp;ID：</td>                                                          
    <td width="635" bgcolor="#F4FBFF"><INPUT name=ADID type="text" readonly value="<%=rs("ADID")%>" size=10 maxlength=20> 
    不能更改 </td>                                                         
  </tr>
  <tr>
    <td height="25" align="right" bgcolor="#F4FBFF">广告类型：</td>
    <td bgcolor="#F4FBFF"><select name="ADType" size="1" onChange="ChangeType(this.options[this.selectedIndex].value)">
  <option <%If rs("ADType")=1 Then Response.Write"selected"%> value="1">普通显示</option>
  <option <%If rs("ADType")=2 Then Response.Write"selected"%> value="2">满屏浮动显示</option>
  <option <%If rs("ADType")=3 Then Response.Write"selected"%> value="3">上下浮动显示 - 右</option>
  <option <%If rs("ADType")=4 Then Response.Write"selected"%> value="4">上下浮动显示 - 左</option>
  <option <%If rs("ADType")=5 Then Response.Write"selected"%> value="5">全屏幕渐隐消失</option>
  <option <%If rs("ADType")=6 Then Response.Write"selected"%> value="6">普通网页对话框 </option>
  <option <%If rs("ADType")=7 Then Response.Write"selected"%> value="7">可移动透明对话框 </option>
  <option <%If rs("ADType")=8 Then Response.Write"selected"%> value="8">打开新窗口</option>
  <option <%If rs("ADType")=9 Then Response.Write"selected"%> value="9">弹出新窗口</option>
  <option <%If rs("ADType")=10 Then Response.Write"selected"%> value="10">对联式广告</option>
</select></td>                                                         
  </tr>
  <tr>
          <td align="right" bgcolor="#F4FBFF" id="adsrc_text">所在模版：</td>
          <td height="17" bgcolor="#F4FBFF"> <select size="1" name="which_mod">
		  <%
		  set rst1=server.CreateObject("adodb.recordset")
		  rst1.open "select yx_tempname,id from [Websen_worldec_Temp] order by yx_selected desc,id desc",conn,1,1
		  Do While not rst1.eof
		  	if rs("which_mod")=rst1("id") 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="which_page" id="which_page">
         <option value="网站首页" <%if rs("which_page")="网站首页" then response.write "selected"%>>网站首页</option>
        <option value="我要采购" <%if rs("which_page")="我要采购" then response.write "selected"%>>我要采购</option>
        <option value="我要销售" <%if rs("which_page")="我要销售" then response.write "selected"%>>我要销售</option>
        <option value="公司库" <%if rs("which_page")="公司库" then response.write "selected"%>>公司库</option>
        <option value="产品库" <%if rs("which_page")="产品库" then response.write "selected"%>>产品库</option>
        <option value="展会服务" <%if rs("which_page")="展会服务" then response.write "selected"%>>展会服务</option>
        <option value="人才招聘" <%if rs("which_page")="人才招聘" then response.write "selected"%>>人才招聘</option>
	<option value="商业资讯" <%if rs("which_page")="商业资讯" then response.write "selected"%>>商业资讯</option>
            </select>
            </label>		  </td>
        </tr>
  <tr>
    <td height="25" align="right" bgcolor="#F4FBFF" id="adsrc_text">广告图片地址：</td>
	<td bgcolor="#F4FBFF">
	<%If rs("ADType")= 6 Then
    	Response.Write ("<textarea rows=3 name=ADSrc cols=27 class=input2>"&server.HTMLencode(rs("ADSrc"))&"</textarea>")
	else%>
	<INPUT name="ADSrc" type="text" value="<%=rs("ADSrc")%>" size=30>                                                      
	<%end if%>   
    *图片或FLASH地址&nbsp;
      <input type="checkbox" name="shang" value="1" onClick="shan()">
      <a href="javascript:;" onClick="shan()">我要上传</a>
	<%'if rs("adsrc")<>"" then%>  
	 <a href="<%=rs("adsrc")%>" target="_blank"> <img border="0" src="<%=rs("adsrc")%>" width="53" height="40"></a>
	 <%'end if%>
	  </td>   
  </tr>
  <FORM METHOD="POST" ACTION="LinkADD.asp" NAME="myform">
<script language="vbscript">
sub shan()
if ss.style.display="" then
ss.style.display="none"
else
ss.style.display=""
end if
end sub
</script>
  <tr id=ss style="display:none">
    <td height="25" align="right" bgcolor="#F4FBFF">上传广告：</td>
    <td bgcolor="#F4FBFF">
	
	
		<!----------------------------------------------------文件上传----------------------------------------------->
  <iframe id="d_file" frameborder="0" src="../inc/upload.asp?tMode=9&istwo=0&utype=ad" width="300" height="40" scrolling="no"></iframe>
  <!--------------------------------------------------------------------------->
	
	<input type="hidden" name="oldpic"  value="<%=rs("ADSrc")%>"  maxlength="50"><br><input type="radio" name="cimg" value="1" checked><b><font color="red">▲</font></b>使用原有图片 
           <input type="radio" name="cimg" value="2"><b><font color="red">◆</font></b>删除原有图片重新上传
	
	</td>
  </tr>
  <tr>
    <td height="25" align="right" bgcolor="#F4FBFF">广告规格：</td>
    <td bgcolor="#F4FBFF"><INPUT name=ADWidth type="text" onKeyPress="return Num();" value="<%=rs("ADWidth")%>" size=8 maxlength=4>  
      × <INPUT name=ADHeight type="text" onKeyPress="return Num();" value="<%=rs("ADHeight")%>" size=8 maxlength=4></td>                     
  </tr>
  <tr style="visibility:hide;">
    <td height="25" align="right" bgcolor="#F4FBFF">链接地址：</td>
    <td bgcolor="#F4FBFF"><INPUT name=ADLink type="text" value="<%=rs("ADLink")%>" size=50 maxlength=200></td>                      
  </tr>
  <tr>
    <td height="25" align="right" bgcolor="#F4FBFF">提示文字：</td>
    <td bgcolor="#F4FBFF"><INPUT name=ADAlt type="text" value="<%=rs("ADAlt")%>" size=30 maxlength=50></td>                      
  </tr>
  <tr >
    <td height="25" align="right" bgcolor="#F4FBFF">投放限制：</td>
    <td bgcolor="#F4FBFF">
	<INPUT name=ADStopViews type="text" onKeyPress="return Num();" value="<%=rs("ADStopViews")%>" size=8 maxlength=10>
      ·<INPUT name=ADStopHits type="text" onKeyPress="return Num();" value="<%=rs("ADStopHits")%>" size=8 maxlength=10>
      ·<INPUT name=ADStopDate type="text" value="<%=rs("ADStopDate")%>" size=8 maxlength=19>
      <br>
       <a href="#" onclick=openhelp("stop") title="点击查看帮助">显示(广告所在页面的浏览次数)·点击(该广告的点击次数)·日期(该广告的失效日期)</a></td>      
  </tr>
  <tr>
    <td height="25" align="right" bgcolor="#F4FBFF">重新统计：</td>
    <td bgcolor="#F4FBFF"><input type="checkbox" name="ADRESET" value="YES"> 重置显示和点击次数</td>                     
  </tr>
   <tr>
    <td height="25" align="right" bgcolor="#F4FBFF">所需积分：</td>
    <td bgcolor="#F4FBFF"><INPUT name=ADMark type="text" value="<%=rs("ADMark")%>" size=30 maxlength=50> 换取该广告的所需的积分</td>                     
  </tr>
  <tr>
    <td height="25" align="right" bgcolor="#F4FBFF">简单注释：</td>
    <td bgcolor="#F4FBFF"><INPUT name=ADNote type="text" value="<%=rs("ADNote")%>" size=30 maxlength=100> 备注不显示在广告中</td>                     
  </tr>
  <tr bgcolor="c0c0c0">
    <td height="25" colspan="2" align="center" bgcolor="#83B1FE">
      <INPUT name="ChangeAD" type="submit" value="确 定">
      &nbsp;
      <INPUT name="AddAD2" type="button" value="返 回" onClick="history.back();"></td>
  </tr></form>
</table>

<%
    Response.Write "<Script language=javascript>ChangeType('"&rs("ADType")&"')</Script>"
	rs.Close
	set rs=nothing
	conn.Close
	set conn=nothing
	
Else
	Response.Write "没有指明要编辑的ID。"
End If
%>
    <br>	</td>
  </tr>
</table>
<br>
</body>
</html>
