<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("02")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">

<%
action=request("ok")
tanchu=request("tanchu")
if action="" then 
Set rs = conn.Execute("select * from adv") 
if tanchu="" then tanchu=rs("tanchu")
%>
	<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
	<form action=adv7.asp method=post name=adv>
	<tr class=backs><td colspan=2 class=td height=18>弹出广告设置</td></tr>
    <tr>
      <td width=20% align=right height="18">是否启动弹出广告</td><td>                   
      <input type="radio" value="0" <% if tanchu=0 then %> checked <%end if%> name="tanchu"  onclick="javascript:location.href='adv7.asp?tanchu=0';">否 &nbsp;  <input type="radio" <% if tanchu=1 then %> checked <%end if%> value="1" name="tanchu"  onclick="javascript:location.href='adv7.asp?tanchu=1';">是</td>
    </tr>
<%
if tanchu=1 then
%>
    <tr>
      <td width=20% align=right height="18">弹出方式</td><td><input type="radio" value="0" <% if rs("tanchu_time")=0 then %> checked <%end if%> name="tanchu_time">每次弹出 &nbsp; <input type="radio" <% if rs("tanchu_time")=1 then %> checked <%end if%> value="1" name="tanchu_time">首次访问时弹出 [根据COOKIES判断]</td>
    </tr>
    <tr>
      <td width=20% align=right height="18">弹出页面</td><td> <input type=text value="<%=rs("tanurl")%>" name="tanurl" size=40 maxlength=30 >  <INPUT TYPE="button" value="浏览"  onClick="window.open('upload.asp?fuptype=adv&fupname=tanchu&frmname=tanurl','blank_','scrollbars=yes,resizable=no,width=650,height=450')"></td>
    </tr>
    <tr>
      <td width=20% align=right height="18">弹出窗口尺寸</td><td> 宽：<input type=text value="<%=rs("tanwidth")%>" name="tanwidth" size=10 maxlength=3> 象素&nbsp;&nbsp;&nbsp;高：<input type=text value="<%=rs("tanheight")%>" name="tanheight" size=10 maxlength=3> 象素</td>
    </tr>
    <tr>
      <td width=20% align=right height="18">弹出窗口位置</td><td> 左：<input type=text value="<%=rs("tanleft")%>" name="tanleft" size=10 maxlength=3> 象素&nbsp;&nbsp;&nbsp;顶：<input type=text value="<%=rs("tantop")%>" name="tantop" size=10 maxlength=3> 象素</td>
    </tr>
<%
end if
%>
	<tr><td colspan=2>
<INPUT name="ok" TYPE="hidden" value="ok"><INPUT name=action TYPE="submit" value="保存设置"></td></tr>
</form></table>
	<%
	rs.close
	conn.close
	set rs=nothing
	set conn=nothing
end if

if action="ok" then
    if request.form("tanchu")<>0 then
	if trim(request.form("tanurl"))="" or trim(request.form("tanwidth"))="" or trim(request.form("tanheight"))="" or trim(request.form("tantop"))="" or trim(request.form("tanleft"))="" then
	response.write "<script language='javascript'>"
	response.write "alert('填写不完整或者不符合要求，单击“确定”返回上一页！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

	If not isNumeric(request.form("tanwidth")) or not isNumeric(request.form("tanheight")) or not isNumeric(request.form("tanleft")) or not isNumeric(request.form("tantop")) then
	response.write "<script language='javascript'>"
	response.write "alert('在要求填写数字的地方，您填写了非数字内容，单击“确定”返回上一页！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if
	If request.form("tanwidth")<0 or request.form("tanheight")<0 or request.form("tanleft")<0 or request.form("tantop")<0 then
	response.write "<script language='javascript'>"
	response.write "alert('您填写的数据不符合要求，单击“确定”返回上一页！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

	tanurl=request.form("tanurl")
	tanurl=split(tanurl,".")
	n=UBound(tanurl)
	if LCase(tanurl(n))<>"jpg" and LCase(tanurl(n))<>"gif" and LCase(tanurl(n))<>"htm" then
	response.write "<script language='javascript'>"
	response.write "alert('格式不正确，弹出页面文件仅支持jpg、gif、htm格式！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if
    end if

    Set rs=Server.CreateObject("ADODB.Recordset")
	 sql="select * from adv"
	 rs.open sql,conn,1,3
 	 rs("tanchu")=request.form("tanchu")
	 if request.form("tanchu")<>0 then
 	 rs("tanchu_time")=request.form("tanchu_time")
 	 rs("tanurl")=request.form("tanurl")
 	 rs("tanwidth")=request.form("tanwidth")
 	 rs("tanheight")=request.form("tanheight")
 	 rs("tantop")=request.form("tantop")
 	 rs("tanleft")=request.form("tanleft")
	end if
	rs.update
	rs.close
	conn.close
	set rs=nothing
	set conn=nothing
	response.write "<script language='javascript'>"
	response.write "alert('弹出广告图片设置成功！');"
	response.write "location.href='adv7.asp';"
	response.write "</script>"
	response.end
end if%>
</body>
</html>

