<!--#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")
cebian=request("cebian")
if action="" then 
Set rs = conn.Execute("select * from adv") 
if cebian="" then cebian=rs("cebian")
%>


	<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
	<form action=adv8.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 cebian=0 then %> checked<% end if%> name="cebian"  onclick="javascript:location.href='adv8.asp?cebian=0';">否 &nbsp; <input type="radio" value="1" <%if cebian=1 then %> checked<% end if%>  name="cebian"  onclick="javascript:location.href='adv8.asp?cebian=1';">是</td>        
    </tr>
<%
if cebian=1 then
%>
	
    <tr>
      <td width=20% align=right height="18">左侧图片</td><td> <input type=text value="<%=rs("leftpic")%>" name=leftpic size=40 maxlength=100> <INPUT TYPE="button" value="浏览"  onClick="window.open('upload.asp?fuptype=adv&fupname=left&frmname=leftpic','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("lefturl")%>" name=lefturl size=40 maxlength=100></td>
    </tr>

    <tr>
      <td width=20% align=right height="18">右侧图片</td><td> <input type=text value="<%=rs("rightpic")%>" name=rightpic size=40 maxlength=100> <INPUT TYPE="button" value="浏览"  onClick="window.open('upload.asp?fuptype=adv&fupname=right&frmname=rightpic','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("righturl")%>" name=righturl size=40 maxlength=100></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("cebian")="" 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("cebian")<>0 then

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

	leftpic=request.form("leftpic")
	leftpic=split(leftpic,".")
	n=UBound(leftpic)
	if LCase(leftpic(n))<>"jpg" and LCase(leftpic(n))<>"gif"  then
	  response.write "<script language='javascript'>"
	  response.write "alert('图片格式不正确，侧边图片仅支持JPG、GIF格式的图片。');"
	  response.write "location.href='javascript:history.go(-1)';"
	  response.write "</script>"
	  response.end
	end if

	rightpic=request.form("rightpic")
	rightpic=split(rightpic,".")
	n=UBound(rightpic)
	if LCase(rightpic(n))<>"jpg" and LCase(rightpic(n))<>"gif"  then
	  response.write "<script language='javascript'>"
	  response.write "alert('图片格式不正确，侧边图片仅支持JPG、GIF格式的图片。');"
	  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("cebian")=request.form("cebian")
	if request("cebian")<>0 then
 	 rs("leftpic")=trim(request.form("leftpic"))
 	 rs("lefturl")=trim(request.form("lefturl"))
 	 rs("rightpic")=trim(request.form("rightpic"))
 	 rs("righturl")=trim(request.form("righturl"))
	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='adv8.asp';"
	response.write "</script>"
	response.end
end if%>

</body>
</html>

