<%@ LANGUAGE=VBScript CodePage=65001%>
<% response.charset="utf-8" %>
<% session.codepage=65001 %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--#include file="../LyricInc/access.asp"  -->
<!-- #include file="LyricInc/functions.asp" -->
<!-- #include file="../LyricInc/m_x_to_html/ADs_to_js.asp" -->
<!-- #include file="../LyricInc/m_x_to_html/index_to_html.asp" -->
<% '添加数据到数据表
act=Request("act")
If act="save" Then 
l_name=trim(request.form("name"))
l_url=trim(request.form("url"))
l_position=trim(request.form("position"))
l_image=trim(request.form("web_image"))
l_order=trim(request.form("order"))
l_ADtype=trim(request.form("ADtype"))
l_FlashUrl=trim(request.form("FlashUrl"))
l_ADcode=trim(request.form("ADcode"))
l_ADWidth=trim(request.form("ADwidth"))
l_ADHeight=trim(request.form("ADHeight"))
l_view_yes=trim(request.form("view_yes"))
l_time=now()

set rs=server.createobject("adodb.recordset")
sql="select * from mobile_web_ads"
rs.open(sql),cn,1,3
rs.addnew
rs("name")=l_name
rs("url")=l_url
rs("position")=l_position
rs("FlashUrl")=l_FlashUrl
rs("ADcode")=l_ADcode
rs("image")=l_image
if l_order<>"" then
rs("order")=cint(l_order)
end if
'rs("view_yes")=cint(l_view_yes)
'rs("ADtype")=cint(l_ADtype)
if l_ADWidth<>"" then
rs("ADWidth")=cint(l_ADWidth)
end if
if l_ADHeight<>"" then
rs("ADHeight")=cint(l_ADHeight)
end if
rs("time")=l_time
rs.update
rs.close
set rs=nothing
%>
<% '生成广告JS
set rs2=server.createobject("adodb.recordset")
sql="select top 1 [id] from [mobile_web_ads] where [name]='"&l_name&"' order by [time] desc"
rs2.open(sql),cn,1,1
if not rs2.eof  then
l_id=rs2("id")
call ADs_to_js(l_id)
end if
rs2.close
set rs2=nothing
%>
<%
call index_to_MHtml()
response.Write "<script language='javascript'>alert('提交成功！');location.href='mobile_ads_list.asp';</script>"
end if 
 %>
 

	<%
Call header()

%>

  <form id="form1" name="form1" method="post" action="?act=save">
         <script language='javascript'>
function checksignup1() {
if ( document.form1.name.value == '' ) {
window.alert('请输入广告标题^_^');
document.form1.name.focus();
return false;}


if(document.form1.ADWidth.value.search(/^([0-9]*)([.]?)([0-9]*)$/)   ==   -1)   
      {   
  window.alert("长度只能是数字^_^");   
document.form1.ADWidth.focus();
return false;}

if(document.form1.ADHeight.value.search(/^([0-9]*)([.]?)([0-9]*)$/)   ==   -1)   
      {   
  window.alert("宽度只能是数字^_^");   
document.form1.ADHeight.focus();
return false;}

if(document.form1.order.value.search(/^([0-9]*)([.]?)([0-9]*)$/)   ==   -1)   
      {   
  window.alert("排序只能是数字^_^");   
document.form1.order.focus();
return false;}

return true;}
</script>
	<table cellpadding='3' cellspacing='0' border='0' class='tableBorder' align=center>
	<tr>
	  <th class='tableHeaderText' colspan=2 height=25>添加广告</th>
	</tr>

	<tr>
	<td width="15%" height=23 class='forumRowHighLight'>标题 (必填) </td>
	<td class='forumRowHighLight'><input name='name' type='text' id='name' size='70'>
	  &nbsp;</td>
	</tr>

	  <tr>
	    <td class='forumRow' height=23>链接</td>
	    <td class='forumRow'><input name='url' type='text' id='url' size='70'>
        &nbsp;以http://开头</td>
      </tr>
	  <tr>
	    <td class='forumRow' height=23>位置</td>
	    <td class='forumRow'><label>
	      <select name="position" id="position">
	       <% set rsp=server.createobject("adodb.recordset")
		   sql="select id,name from mobile_web_ads_position "
		   rsp.open(sql),cn,1,1
		   if not rsp.eof and not rsp.bof then
		   do while not rsp.eof 
		   %> <option value="<%=rsp("id")%>"><%=rsp("name")%></option>
            <%
			rsp.movenext
			loop
			end if
			rsp.close
			set rsp=nothing%></select>
	    </label></td>
      </tr>
	  <tr>
	    <td class='forumRowHighLight' height=23>图片 </td>
	    <td width="85%" class='forumRowHighLight'><table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
           <td width="22%" ><input name="web_image" type="text" id="web_image"  size="30"></td>
           <td width="78%"  ><iframe width="500" name="ad" frameborder=0 height=30 scrolling=no src=PetUpload.asp></iframe></td>
         </tr>
       </table></td>
      </tr>
	  <tr>
	    <td class='forumRow' height=23>图片尺寸</td>
	    <td class='forumRow'>宽度
          <input name='ADWidth' type='text' id='ADWidth' size='6' maxlength="4" /> 
        高度
        <input name='ADHeight' type='text' id='ADHeight' size='6' maxlength="4" /></td>
      </tr>
	  <tr>
	    <td class='forumRowHighLight' height=23>广告代码(选填)</td>
	    <td class='forumRowHighLight'><textarea name='ADcode'  cols="100" rows="6"   ></textarea></td>
      </tr>
	  <tr>
	    <td class='forumRowHighLight' height=23>排序</td>
	    <td class='forumRowHighLight'><span class="forumRow">
	      <input name='order' type='text' id='order' value="1" size='20'>
	    &nbsp;只能是数字，数字越小排名越靠前</span></td>
      </tr>
	  	<tr><td height="100" colspan=2  class='forumRow2'><div class='ButtonFix' align="center">
	  <INPUT class='GPetSubmit' type=submit value='提 交'  onClick='javascript:return checksignup1()' name=Submit>
	  </div></td></tr>
	</table>
</form>

<%
Call DbconnEnd()
 %>