<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	end if
	useflag=5
%>
<!--#include file="flag.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>广告系统--修改广告</title>
<LINK href="Include/Admin_Style.css" type=text/css rel=stylesheet>
<SCRIPT LANGUAGE="JavaScript" src="Include/js.js"></SCRIPT>
</head>
<body topmargin="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="sortbutton">
  <tr>
    <td bgcolor="#FFFFFF">
<%
On Error Resume Next
Dim rs,sql,id
If Request.QueryString("id")<> "" Then
id=Request.QueryString("id")
'打开/更新广告数据
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select ADID,ADType,ADSrc,ADHeight,ADWidth,ADLink,ADAlt,ADStopViews,ADStopHits,ADStopDate,ADNote,ADViews,ADHits from [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"))
	rs("ADSrc")=DangerEncode(Request.Form("ADSrc"))
	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"))
	If Request.Form("ADRESET")="YES" Then
		rs("ADViews")=0
		rs("ADHits")=0
	End If
	rs.Update
	response.write "<script language=javascript>alert('广告更新成功！');window.location.reload('ad_list.asp')</script>"
	End If
	If Err <> 0 Then
			Response.Write "<font color=red size=2>错误:"&Err.Description
			Response.End
End If
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" height="421" class="sortbutton">
  <form name=form action=?id=<%=id%>  method=post onSubmit="return chkinput()"><tr align="center">
    <td height="19" colspan="2">修 改 广 告</td>  
  </tr>
  <tr>
    <td width="196" height="23" align="right"><font size="4" color="#FF00FF">*</font>广告 &nbsp;ID：</td>
	<td width="745" height="23" bgcolor="#FFFFFF"><INPUT name=ADID type="text" class="input1"  readOnly value="<%=rs("ADID")%>" size=10 maxlength=20> JS文件名：<b>js/<%=rs("ADID")%>.js </b>
	&nbsp; <a href="ad_createjs.asp?id=<%=rs("ADID")%>" target="_self">生成JS</a>&nbsp;&nbsp;</td>
	</tr>
  <tr>
    <td height="26" align="right" width="196"><font size="4" color="#FF00FF">*</font>广告类型：</td>
	<td width="745" height="26" bgcolor="#FFFFFF">
<select name="ADType" size="1" class="input1" onChange="ChangeType(this.options[this.selectedIndex].value)">
  <option <%If rs("ADType")=11 Then Response.Write"selected"%>  value="11">HTML式广告代码</option>
  <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 height="122" align="right" id="adsrc_text" width="196"><font size="4" color="#FF00FF">*</font>广告内容或地址：<a onClick="openhelp(&quot;ext&quot;)" href="#"><br> 图片或FLASH地址？</a></td>
	<td width="745" height="122" valign="top" bgcolor="#FFFFFF">
<%
	If rs("ADType")= 6 Then
	Response.Write ("<textarea rows=5 name=ADSrc cols=60 class=input2>"&server.HTMLencode(rs("ADSrc"))&"</textarea>")
	else
%>                                                     
    <textarea rows="5"  name="ADSrc" cols="60"><%=rs("ADSrc")%></textarea>
	<%end if%><br>HTML式广告代码请直接填写内容,多行含有变量的JAVASCRIPT不适合此程序！！<br>动画或FLASH直接填地址就可以了！
    </td>   
  </tr>
  <tr>
  	<td height="23" align="right" width="196">广告大小规格：</td>
	<td width="745" height="23" bgcolor="#FFFFFF"><INPUT name=ADWidth type="text" class="input1" onKeyPress="return Num();" value="<%=rs("ADWidth")%>" size=8 maxlength=4>  
      × <INPUT name=ADHeight type="text" class="input1" onKeyPress="return Num();" value="<%=rs("ADHeight")%>" size=8 maxlength=4>(若为“HTML式广告代码”，随便填写一个数字即可！</td>                                                 
  </tr>
  <tr style="visibility:hide;">
    <td height="23" align="right" width="196">链接地址：</td>
    <td width="745" height="23" bgcolor="#FFFFFF"><INPUT name=ADLink type="text" class="input1" value="<%=rs("ADLink")%>" size=30 maxlength=150></td>                     
  </tr>
  <tr>
    <td height="23" align="right" width="196">提示文字：</td>
    <td width="745" height="23" bgcolor="#FFFFFF"><INPUT name=ADAlt type="text" class="input1" value="<%=rs("ADAlt")%>" size=30 maxlength=50></td>                    
  </tr>
  <tr>
    <td height="23" align="right" width="196">投放限制：</td>
    <td width="745" height="23" bgcolor="#FFFFFF"><INPUT name=ADStopViews type="text" class="input1" onKeyPress="return Num();" value="<%=rs("ADStopViews")%>" size=8 maxlength=10>
      ·<INPUT name=ADStopHits type="text" class="input1" onKeyPress="return Num();" value="<%=rs("ADStopHits")%>" size=8 maxlength=10>                             
      ·<INPUT name=ADStopDate type="text" class="input1" value="<%=rs("ADStopDate")%>" size=10 maxlength=19> <a href="#" onclick=openhelp("stop") title="点击查看帮助">显示·点击·日期？</a></td>                                   
  </tr>
  <tr>
    <td height="19" align="right" width="196">重新统计：</td>
    <td width="745" height="19" bgcolor="#FFFFFF"><input type="checkbox" name="ADRESET" value="YES"> 重置显示和点击次数</td>
	</tr>
  <tr>
    <td height="23" align="right" width="196">简单注释：</td>
    <td width="745" height="23" bgcolor="#FFFFFF"><textarea rows="2" name="ADNote" cols="59"><%=rs("ADNote")%></textarea><br>
      备注不显示在广告中</td>
  </tr>
  <tr >
   <td height="23" colspan="2" align="center"><INPUT name="ChangeAD" type="submit" class="input1" value="确 定"></td>
  </tr>
</form>
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" height="1" class="sortbutton">
  <tr>
    <td width="100%" height="1" align="center">
      动态调用效果：(代码：<input style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" onFocus="this.select()" value="<script src='http://<%= request.ServerVariables("Server_Name") %>/ad/ad.asp?adid=<%=rs("ADID")%>'></script>" size="73">)</td>
  </tr>
  <tr>
    <td height="23" align="center" width="100%"><script src='http://<%= request.ServerVariables("Server_Name") %>/ad/ad.asp?adid=<%=rs("ADID")%>'></script></td>
  </tr>
  <tr>
    <td width="100%" height="1" align="center">
      JS静态效果： (代码：
        <input style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" onFocus="this.select()" value="<script src='http://<%= request.ServerVariables("Server_Name") %>/ad/ad/JS/<%=rs("ADID")%>.js'></script>" size="73">&nbsp;)</td>
  </tr>
  <tr>
    <td height="23" align="center" width="100%"><script src='http://<%= request.ServerVariables("Server_Name") %>/ad/JS/<%=rs("ADID")%>.js'></script></td>
  </tr>
</table>
</td>
  </tr>
</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
Rem 过滤可能出错误的符号
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
%>
</body>
</html>
