<!--#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>
<title>添加新广告</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="Include/Admin_Style.css" type=text/css rel=stylesheet>
<SCRIPT LANGUAGE="JavaScript" src="Include/js.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
</script>
</head>
<body topmargin="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
 <tr>
   <td bgcolor="#FFFFFF">
<%
	if Request.Form("AddAD")<>"" then
	id1=DangerEncode(Request.Form("ADID"))
	'加入数据
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="select * from [ad] where ADID='"&DangerEncode(Request.Form("ADID"))&"'"
	rs.Open sql,conn,1,3
	If not rs.eof Then
		Response.Write ("<script>alert(' 操作错误! \n\n 广告ID重复,请使用其他ID !');history.back();</script>")
		Response.end
	End iF
	rs.AddNew 
	rs("ADID")=DangerEncode(Request.Form("ADID"))
	rs("ADType")=TRIM(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")=TRIM(Request.Form("ADNote"))
	rs.Update
	rs.Close
	set rs=nothing
	conn.Close
	set conn=nothing
	response.write "<script language=javascript>alert('广告添加成功,现在马上为您生成JS代码，请稍等...');window.location.reload('ad_createjs.asp?id="&id1&"')</script>"
	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
%>
<table width="100%" height="411" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#999999">
           <form name="form" action="?" method=post onSubmit="return chkinput()">
             <tr align="center" bgcolor="c0c0c0">
               <td height="31" colspan="2" bgcolor="#E0EEFD">添 加 新 广 告</td>
             </tr>
             <tr>
               <td width="130" align="right" bgcolor="#E0EEFD">广告&nbsp; ID：</td>
               <td width="482" bgcolor="#FFFFFF"><INPUT name=ADID type="text" class="input1" size="10" maxlength="20">
               <font color="#FF0000">仅能用数字表示，而且不能重名（必填）</font></td>
             </tr>
             <tr>
               <td align="right" bgcolor="#E0EEFD" width="130">广告类型：</td>
               <td bgcolor="#FFFFFF" width="482"><select size="1" name="ADType" class="input1" onChange="ChangeType(this.options[this.selectedIndex].value)">
                   <option selected value="11">HTML式广告代码</option>
                   <option value="1">普通显示</option>
                   <option value="2">满屏浮动显示</option>
                   <option value="3">上下浮动显示-右</option>
                   <option value="4">上下浮动显示-左</option>
                   <option value="5">全屏幕渐隐消失</option>
                   <option value="6">普通网页对话框 </option>
                   <option value="7">可移动透明对话框 </option>
                   <option value="8">打开新窗口</option>
                   <option value="9">弹出新窗口</option>
                   <option value="10">对联式广告</option>
               </select></td>
             </tr>
             <tr>
               <td align="right" bgcolor="#E0EEFD" id="adsrc_text" width="130"><div align="center">广告地址或：<br>
               <a onClick="openhelp(&quot;ext&quot;)" href="#">图片或FLASH地址？</a></div></td>
               <td height="17" bgcolor="#FFFFFF" width="482"><textarea rows="6" name="ADSrc" cols="63"></textarea> &nbsp;<a href="JavaScript:openScript('../upfile/uploadads.asp',320,225)">上传图片</a><p>HTML式广告代码请直接填写内容,多行含有变量的JAVASCRIPT不适合此程序！！<br>
               动画或FLASH直接填地址就可以了！</td>
             </tr>
             <tr>
               <td align="right" bgcolor="#E0EEFD" width="130">广告规格：</td>
               <td height="17" bgcolor="#FFFFFF" width="482"><INPUT name=ADWidth type="text" class="input1" onKeyPress="return Num();" value="468" size=8 maxlength=4>
                 ×
                 <INPUT name=ADHeight type="text" class="input1" onKeyPress="return Num();" value="60" size=8 maxlength=4>
               (若为“HTML式广告代码”，随便填写一个数字即可！）</td>
             </tr>
           <tr>
          <td align="right" bgcolor="#E0EEFD" width="130">链接地址：</td>
          <td height="17" bgcolor="#FFFFFF" width="482"><INPUT name=ADLink type="text" class="input1" size=30 maxlength=100></td>
             </tr>
             <tr>
               <td align="right" bgcolor="#E0EEFD" width="130">提示文字：</td>
             <td height="17" bgcolor="#FFFFFF" width="482"><INPUT name=ADAlt type="text" class="input1" size=30 maxlength=50></td>
             </tr>
             <tr>
               <td align="right" bgcolor="#E0EEFD" width="130">投放限制：</td>
               <td height="18" bgcolor="#FFFFFF" width="482"><INPUT name=ADStopViews type="text" class="input1" onKeyPress="return Num();" value="0" size=8 maxlength=10>
                 ·
                 <INPUT name=ADStopHits type="text" class="input1" onKeyPress="return Num();" value="0" size=8 maxlength=10>
                 ·
                 <INPUT name=ADStopDate type="text" class="input1" value="<%=date()+30%>" size=10 maxlength=19>
               <a href="#" onclick=openhelp("stop")>显示·点击·日期？</a></td>
             </tr>
             <tr>
               <td align="right" bgcolor="#E0EEFD" width="130">简单注释：</td>
               <td height="17" bgcolor="#FFFFFF" width="482"><textarea rows="2" name="ADNote" cols="59"></textarea>
               <p> 备注不显示在广告中</p></td>
             </tr>
             <tr bgcolor="c0c0c0">
               <td height="25" colspan="2" align="center" bgcolor="#E0EEFD"><INPUT name="AddAD" type="submit" class="input1" value="确 定"></td>
             </tr>
           </form>
       </table>
     </td>
   </tr>
</table>
</body>
</html>
