<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<%
	useflag=5
%>
<!--#include file="flag.asp"-->
<!--#include file="../inc/setup.asp"-->
<%
	action=Trim(Request.QueryString("action"))

	if action="shenhe" then
	id=Trim(Request.QueryString("id"))
		if id="" then
			response.write"<script language=JavaScript>alert('参数为空，请选择您要审核的友情链接');"    
			response.write"this.location.href='ad_ads.asp';</script>"
		end if
		sql="update wishcn_ad set zhuangtai=0 where id ="&id&""
		conn.Execute sql
		response.write"<script language=JavaScript>alert('该广告已经更改为显示状态！');"    
		response.write"this.location.href='adsjs.asp?id="&id&"';</script>"
		response.End
	end if
	
	if action="save" then
		id=int(Trim(Request.Form("id")))
		set rs=server.createobject("adodb.recordset")
		sql="select * from wishcn_ad where id="&id&"" 
		rs.open sql,conn,2,3
		rs("pic")=Trim(Request.Form("pic"))
		rs("url")=Trim(Request.Form("url"))
		rs("title")=Trim(Request.Form("title"))
		rs("wwidth")=int(Trim(Request.Form("wwidth")))
		rs("hheight")=int(Trim(Request.Form("hheight")))
		rs("ttype")=int(Trim(Request.Form("ttype")))
		rs("stime")=date()
		rs.update
		response.write"<script language=JavaScript>alert('广告修改成功，现在为您返回！');"    
		response.write"this.location.href='adsjs.asp?id="&id&"';</script>"
		response.End
	end if
	if action="add" then
		set rs=server.createobject("adodb.recordset")
		sql="select * from wishcn_ad order by id desc" 
		rs.open sql,conn,2,3
		rs.addnew
		rs("stype")=Trim(Request.Form("stype"))
		rs("pic")=Trim(Request.Form("pic"))
		rs("url")=Trim(Request.Form("url"))
		rs("title")=Trim(Request.Form("title"))
		rs("wwidth")=int(Trim(Request.Form("wwidth")))
		rs("hheight")=int(Trim(Request.Form("hheight")))
		rs("ttype")=int(Trim(Request.Form("ttype")))
		rs("zhuangtai")=0
		rs("stime")=date()
		rs.update
		id=conn.Execute ("select top 1 id from wishcn_ad order by id desc")(0)
		response.write"<script language=JavaScript>alert('广告添加成功，现在为您返回！');"    
		response.write"this.location.href='adsjs.asp?id="&id&"';</script>"
		response.End
	end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<link href='Include/Admin_Style.CSS' rel='stylesheet' type='text/css'>
<script src='Include/Common.js'></script>
<script language="JavaScript">
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
 function check(){
 if (document.add.pic.value==""){
  alert("-请输入广告地址-");
  document.add.pic.focus();
  return false;
 }
  if (document.add.url.value==""){
  alert("-请输入广告链接地址-");
  document.login.url.focus();
  return false;
 }
  if (document.add.wwidth.value==""){
  alert("-请输入广告宽度-");
  document.login.wwidth.focus();
  return false;
 }
  if (document.add.hheight.value==""){
  alert("-请输入广告高度-");
  document.login.hheight.focus();
  return false;
 }
  if (document.add.title.value==""){
  alert("-请输入广告说明文字-");
  document.login.title.focus();
  return false;
 }
}
 function check1(){
 if (document.add.pic.value==""){
  alert("-请输入广告地址-");
  document.add.pic.focus();
  return false;
 }
  if (document.add.url.value==""){
  alert("-请输入广告链接地址-");
  document.login.url.focus();
  return false;
 }
  if (document.add.wwidth.value==""){
  alert("-请输入广告宽度-");
  document.login.wwidth.focus();
  return false;
 }
  if (document.add.hheight.value==""){
  alert("-请输入广告高度-");
  document.login.hheight.focus();
  return false;
 }
  if (document.add.title.value==""){
  alert("-请输入广告说明文字-");
  document.login.title.focus();
  return false;
 }
}
</script>
</head>
<body topmargin="0">
<%
	if action="" then
		dim i,intPage,page,pre,last,filepath'定义变量
		set rs_user = server.CreateObject("adodb.recordset")'创建对象
		sql="select * from [wishcn_ad] order by id asc" '定义SQL语句
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sortbutton">
<tr>    
<td height="23" align="center" valign="middle">网站广告管理
</tr>
</table>
<table width="100%" style="MARGIN-TOP: 0px" border="0" align="center" cellspacing="1" cellpadding="1"  class="Border">
<tr height="25" align="center" class='title'>
	<td width='8%' nowrap>编号</td>
	<td width="11%" nowrap>广告类型</td>
	<td width="24%" nowrap>连接地址</td>
	<td width="26%" nowrap>广告显示位置</td>
	<td width="15%" nowrap>显示状态</td>
	<td width="16%" nowrap>操作</td>
</tr>
<%
	rs_user.PageSize = 8 '这里设定每页显示的记录数
	rs_user.CursorLocation = 3
	rs_user.Open sql,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
	pre = true
	last = true
	page = trim(Request.QueryString("page"))'变量是跳转页面时的值

	if len(page) = 0 then
		intpage = 1
		pre = false
	else
		if cint(page) =< 1 then
			intpage = 1
			pre = false
		else
			if cint(page) >= rs_user.PageCount then
				intpage = rs_user.PageCount
				last = false
			else
				intpage = cint(page)
			end if
		end if
	end if
	if not rs_user.eof then
		rs_user.AbsolutePage = intpage
	end if
	if rs_user.eof then
		response.Write "<tr><td colspan=6 height=30><div align=center><font size=3 color=red><b>暂没有网站广告信息</b></font></div></tr></td>"
	else
		for i=1 to rs_user.PageSize
		if rs_user.EOF or rs_user.BOF then exit for
%>
<tr height="25" align=center class='tdbg' onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
	<td height="25"><%= rs_user("id") %></td>
	<td><% If rs_user("ttype")=0 then Response.Write("图片") else Response.Write("Flash")%></td>
	<td><%= rs_user("url") %></td>
	<td>
<%
	select case rs_user("stype")
	case 1
		Response.Write("<a href='images/ad/ads1.gif' target='_blank' title='浏览具体位置?'>网站首页</a>")
	case 2
		Response.Write("<a href='images/ad/ads2.gif' target='_blank' title='浏览具体位置?'>企业招聘专区</a>")
	case 3
		Response.Write("<a href='images/ad/ads3.gif' target='_blank' title='浏览具体位置?'>人才搜索专区</a>")
	case 4
		Response.Write("<a href='images/ad/ads4.gif' target='_blank' title='浏览具体位置?'>委托招聘专区</a>")
	case 5
		Response.Write("<a href='images/ad/ads5.gif' target='_blank' title='浏览具体位置?'>培训教育专区</a>")
	case 6
		Response.Write("<a href='images/ad/ads6.gif' target='_blank' title='浏览具体位置?'>培训教育更多专区</a>")
	case 7
		Response.Write("<a href='images/ad/ads7.gif' target='_blank' title='浏览具体位置?'>院校服务专区</a>")
	case 8
		Response.Write("<a href='images/ad/ads8.gif' target='_blank' title='浏览具体位置?'>资讯中心</a>")
	case 9
		Response.Write("<a href='images/ad/ads9.gif' target='_blank' title='浏览具体位置?'>职位搜索专区</a>")
	case 10
		Response.Write("<a href='images/ad/ads10.gif' target='_blank' title='浏览具体位置?'>会员大头贴</a>")
	end select
%>
	</td>
	<td><% If rs_user("zhuangtai")=0 then Response.Write("已审核") else Response.Write("未审核")%></td>
	<td><a href="?action=editt&id=<%= rs_user("id") %>"><font color="#FF0000">修改</font></a> || <a href="adsjs.asp?id=<%= rs_user("id") %>">重新生成</a></td>
</tr>
<%
		rs_user.movenext
		next
	End If
%>
<tr class='title'>
<%if rs_user.pagecount > 0 then%>
<td width="13%" nowrap colspan="2" align="center">当前页<%=intpage%>/<%=rs_user.PageCount%></td>
<%else%>
<td nowrap colspan="2" align="center">当前页0/0</td>
<%end if%>
<td width="46%" align="right" nowrap colspan="4"> <a href="?page=1&action=<%= Trim(Request("action")) %>"><font color="#FFFFFF">首页</font></a>&nbsp;&nbsp;|&nbsp;&nbsp;
<%if pre then%>
<a href="?page=<%=intpage -1%>&action=<%= Trim(Request("action")) %>"><font color="#FFFFFF">上页</font></a>&nbsp;&nbsp;|&nbsp;&nbsp; <%end if%>
<%if last then%>
<a href="?page=<%=intpage +1%>&action=<%= Trim(Request("action")) %>"><font color="#FFFFFF">下页</font></a>&nbsp;&nbsp;|&nbsp;&nbsp;<%end if%>
<a href="?page=<%=rs_user.PageCount%>&action=<%= Trim(Request("action")) %>"><font color="#FFFFFF">尾页</font></a>&nbsp;&nbsp;|&nbsp;&nbsp;转到第
<select name="sel_page" onchange=javascript:location.href=this.options[this.selectedIndex].value>
<%
	for i = 1 to rs_user.PageCount
	if i = intpage then
%>
<option value="?page=<%=i%>&action=<%= Trim(Request("action")) %>" selected><%=i%></option>
<%
	else
%> 
<option value="?page=<%=i%>&action=<%= Trim(Request("action")) %>"><%=i%></option>
<%
	end if
	next
	rs_user.close
	set rs_user=nothing
%>
</select>页&nbsp;&nbsp;</font></td>
</tr>
</table>
<%
	Else
		id=int(Trim(Request.QueryString("id")))
		set rs=server.createobject("adodb.recordset")
		sql="select * from wishcn_ad where id="&int(id)&" order by id desc" 
		rs.open sql,conn,1,1
%>
<form action="?action=save" method="post"  onsubmit="return check1()" name="add">
<input name="id" type="hidden" value="<%= Trim(Request.QueryString("id")) %>" />
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class='border'>
  <tr class='title'>
    <td colspan=2 align=center height=25>修改网站广告信息</td>
  </tr>
  <tr class='tdbg'>
    <td height="30" align="right">广告地址:</td>
    <td width="813" height="30"><input name="pic" type="text" id="pic" size="40" value="<%= rs("pic") %>"/> &nbsp;&nbsp;<a href="JavaScript:openScript('../upfile/uploadads.asp',320,225)">上传图片</a></td>
  </tr>
  <tr class='tdbg'>
    <td align="right">链接地址:</td>
    <td height="30"><input name="url" type="text" id="url" size="40" value="<%= rs("url") %>"/> 
      (如http://www.wishcn.com/) </td>
  </tr>
  <tr class='tdbg'>
    <td height="30" align="right">广告大小:</td>
    <td height="30">长：<input name="wwidth" type="text" id="wwidth" size="10" value="<%= rs("wwidth") %>"/> px&nbsp;&nbsp;宽：<input name="hheight" type="text" id="hheight" size="10" value="<%= rs("hheight") %>"/> px</td>
  </tr>
  <tr class='tdbg'>
    <td align="right">说明文字:</td>
    <td height="30"> <input name="title" type="text" id="title" size="80" value="<%= rs("title") %>"/></td>
  </tr>
  <tr class='tdbg'>
    <td align="right">广告类型:</td>
    <td height="30"><input type="radio" name="ttype" value="0" <% If rs("ttype")=0 Then Response.Write("checked")%>/>
图片链接<input name="ttype" type="radio" value="1" <% If rs("ttype")=1 Then Response.Write("checked")%>>动画链接</td>
</tr>
<tr class='tdbg'>
<td height="40" align="center" colspan="2"><input type="submit" name="Submit" value="提交" /> &nbsp;&nbsp;
      <input onClick="javascript:window.history.back()" type="button" value="返回"></td>
</tr>
</table>
</form>
<%
	End If
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	if action<>"editt" then
%>
<form action="?action=add" method="post" onSubmit="return check()" name="add">
<input name="stype" type="hidden" value="10">
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class='border'>
  <tr class='title'>
    <td colspan=2 align=center height=25>增加网站广告信息</td>
  </tr>
  <tr class='tdbg'>
    <td height="30" align="right">广告地址:</td>
    <td width="813" height="30"><input name="pic" type="text" id="pic" size="40"/> &nbsp;&nbsp;<a href="JavaScript:openScript('../upfile/uploadads.asp',320,225)">上传图片</a></td>
  </tr>
  <tr class='tdbg'>
    <td align="right">链接地址:</td>
    <td height="30"><input name="url" type="text" id="url" size="40" />  (如http://www.wishcn.com/) </td>
  </tr>
  <tr class='tdbg'>
    <td height="30" align="right">广告大小:</td>
    <td height="30">长：<input name="wwidth" type="text" id="wwidth" size="10" value="106"/> 
    px&nbsp;&nbsp;宽：<input name="hheight" type="text" id="hheight" size="10" value="36"/> 
    px</td>
  </tr>
  <tr class='tdbg'>
    <td align="right">说明文字:</td>
    <td height="30"> <input name="title" type="text" id="title" size="80" value="网愿科技"/></td>
  </tr>
  <tr class='tdbg'>
    <td align="right">广告类型:</td>
    <td height="30"><input name="ttype" type="radio" value="0" checked="checked" />
图片链接<input name="ttype" type="radio" value="1" >动画链接</td>
</tr>
<tr class='tdbg'>
<td height="40" align="center" colspan="2"><input type="submit" name="Submit" value="提交" /> &nbsp;&nbsp;
      <input onClick="javascript:window.history.back()" type="button" value="返回"></td>
</tr>
</table>
</form>
<%
	End If
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class='border'>
  <tr class='tdbg'>
    <td width="313" height="30" align="right">广告代码:</td>
    <td width="885" height="30"><input type="text" value="&lt;!--#include file=&quot;ads/js/ads编号.asp&quot;--&gt;" size="100"></td>
  </tr>
</table>
</body>
</html>
