<%
 data_path="../" 'ACC连接数据库路径，对SQL无效 
  numid="06"
 dir="err.asp"
%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/safe.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>添加广告</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="1" bgcolor="DDDDDD">
  <tr>
    <td bgcolor="#F4FBFF"><%
Dim rs,sql
if Request.Form("AddAD")<> "" then

'加入数据
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from [Websen_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("which_mod")=TRIM(Request.Form("which_mod"))
rs("which_page")=TRIM(Request.Form("which_page"))
rs("ADMark")=DangerEncode(Request.Form("ADMark"))
rs.Update
rs.Close

set rs=nothing
conn.Close
set conn=nothing
Response.Write "<script>alert('加入成功');location.href='add.asp'</script>"
Response.end
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
%>      <br>
	  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#BADFFE">
      <form name=form action=add.asp  method=post onsubmit="return chkinput()">
        <tr align="center" bgcolor="c0c0c0">
          <td height="22" colspan="2" bgcolor="#83B1FE">添 加 新 广 告</td>
        </tr>
        <tr>
          <td width="88" align="right" bgcolor="#F4FBFF">广告&nbsp; ID：</td>
          <td width="429" bgcolor="#F4FBFF">
          <INPUT name=ADID type="text" size="10" maxlength="20"> 不能重名</td>
        </tr>
        <tr>
          <td align="right" bgcolor="#F4FBFF">广告类型：</td>
          <td bgcolor="#F4FBFF">
              <select size="1" name="ADType" onChange="ChangeType(this.options[this.selectedIndex].value)">
                <option selected 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="#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
		  	Response.Write "<option value="&rst1("id")&">"&rst1("yx_tempname")&"</option>"
		  	rst1.movenext
		  Loop
		  rst1.close
		  set rst1=nothing
		  %>
		  </select>
            <label>所在页面：
            <select name="which_page" id="which_page">
              <option value="网站首页">网站首页</option>
              <option value="我要采购">我要采购</option>
              <option value="我要销售">我要销售</option>
              <option value="公司库">公司库</option>
              <option value="产品库">产品库</option>
              <option value="展会服务">展会服务</option>
              <option value="人才招聘">人才招聘</option>
			   <option value="商业资讯">商业资讯</option>
            </select>
          </label>		  </td>
        </tr>
        <tr>
          <td align="right" bgcolor="#F4FBFF" id="adsrc_text">广告图片地址：</td>
          <td height="17" bgcolor="#F4FBFF">
              <INPUT name=ADSrc type="text" value="http://" size=30> 图片或FLASH地址 <input type="checkbox" name="shang" value="1" onClick="shan()">
      <a href="javascript:;" onClick="shan()">我要上传</a></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>
  <!--------------------------------------------------------------------------->
	
	
	</td>
  </tr>
        <tr>
          <td align="right" bgcolor="#F4FBFF">广告规格：</td>
          <td height="17" bgcolor="#F4FBFF">
              <INPUT name=ADWidth type="text" onKeyPress="return Num();" value="468" size=8 maxlength=4>
              ×
            <INPUT name=ADHeight type="text" onKeyPress="return Num();" value="60" size=8 maxlength=4>
            px</td>
        </tr>
        <tr>
          <td align="right" bgcolor="#F4FBFF">链接地址：</td>
          <td height="17" bgcolor="#F4FBFF">
            <INPUT name=ADLink type="text" value="http://" size=50 maxlength=200></td>
        </tr>
        <tr>
          <td align="right" bgcolor="#F4FBFF">提示文字：</td>
          <td height="17" bgcolor="#F4FBFF">
            <INPUT name=ADAlt type="text" size=30 maxlength=50></td>
        </tr>
        <tr >
          <td align="right" bgcolor="#F4FBFF">投放限制：</td>
          <td height="18" bgcolor="#F4FBFF">
           <INPUT name=ADStopViews type="text" onKeyPress="return Num();" value="0" size=8 maxlength=10>
            ·
            <INPUT name=ADStopHits type="text" onKeyPress="return Num();" value="0" size=8 maxlength=10>
            ·
            <INPUT name=ADStopDate type="text" value="<%=year(date())%>-<%=month(date())+1%>-<%=day(date())%>" size=8 maxlength=19> 
          <br>  <a href="#" onclick=openhelp("stop")>显示(广告所在页面的浏览次数)·点击(该广告的点击次数)·日期(该广告的失效日期)</a></td>
        </tr>
		 <tr>
    <td height="25" align="right" bgcolor="#F4FBFF">所需积分：</td>
    <td bgcolor="#F4FBFF"><INPUT name=ADMark type="text"  size=30 maxlength=50> 换取该广告的所需的积分</td>                     
  </tr>
        <tr>
          <td align="right" bgcolor="#F4FBFF">简单注释：</td>
          <td height="17" bgcolor="#F4FBFF">
            <INPUT name=ADNote type="text" size=30 maxlength=100> 备注不显示在广告中</td>
        </tr>
        <tr bgcolor="c0c0c0">
          <td height="25" colspan="2" align="center" bgcolor="#87DAFA">
            <INPUT name="AddAD" type="submit" value="确 定">
            &nbsp;
            <INPUT name="AddAD2" type="button" value="返 回" onClick="history.back();"></td>
        </tr>
      </form>
    </table>
    <br></td>
  </tr>
</table>
<br>
<table width="760" height="30" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="DDDDDD">
  <tr>
    <td align="center" bgcolor="f1f1f1">&nbsp;</td>
  </tr>
</table>
</body>
</html>
