<!--#include file="head.asp"-->
<%if session("nyeee_uid")="" then
response.redirect "login.asp"
end if

dim theid,dtitle,dcolor,dbgcolor1,dcu,dlei,dispic,dpic,dtext,dstop,dtop,dmoney,sql,rs
theid=request("id")
if isnumeric(theid)=false then
response.write "<script>alert('参数错误，关闭窗口！');window.close();</script>"
response.end
end if

dtitle=HtmlEncode(trim(request.form("dtitle")))
dcolor=HtmlEncode(trim(request.form("dcolor")))
dbgcolor1=HtmlEncode(trim(request.form("dbgcolor1")))
dcu=HtmlEncode(trim(request.form("dcu")))
dlei=HtmlEncode(trim(request.form("dlei")))
dispic=HtmlEncode(trim(request.form("dispic")))
dpic=HtmlEncode(trim(request.form("dpic")))
dtext=HtmlEncode2(request.form("dtext"))
dusername=HtmlEncode(trim(request.form("dusername1")))
dtel=HtmlEncode(trim(request.form("dtel1")))

if dmoney<>"" then
  if isnumeric(dmoney)=false then
  response.write "<script>alert('广告费用请填写数字，立即返回！');history.back();</script>"
  response.end
  end if
end if

sql="select * from data where adid="&theid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if dtitle<>"" then
rs("title")=dtitle
rs("color")=dcolor
rs("bgcolor1")=dbgcolor1
rs("cu")=dcu
rs("type")=dlei
rs("ispic")=dispic
rs("pic")=dpic
rs("text")=dtext
rs("username")=dusername
rs("tel")=dtel
rs.update
response.write"<script>alert('修改成功！');location='listad.asp'</script>"
rs.close  
set rs=nothing
end if%>

<SCRIPT LANGUAGE="JavaScript">
<!--//
function checkadd()
{   
 
    if (document.postart.dtitle.value.length<1)
	{
        alert("请填写广告标题！");
        document.postart.dtitle.focus();
        return false;
    }
    if (document.postart.dlei.value=="选择广告类别")
	{
        alert("请选择广告类别！");
        document.postart.dlei.focus();
        return false;
    }
    if (document.postart.dtext.value.length<1)
	{
        alert("请您填写广告内容！");
        document.postart.dtext.focus();
        return false;
    }
    if (document.postart.dtext.value.length>1500)
	{
        alert("请把广告内容的字数控制在1500以内！");
        document.postart.dtext.focus();
        return false;
    }
	if (document.postart.dusername.value.length == 0) {
		alert("请您填写联系人姓名！");
		document.postart.dusername.focus();
		return false;
	}
	var str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,./'[]{}`1234567890-=\~!@#$%^&*()_+|?><:";
	var errorChar
	errorChar = isCharsInBag(postart.dusername.value,str)
	if (errorChar != "" )
	{
		alert('联系人姓名必须是中文！');
		postart.dusername.focus();
		return false;
	} 
function isCharsInBag (s, bag)
{ 
var i,c;
for (i = 0; i < s.length; i++)
{ 
c = s.charAt(i);//字符串s中的字符
if (bag.indexOf(c) > -1) 
return c;
}
return "";
}
	
	    if(document.postart.dusername.value.length<2||document.postart.dusername.value.length>4){
		alert("联系人姓名不能少于2字多于4字！");
		document.postart.dusername.focus();
		return false;
	}	

    if (document.postart.dtel.value.length<1)
	{
        alert("请填写您的联系电话！");
        document.postart.dtel.focus();
        return false;
    }

if (isNaN(postart.dtel.value)){
alert('电话号码必须是数字');
postart.dtel.focus();
return false;
}
    if (document.postart.dstop.value=="选择有效期")
	{
        alert("请选择有效期！");
        document.postart.dstop.focus();
        return false;
    }
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">      
<!-- Begin
maxLen = 1500;
function checkMaxInput(form) {
if (form.dtext.value.length > maxLen)
form.remLen.value = 0;
else form.remLen.value = maxLen - form.dtext.value.length;
}
//  End -->
</script>
<script language="javascript" type="text/javascript">
<!--
function changeColor(o) {
    document.getElementById("colorBox").style.color = o.value;
}
//-->
</script>
<script language="javascript" type="text/javascript">
<!--
function changeColor1(o) {
    document.getElementById("colorBox1").style.background = o.value;
}
//-->
</script>
 <div align="center">
   <table width="760" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="CAE2F8">
     <tr>
       <td bgcolor="#FFFFFF"><TABLE width=760 border=0 align="center" cellPadding=0 cellSpacing=0 bgcolor="CAE2F8">
           <TBODY>
             <TR bgcolor="CAE2F8">
               <TD bgcolor="CAE2F8"><TABLE width=100% border=0 cellPadding=0 cellSpacing=0>
                   <TBODY>
                     <TR bgcolor="EFF7FE">
                       <TD width=23 vAlign=top><IMG alt=arrow 
src="images/arrow_01.gif"></TD>
                       <TD><a href="user.asp"><font color="#CC0000">会员中心</font></a>  &gt;&gt; <a href="listad.asp">管理广告信息</a> &gt;&gt; 修改内容(<span class="info6">带 <font color="#FF0000">*</font> 号的项目为必填项</span>)</TD>
                       
                      <TD align="right"><font color="#A2CCF2"><b>www.zhaoshangw.com</b></font></TD>
                     </TR>
                   </TBODY>
               </TABLE></TD>
             </TR>
           </TBODY>
       </TABLE></tD>
     </tr>
     <tr>
       <td bgcolor="#FFFFFF"><div align="center"> <br>
               <form action="" method="post" name="postart" onsubmit="return checkadd()">
                 <table width="550" border="0" cellpadding="3" cellspacing="1" bgcolor="CAE2F8">
                   <tr bgcolor="EFF7FE">
                     <td colspan="3"><font color="#CC0000">请正确填写您的广告信息，以便达到最好效果。</font></td>
                   </tr>
                   <tr>
                     <td align="right" bgcolor="EFF7FE">广告标题：</td>
                     <td height="26" colspan="2" bgcolor="#FFFFFF"><input type="text" name="dtitle" size="20" maxlength="10" value="<%=rs("title")%>">
                         <font color="#FF0000">*10字以内</font></td>
                   </tr>
                   <tr>
                     <td align="right" bgcolor="EFF7FE">是否加粗：</td>
                     <td height="26" colspan="2" bgcolor="#FFFFFF"><input type="radio" value="no" <%if rs("cu")="no" then%>checked<%end if%> name="dcu">
                       否&nbsp;
                       <input type="radio" value="yes" name="dcu" <%if rs("cu")="yes" then%>checked<%end if%>>
                     是</td>
                   </tr>
                   <tr>
                     <td align="right" bgcolor="EFF7FE">标题颜色：</td>
                     <td height="26" bgcolor="#FFFFFF"><input name="dcolor" type="text" id="dcolor" onchange="changeColor(this);" value="<%=rs("color")%>" size="8" maxlength="8" />
                         <input type="button" name="Submit" value="选择颜色" onclick="window.open('colorpicker.html', 'colorPicker', 'width=200, height=160');" />
                     </td>
                     <td rowspan="2" align="center" bgcolor="#FFFFFF"><table width="182" height="24" border="0" cellpadding="0" cellspacing="0">
                         <tr>
                           <td align="center" style="BORDER-RIGHT: #dd91a5 1px dotted; BORDER-TOP: #dd91a5 1px dotted; BORDER-LEFT: #dd91a5 1px dotted; BORDER-BOTTOM: #dd91a5 1px dotted" <%if rs("bgcolor1")<>"" then%>bgcolor="<%=rs("bgcolor1")%>"<%else%>bgColor="#ffe8e8"<%end if%>><table width="166" border="0" cellspacing="0" cellpadding="0" height="5">
                               <tr>
                                 <td></td>
                               </tr>
                             </table>
                               <div><font style="font-size:14px" color="<%if rs("color")<>"" then%><%=rs("color")%><%else%>#000000<%end if%>"><b>原来的标题和背景颜色</b></font></div></td>
                         </tr>
                       </table>
                         <table width="180" height="24" border="0" cellpadding="0" cellspacing="0">
                           <tr>
                             <td align="center" style="BORDER-RIGHT: #dd91a5 1px dotted; BORDER-TOP: #dd91a5 1px dotted; BORDER-LEFT: #dd91a5 1px dotted; BORDER-BOTTOM: #dd91a5 1px dotted" bgcolor="#ffe8e8"><div id="colorBox1" style="width: 180px;height: 24px">
                                 <table width="166" border="0" cellspacing="0" cellpadding="0" height="5">
                                   <tr>
                                     <td></td>
                                   </tr>
                                 </table>
                                 <div id="colorBox"><font style="font-size:14px"><b>修改后标题和背景颜色</b></font></div>
                             </div></td>
                           </tr>
                     </table></td>
                   </tr>
                   <tr>
                     <td align="right" bgcolor="EFF7FE">标题背景：</td>
                     <td height="26" bgcolor="#FFFFFF"><input name="dbgcolor1" type="text" id="dbgcolor1" onchange="changeColor1(this);" value="<%=rs("bgcolor1")%>" size="8" maxlength="8" />
                         <input type="button" name="Submit" value="选择颜色" onclick="window.open('colorpicker1.html', 'colorPicker', 'width=200, height=160');" />
                     </td>
                   </tr>
                   <tr>
                     <td align="right" bgcolor="EFF7FE">广告类别：</td>
                     <td height="26" colspan="2" bgcolor="#FFFFFF"><select name="dlei" size="1">
                         <option selected value="<%=rs("type")%>"><%=rs("type")%></option>
                         <%set rs_lei = server.createobject("adodb.recordset")                                                                                                                                                                                                 
			sql = "select * from type"                                                                                                                                                                                                 
			rs_lei.open sql,conn,1,1                                                                                                                                                                                                 
			do while not rs_lei.eof%>
                         <option value="<%=rs_lei("name")%>"><%=rs_lei("name")%></option>
                         <%rs_lei.movenext                                                                                                                                                                                                 
		  loop                                                                                                
		  rs_lei.close                                                                                                                                                                                                 
		  set rs_lei = nothing%>
                       </select>
                     </td>
                   </tr>
                   <tr>
                     <td align="right" bgcolor="EFF7FE">广告形式：</td>
                     <td height="26" colspan="2" bgcolor="#FFFFFF"><input type="radio" value="no" name="dispic" <%If rs("ispic")="no" Then%>checked<%End If%>>
                       文字广告&nbsp;
                       <input type="radio" value="yes" name="dispic" <%If rs("ispic")="yes" Then%>checked<%End If%>>
                     图片广告</td>
                   </tr>
                   <tr>
                     <td align="right" bgcolor="EFF7FE">图片名称：</td>
                     <td height="26" colspan="2" bgcolor="#FFFFFF"><script language="Javascript">
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=no,menubar=no,frameborder=0,status=yes' );
}
function openem()
{ 
openScript('uploadad.asp',300,60); 
}
               </script>
                         <input name="dpic" type="text" value="<%=rs("pic")%>" size="30" maxlength="30">
        [<a href="JavaScript:openem()">上传图片</a>] <font color="#FF0000">支持gif、jpg格式</font></td>
                   </tr>
                   <tr>
                     <td rowspan="2" align="right" bgcolor="EFF7FE">广告内容：</td>
                     <td colspan="2" bgcolor="#FFFFFF"><textarea rows="6" name="dtext" cols="50" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)"><%if rs("text")<>"" then%><%=replace(rs("text"),"<br>",vbcrlf)%><%end if%>
               </textarea>
                         <font color="#FF0000">*&nbsp;</font> </td>
                   </tr>
                   <tr>
                     <td height="26" colspan="2" bgcolor="#FFFFFF"><font color="#FF0000">目前还可写
                           <input readonly type=text name=remLen size=4 maxlength=4 style="border: 1 solid #888888">
        个字！</font> </td>
                   </tr>
                   <tr bgcolor="#FFFFFF">
                     <td align="right" valign="top" bgcolor="EFF7FE"><script>
function showadvs()
{
if (document.all.advshows.checked == true) {
	document.getElementById("advs").style.display = "";
	document.getElementById("advances").innerText="关闭选项(会员功能，与用户资料同步)";
}else{
	document.getElementById("advs").style.display = "none";
	document.getElementById("advances").innerText="选中此项可查看联系方式(会员功能，与用户资料同步)";
}
}
                   </script>
                       联系方式：</td>
                     <td height="0" colspan="2"><input name=advshows type=checkbox value=1  onclick="showadvs();">
                         <font color="#FF0000"><span id=advances>选中此项可查看联系方式(会员功能，与用户资料同步)</span></font>
                         <table width="100%"  border="0" cellspacing="1" cellpadding="0" id="advs" style="display:none" bgcolor="#f4f4f4">
                           <tr>
                             <td width="15%">联 系 人：</td>
                             <td><%
sql="select * from user where uid='"&session("nyeee_uid")&"'"
set rs1=server.createobject("adodb.recordset")
rs1.open sql,conn,1,3
if not rs1.eof then
username=rs1("username")
cardid=rs1("cardid")
tel=rs1("tel")
email=rs1("email")
qq=rs1("qq")
rs1.close  
set rs1=nothing                                                                                     
end if
%>
                               <input name="dusername" type="text" id="dusername" value="<%=username%>" size="20" maxlength="20" style="background-color:f4f4f4" disabled><input name="dusername1" value="<%=username%>" type="hidden">
                 <font color="#FF0000">*</font><font color="#FF0000">&nbsp;</font><FONT color=#ff0000>中文(2-4字)</FONT></td>
                           </tr>
                           <tr>
                             <td>身份证号：</td>
                             <td><input name="dcardid" type="text" id="dcardid" value="<%=cardid%>" size="20" maxlength="18" style="background-color:f4f4f4" disabled><input name="dtel1" value="<%=tel%>" type="hidden">
                 <font color="#FF0000">* 不可修改，本站保密</font></td>
                           </tr>
                           <tr>
                             <td>联系电话：</td>
                             <td><input name="dtel" type="text" id="dtel" value="<%=tel%>" size="20" maxlength="20" style="background-color:f4f4f4" disabled>
                 <font color="#FF0000">* 数字(8位以上)</font></td>
                           </tr>
                           <tr>
                             <td> Email：</td>
                             <td><input name="demail" type="text" id="demail" value="<%=email%>" size="20" maxlength="20" style="background-color:f4f4f4" disabled></td>
                           </tr>
                           <tr>
                             <td> QQ：</td>
                             <td><input name="dqq" type="text" id="dqq" value="<%=qq%>" size="20" maxlength="20" style="background-color:f4f4f4" disabled></td>
                           </tr>
                       </table></td>
                   </tr>
                   <tr>
                     <td align="right" bgcolor="EFF7FE">生效日期：</td>
                     <td height="26" colspan="2" bgcolor="#FFFFFF"><input name="time" size="15" maxlength="50" value="<%=rs("time")%>" style="background-color:f4f4f4" disabled>
        -<font color="#FF0000">
        <input name="dstop" size="15" maxlength="50" value="<%=rs("stop")%>" style="background-color:f4f4f4" disabled>
      </font></td>
                   </tr>
                   <tr>
                     <td width="100" align="right" bgcolor="#FFFFFF"></td>
                     <td height="30" colspan="2" align="right" bgcolor="#FFFFFF"><p align="left">
                         <input type="submit" value="修改" name="submit">
               &nbsp;
                         <input type="reset" value="取消" name="reset">
               &nbsp;
                         <input type="button" value="返回" name="back" onclick="javascript:history.back()">
                     </td>
                   </tr>
                 </table>
               </form>
               <br>
       </div></td>
     </tr>
   </table>
</div>                                                                                         
 <!--#include file="foot.asp"-->                   
<%rs.close                      
set rs=nothing                                                                                                         
conn.close                       
set conn=nothing%>