<!--#include file="../../Conn.asp" -->
<!--#include file="../../Comm/Site_Class.asp" -->
<!--#include file="../../Comm/Function.asp" -->
<%
PagePath = "../../"

Set Qsite = New Site_Class

Qsite.SiteConfig_Master()
%>
<!--#include file="../Check_Login.asp" -->
<%
Qsite.Check_AdminFlag(arrAdminFlag(6 , 2))

If Request.Form <> "" Then
	Response.Redirect("FriendLink_List.asp?FriendLinkSiteName="& Qsite.chgStr(Trim(Request.Form("FriendLinkSiteName"))))
	Response.End()
End If

Dim CurrentPage,FileName
Dim FriendLinkSiteName,FriendLinkTypeId,FriendLinkId
Dim Act

Set Rs = server.createobject("ADODB.Recordset")

FriendLinkSiteName = Qsite.chgStr(Trim(Request.QueryString("FriendLinkSiteName")))
FriendLinkTypeId = Qsite.chgStr(Trim(Request.QueryString("FriendLinkTypeId")))

If FriendLinkTypeId = "" Or IsNull(FriendLinkTypeId) Or Not IsNumeric(FriendLinkTypeId) Then FriendLinkTypeId = 0

If FriendLinkSiteName <> "" Then
	Sql = "select * from FriendLinkTbl where FriendLinkSiteName like '%"& FriendLinkSiteName &"%' and (FriendLinkSiteName<>'四川人事网' or FriendLinkSiteName<>'无锡人才网') order by Px asc"
Else
	If FriendLinkTypeId <> 0 Then
		Sql = "select * from FriendLinkTbl where FriendLinkTypeId = "& FriendLinkTypeId &" and (FriendLinkSiteName<>'四川人事网' or FriendLinkSiteName<>'无锡人才网')  order by Px asc"
	Else
		Sql = "select * from FriendLinkTbl where  FriendLinkId<>123 and FriendLinkId<>125 order by Px asc"
	End If
End If

FileName = "FriendLink_List.asp?FriendLinkSiteName="& FriendLinkSiteName &"&FriendLinkTypeId="& FriendLinkTypeId

Act = Qsite.chgStr(Trim(Request.QueryString("action")))

If Act = "del" Then
	FriendLinkId = Qsite.chgStr(Trim(Request.QueryString("FriendLinkId")))
	CurrentPage = Qsite.chgStr(Trim(Request.QueryString("Page")))
	If FriendLinkId = "" Or Not IsNumeric(FriendLinkId) Then FriendLinkId = 0
	If CurrentPage = "" Or Not IsNumeric(CurrentPage) Then CurrentPage = 1
	
	Conn.Execute("delete from FriendLinkTbl where FriendLinkId = "& FriendLinkId)
	
	Response.Redirect(FileName & "&page="& CurrentPage)
	Response.End()
End If
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>友情链接管理</title>
<link href="../skins/css/main.css" rel="stylesheet" type="text/css">
<script language="javascript">
function FriendLinkDel(FriendLinkId)
{
	var fn = "<%=FileName%>"
	var question = confirm("你确定要删除此条记录吗？");
	if (question !="0")
	{
		location.href = fn + "&action=del&FriendLinkId=" + FriendLinkId;
	}
}
</script>
</head>

<body>
<form name="PosForm" method="post" action="FriendLink_List.asp" style="margin:0">
	<table width="100%" border="0" cellspacing="1" cellpadding="5">
		<tr>
			<td height="25" class="td_title">友情链接搜索</td>
		</tr>
		<tr>
			<td height="23" class="td_content">网站名称：
				<input name="FriendLinkSiteName" type="text" class="input_1" id="FriendLinkSiteName" size="50" value="<%=FriendLinkSiteName%>">
				<input name="Submit" type="submit" class="input_1" value="搜索"></td>
		</tr>
	</table>
	<br>
</form>
	<table width="100%" border="0" cellspacing="1" cellpadding="5">
		<tr>
			<td height="25" colspan="4" class="td_title">友情链接列表 -- [<a href="FriendLink_List.asp">所有链接</a>
			</td>
		</tr>
		<tr>
			<td width="20%" height="23" class="td_content"><strong>网站名称</strong></td>
			<td width="50%" class="td_content"><strong>网站地址</strong></td>
			<td width="16%" class="td_content"><strong>所属分类</strong></td>
			<td width="14%" class="td_content"><strong>操作</strong></td>
		</tr>
<%
Rs.Open Sql , Conn , 1 , 1
If Rs.Eof Then
%>
		<tr>
			<td height="23" colspan="4" class="td_content">暂无友情链接信息</td>
		</tr>
<%
Else
	Rs.PageSize = 20
	CurrentPage = Clng(Request("page"))
	If CurrentPage < 1 Then CurrentPage = 1
	If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
	Rs.AbsolutePage = CurrentPage
	i = 0
	Do While Not Rs.Eof
%>
		<tr>
			<td height="23" class="td_content"><%=Rs("FriendLinkSiteName")%></td>
			<td height="23" class="td_content"><%=Rs("FriendLinkSiteUrl")%></td>
			<td class="td_content"><a href="FriendLink_List.asp?FriendLinkTypeId=<%=Rs("FriendLinkTypeId")%>"><%=FriendLinkType_Name(Rs("FriendLinkTypeId"))%></a></td>
			<td class="td_content"><a href="FriendLink_Edit.asp?FriendLinkId=<%=Rs("FriendLinkId")%>&strFriendLinkSiteName=<%=FriendLinkSiteName%>&strFriendLinkTypeId=<%=FriendLinkTypeId%>&strPage=<%=CurrentPage%>">修改</a> | <a href="#" onClick="FriendLinkDel('<%=Rs("FriendLinkId")%>');return false;">删除</a></td>
		</tr>
<%
	i = i + 1
	Rs.MoveNext
	If i >= Rs.PageSize Then Exit Do
	Loop
%>
		<tr>
			<td height="23" colspan="4" class="td_content">
<%
	Qsite.Page_Cn CurrentPage , Rs.PageCount , Rs.RecordCount , FileName
%>			</td>
		</tr>
<%
End If
Rs.Close
%>
</table>
<%=Qsite.Sitewz%>
</body>
</html>
