<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	end if
	useflag=5
%>
<!--#include file="flag.asp"-->
<%
	action=Trim(Request.QueryString("action"))
	id=Trim(Request.QueryString("id"))
	photourl=Trim(Request.Form("photourl"))
	photoart=Trim(Request.Form("photoart"))
	linkurl=Trim(Request.Form("linkurl"))
	select case action
	'//修改数据
	case "edit"
		set rs=server.CreateObject("adodb.recordset")
		rs.Open "select * from [float_ad] where id="&id,conn,2,3
		rs("photourl")=Trim(Request.Form("photourl"))
		rs("photoart")=Trim(Request.Form("photoart"))
		rs("linkurl")=Trim(Request.Form("linkurl"))
		rs("ttype")=int(Trim(Request.Form("ttype")))
		rs("stime ")=now()
		rs.Update
		rs.Close
		set rs=nothing
		response.Write "<script language=javascript>alert('轮显广告修改成功！');window.location.reload('ad_ad1.asp')</script>"
		response.End
	'//添加新数据
	case "add"
		set rs=server.CreateObject("adodb.recordset")
		rs.open "select * from [float_ad]",conn,2,3
		rs.addnew
		rs("photourl")=Trim(Request.Form("photourl"))
		rs("photoart")=Trim(Request.Form("photoart"))
		rs("linkurl")=Trim(Request.Form("linkurl"))
		rs("ttype")=int(Trim(Request.Form("ttype")))
		rs("stime ")=now()
		rs.update
		rs.close
		set rs=nothing
		response.Write "<script language=javascript>alert('轮显广告添加成功！');window.location.reload('ad_ad1.asp')</script>"
		response.End
	'//删除数据
	case "del"
		conn.execute ("delete from [float_ad] where id="&Trim(Request.QueryString("id")))
		response.Write "<script language=javascript>alert('轮显广告删除成功！');window.location.reload('ad_ad1.asp')</script>"
		response.End
	end select
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="Include/Admin_Style.css" type=text/css rel=stylesheet>
<SCRIPT LANGUAGE="JavaScript">
<!--
function edit()
{
    if(document.form1.photourl.value==""){
		document.form1.photourl.focus();
    	alert("请输入图片地址！");
	return false;
  }
    if(document.form1.linkurl.value=="") {
	document.form1.linkurl.focus();
    alert("请输入图片链接！");
	return false;
  }
   if(document.form1.photoart.value=="") {
	document.form1.photoart.focus();
    alert("对不起，请填写备注！");
	return false;
  }
}
function add()
{
    if(document.form2.photourl.value==""){
		document.form2.photourl.focus();
    	alert("请输入图片地址！");
	return false;
  }
    if(document.form2.linkurl.value=="") {
	document.form2.linkurl.focus();
    alert("请输入图片链接！");
	return false;
  }
   if(document.form2.photoart.value=="") {
	document.form2.photoart.focus();
    alert("对不起，请填写备注！");
	return false;
  }
}
//-->
</script>
</head>
<body>
<table width="100%" border="1" align="center" cellpadding="5" cellspacing="1" class="sortbutton">
  <tr> 
    <td height="16" align="center"><font color="#000000"><b>网站首页轮显广告管理</b></font></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF"> 
      <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
        <tr> 
          <td width="19%" align="center">图片地址</td>
          <td width="21%" align="center">图片链接</td>
          <td width="11%" align="center">备注</td>
          <td width="22%" align="center">添加时间</td>
          <td width="12%" align="center">广告类型</td>
          <td width="15%" align="center">操 作</td>
        </tr>
<%
	set rs=server.CreateObject("adodb.recordset")
	rs.Open "select * from [float_ad] order by id desc",conn,1,1
	do while not rs.EOF
%>
        <form name="form1" method="post" action="?action=edit&id=<%=int(rs("id"))%>" onSubmit="return edit()">
          <tr> 
            <td align="center" bgcolor="#FFFFFF"><input name="photourl" type="text" id="photourl" value="<%=trim(rs("photourl"))%>" size="25"></td>
            <td align="center" bgcolor="#FFFFFF"><input name="linkurl" type="text" id="linkurl" value="<%=trim(rs("linkurl"))%>" size="25"></td>
            <td align="center" bgcolor="#FFFFFF"><input name="photoart" type="text" id="photoart" value="<%=trim(rs("photoart"))%>" size="15"></td>
            <td align="center" bgcolor="#FFFFFF"><%=trim(rs("stime"))%></td>
            <td align="center" bgcolor="#FFFFFF">
			<select name="ttype">
			<option value="0" <% If int(trim(rs("ttype")))=0 Then Response.Write("selected")%>>网站首页</option>
			<option value="1" <% If int(trim(rs("ttype")))=1 Then Response.Write("selected")%>>培训教育</option>
			<option value="2" <% If int(trim(rs("ttype")))=2 Then Response.Write("selected")%>>院校服务</option>
            </select></td>
            <td bgcolor="#FFFFFF" align="center"><input type="submit" name="Submit" value="修 改">&nbsp;<a href="?id=<%=int(rs("id"))%>&action=del" onClick="return confirm('您确定要删除此广告吗？')"><font color=red>删除</font></a></td>
          </tr>
        </form>
<%
	rs.movenext
	loop
	rs.close
	set rs=nothing
%>
      </table>
    </td>
  </tr>
</table>
<br>
<table width="100%" border="1" align="center" cellpadding="5" cellspacing="1" class="sortbutton">
  <tr> 
    <td height="16" align="center"><font color="#FFFFFF"><b><font color="#000000">后台用户添加</font></b></font></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF"> 
      <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
        <tr> 
          <td width="22%" align="center">图片地址</td>
          <td width="22%" align="center">图片链接</td>
          <td width="21%" align="center">备注</td>
          <td width="21%" align="center">广告类型</td>
          <td width="14%" align="center">操 作</td>
        </tr>
        <form name="form2" method="post" action="?action=add" onSubmit="return add()">
          <tr> 
            <td bgcolor="#FFFFFF" align="center"><input name="photourl" type="text" id="photourl" value="" size="30"></td>
            <td bgcolor="#FFFFFF" align="center"><input name="linkurl" type="text" id="linkurl" value="" size="30"></td>
            <td align="center" bgcolor="#FFFFFF"><input name="photoart" type="text" id="photoart" value="" size="30"></td>
            <td align="center" bgcolor="#FFFFFF">
			<select name="ttype">
              <option value="0" selected>网站首页</option>
              <option value="1">培训教育</option>
			  <option value="2">院校服务</option>
            </select>
			</td>
            <td bgcolor="#FFFFFF" align="center"><input type="submit" name="Submit" value="添 加"></td>
          </tr>
        </form>
      </table>
    </td>
  </tr>
</table>
<br>
<table width="100%" border="1" align="center" cellpadding="5" cellspacing="1" class="sortbutton">
  <tr>
    <td align="center"><font color="#000000">操作注意事项及说明</font></td>
  </tr>
  <tr>
    <td height="38" bgcolor="#FFFFFF">
	<table width="80%" border="0" align="center" cellpadding="5" cellspacing="0">
      <tr>
        <td height="48"><p><font color="#FF0000"><br>
          <br>
              ·<b><font color="#000000">注意：1) 最好请控制轮显图片数量在10个以内。</font></b> <br> 
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><font color="#000000">2) </font></b> <b><font color="#000000">广告类型指的是广告出现的位置。</font></b><br><br>
        </font></p></td>
      </tr>
    </table>
	</td>
  </tr>
</table>
</body>
</html>
