<!--#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="del" then
	id=Trim(Request.Form("id"))
		if id="" then
			response.write"<script language=JavaScript>alert('参数为空，请选择您要删除的友情链接');"    
			response.write"this.location.href='link_all.asp';</script>"
		end if
		sql="delete from [ad_link] where id in("&id&")"
		conn.Execute sql
		response.write"<script language=JavaScript>alert('友情链接删除成功！');"    
		response.write"this.location.href='link_all.asp';</script>"
		response.End
	end if
	if action="shenhe" then
	id=Trim(Request.Form("id"))
		if id="" then
			response.write"<script language=JavaScript>alert('参数为空，请选择您要审核的友情链接');"    
			response.write"this.location.href='link_all.asp';</script>"
		end if
		sql="update [ad_link] set state=1 where id ="&id&""
		conn.Execute sql
		response.write"<script language=JavaScript>alert('友情链接审核成功！');"    
		response.write"this.location.href='link_all.asp';</script>"
		response.End
	end if
	if action="delall" then
		sql="delete from [ad_link]"
		conn.Execute sql
		response.write"<script language=JavaScript>alert('友情链接全部删除成功！');"    
		response.write"this.location.href='link_all.asp';</script>"
		response.End
	end if
	action=Trim(Request.QueryString("action"))
	dim i,intPage,page,pre,last,filepath'定义变量
	set rs_user = server.CreateObject("adodb.recordset")'创建对象
	If action="all" Then
		sql="select id,logo,link,name,link_art,state,type2 from [ad_link] where type1=0 and state=1" '定义SQL语句
		keyword="图片链接"
	elseif action="wenzi" then
		sql="select id,logo,link,name,link_art,state,type2 from [ad_link] where type1=1 and state=1" '定义SQL语句
		keyword="文字链接"
	elseif action="qiye" then
		sql="select id,logo,link,name,link_art,state,type2 from [ad_link] where type1=2 and state=1" '定义SQL语句
		keyword="企业广告"
	elseif action="hezuo" then
		sql="select id,logo,link,name,link_art,state,type2 from [ad_link] where type1=3 and state=1" '定义SQL语句
		keyword="合作伙伴"
	elseif action="apply" then
		sql="select id,logo,link,name,link_art,state,type2 from [ad_link] where state=0" '定义SQL语句
		keyword="未经审核的链接"
	End if
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href='Include/Admin_Style.CSS' rel='stylesheet' type='text/css'>
<script src='Include/Common.js'></script>
</head>
<form name="selform" method="post" action="?action=del">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sortbutton">
<tr>    
<td height="23" align="center" valign="middle"><%= keyword %>管理
</tr>
</table>
<table width="100%" style="MARGIN-TOP: 3px" border="0" align="center" cellspacing="1" cellpadding="1"  class="Border">
<tr height="25" align="center" class='title'>
	<td width='6%' nowrap>选择</td>
	<td width="8%" nowrap>I D </td>
	<td width="17%" nowrap>网站名称</td>
	<td width="24%" nowrap>网站地址</td>
	<td width="9%" nowrap>状态</td>
	<td width="20%" nowrap><% If action="wenzi" Then Response.Write("站点说明") else Response.Write("网站LOGO")%></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><div align=center><font size=3 color=red><b>暂没有"&keyword&"</b></font></div></tr></td>"
		response.End
	else
		for i=1 to rs_user.PageSize
		if rs_user.EOF or rs_user.BOF then exit for
		mylink=rs_user("link")
		link_art=rs_user("link_art")
		logo=rs_user("logo")
		state1=rs_user("state")
		type2=rs_user("type2")
		name1=rs_user("name")
%>
<tr height="25" align=center class='tdbg' onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
	<td height="41"><input type="checkbox" name="id" value="<%= rs_user("id") %>"></td>
	<td><%= rs_user("id") %></td>
	<td><%=name1%></td>
	<td><%=mylink%></td>
	<td><% If type2=0 Then Response.Write("首页") else Response.Write("<font color=""#FF0000"">非首页</font>") end if%> || <% If state1=1 Then Response.Write("已审核") else Response.Write("<font color=""#FF0000"">未审核</font>") end if%></td>
	<td><% If action<>"wenzi" Then %><a href="<%=mylink%>" target="_blank"><img src="<%=logo%>"width="88" height="31" border="0"></a><% Else %><%=link_art%><% End If %></td>
	<td><a href="link_charge.asp?action=update1&id=<%=rs_user("id")%>&ttype=<%= Trim(Request.QueryString("action")) %>"><font color="#FF0000">修改</font></a> || <a href="link_admin.asp?action=del&id=<%=rs_user("id")%>&ttype=<%= Trim(Request.QueryString("action")) %>"><font color="#FF0000">删除</font></a> || <a href="link_admin.asp?action=allow&id=<%=rs_user("id")%>&ttype=<%= Trim(Request.QueryString("action")) %>"><font color="#FF0000">审核</font></a></td>
</tr>
<%
		rs_user.movenext
		next
	End If
%>
<tr>
<td colspan=7>
<table width="99%" border="0" align="center" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs_user.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs_user.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="?page=1&action=<%= Trim(Request("action")) %>">首页</a>|
<%if pre then%>
<a href="?page=<%=intpage -1%>&action=<%= Trim(Request("action")) %>">上页</a>| <%end if%>
<%if last then%>
<a href="?page=<%=intpage +1%>&action=<%= Trim(Request("action")) %>">下页</a> |<%end if%>
<a href="?page=<%=rs_user.PageCount%>&action=<%= Trim(Request("action")) %>">尾页</a>|转到第
<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
	conn.close
	set conn=nothing
%>
</select>页</font></td>
</tr>
</table></td>
</tr>
<tr>
	<td  class='tdbg' onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'" height='25' colspan=7>
	&nbsp;&nbsp;<input id="chkAll" onClick="CheckAll(this.form)" type="checkbox" value="checkbox"  name="chkAll">全选
	<input class=Button type="submit" name="Submit2" value=" 删 除 " onClick="{if(confirm('您确定要删除此链接吗?')){this.document.selform.submit();return true;}return false;}">
	<input class=Button type="button" name="Submit3" value="清空所有链接" onClick="{if(confirm('您确定要清空所有链接吗?')){location.href='?action=delall';return true;}return false;}"></td>
</tr>
<tr>
<td  class='tdbg' onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'" colspan=7 align=right>	</td>
</tr>
</table>
</form>
</body>
</html>
