<!--#include file="Conn.asp"--><%Checklogin("用户管理")%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理区域</title>
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
</head>

<body>
<div id="man_zone">
<%
Act = Request.QueryString("act")


If Act="postchk" Then

Keys = Server.UrlEnCode(Request.QueryString("Keys"))
Ord = Server.UrlEnCode(Request.QueryString("Ord"))
Page = Request.QueryString("Page")
chkact = Request.Form("chkact")
SqlStr = ""
For i = 1 To Request.Form("chkbox").Count
	If SqlStr<>"" Then
		SqlStr = SqlStr & " Or id="&Request.Form("chkbox")(i)
	Else
		SqlStr = " Where id="&Request.Form("chkbox")(i)
	End If
Next

SqlStr = "Delete From useurl"&SqlStr

Conn.Execute(SqlStr):Conn.Close:Set Conn=Nothing
Response.Redirect "?Keys="&Keys&"&Ord="&Ord&"&Page="&Page
Response.End
End If	'End postchk


Keys=Request.QueryString("Keys")
Keyscode=TextEnCode(Keys)
Ord=Request.QueryString("Ord")
Page = Request.QueryString("Page")

If Ord="uselogin" Or Ord="uselogin Desc" Or Ord="usename" Or Ord="usename Desc" Or Ord="wname" Or Ord="wname Desc" Or Ord="wurl" Or Ord="wurl Desc" Or Ord="addtime" Or Ord="addtime Desc" Or Ord="addip" Or Ord="addip Desc" Then
	OrdStr=Ord&","
Else
	OrdStr=""
End If

Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select useurl.id As id,uid,uselogin,usename,usesex,wname,wurl,addtime,addip From useurl Left Join userinfo On userinfo.id=useurl.uid Where uselogin like '%"&Keyscode&"%' Or usename like '%"&Keyscode&"%' Or wname like '%"&Keyscode&"%' Or wurl like '%"&Keyscode&"%' Order By "&OrdStr&"Id Desc",Conn,1,1
Keys=Server.UrlEnCode(Keys)
Ord=Server.UrlEnCode(Ord)
hrefstr = "?keys="&Keys
%>	
	<form id="form1" method="post" action="?act=postchk&Keys=<%=keys%>&Ord=<%=Ord%>&Page=<%=Page%>" onSubmit="return false" />
	<table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
		<thead>
			<tr>
				<th width="30"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></th>
				<th>序号</th>
				<th><a href="<%=hrefstr%><%If ord="uselogin" Then Response.Write "&ord=uselogin+Desc" Else Response.Write "&ord=uselogin"%>">账号<%If Ord="uselogin" Then Response.Write "↓" Else If Ord="uselogin+Desc" Then Response.Write "↑"%></a></th>
				<th><a href="<%=hrefstr%><%If ord="usename" Then Response.Write "&ord=usename+Desc" Else Response.Write "&ord=usename"%>">姓名<%If Ord="usename" Then Response.Write "↓" Else If Ord="usename+Desc" Then Response.Write "↑"%></a></th>
				<th><a href="<%=hrefstr%><%If ord="wname" Then Response.Write "&ord=wname+Desc" Else Response.Write "&ord=wname"%>">Title<%If Ord="wname" Then Response.Write "↓" Else If Ord="wname+Desc" Then Response.Write "↑"%></a></th>
				<th><a href="<%=hrefstr%><%If ord="wurl" Then Response.Write "&ord=wurl+Desc" Else Response.Write "&ord=wurl"%>">URL<%If Ord="wurl" Then Response.Write "↓" Else If Ord="wurl+Desc" Then Response.Write "↑"%></a></th>
				<th><a href="<%=hrefstr%><%If ord="addtime" Then Response.Write "&ord=addtime+Desc" Else Response.Write "&ord=addtime"%>">Time<%If Ord="addtime" Then Response.Write "↓" Else If Ord="addtime+Desc" Then Response.Write "↑"%></a></th>
				<th><a href="<%=hrefstr%><%If ord="addip" Then Response.Write "&ord=addip+Desc" Else Response.Write "&ord=addip"%>">IP<%If Ord="addip" Then Response.Write "↓" Else If Ord="addip+Desc" Then Response.Write "↑"%></a></th>
			</tr>
		</thead>
		<tbody>

<%
If Not Rs.Bof And Not Rs.Eof Then
	Rs.PageSize = 13
	If Page = "" Then Page = 1
	If Page = "end" Then Page = Rs.PageCount
	If Not IsNumeric(Page) Or Page < 1 Then Page = 1
	Page = Cint(Page)
	If Page > Rs.PageCount Then Page = Rs.PageCount
	Rs.AbsolutePage = Page
	TempNum = Rs.PageSize * (Page - 1)
	
	Set Rs1=Server.CreateObject("ADODB.RecordSet")

	For i=1 To Rs.PageSize
		If Rs.Bof Or Rs.Eof Then Exit For
		TempNum=TempNum+1
%>
			<tr onMouseOver="this.style.background='#F7FCFF'" onMouseOut="this.style.background='#FFFFFF'">
				<td width="3%" align="center"><input type="checkbox" name="chkbox" value="<%=Rs("id")%>" /></td>
				<td width="5%"  align="center"><%=TempNum%></td>
				<td width="7%"  align="center"><a href="userinfo.asp?act=edit&id=<%=Rs("uid")%>"><%=Rs("uselogin")%></a></td>
				<td width="7%"  align="center"><%If Rs("usename")<>"" Then Response.Write Rs("usename")&Rs("usesex")%></td>
				<td width="29%"  align="center"><%=Rs("wname")%></td>
				<td width="29%"  align="center"><a href="<%=Rs("wurl")%>" target="_blank"><%=Rs("wurl")%></a></td>
				<td width="13%"  align="center"><%=Rs("addtime")%></td>
				<td width="7%"  align="center"><%=Rs("addip")%></td>
			</tr>
<%
		Rs.MoveNext
	Next
Else
	If Keys="" Then
%>
			<tr>
				<td align="center" colspan="8">Sorry，当前暂无信息</td>
			</tr>

<%
	Else
%>
			<tr>
				<td align="center" colspan="8"><a href="?">Sorry，没有找到“<%=Keyscode%>”相关的信息，点击返回</a></td>
			</tr>
<%
	End If
End If
%>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="8">
					<div class="showpagebox">
<%
If Rs.PageCount > 1 Then
	PageName="?Keys="&Keys&"&Ord="&Ord&"&"
	Pagelen=3
	If Page>1 Then
		Response.Write "<a href="""&PageName&"Page=1"">首页</a>"
		Response.Write "<a href="""&PageName&"Page="&Page-1&""">上一页</a>"
	End If

	If Pagelen*2+1 >= Rs.PageCount Then
		StartPage=1:EndPage=Rs.PageCount
	Else
		If Page<=Pagelen+1 Then
			StartPage=1
			EndPage=Pagelen*2+1
		Else
			StartPage=Page-Pagelen
			EndPage=Page+Pagelen
		End If
		If Page+Pagelen>Rs.PageCount Then StartPage=Rs.PageCount-Pagelen*2:EndPage=Rs.PageCount
	End If

	For i = StartPage To EndPage
		If i = Page Then
			Response.Write "<a class=""current"">"&i&"</a>"
		Else
			Response.Write "<a href="""&PageName&"Page="&i&""">"&i&"</a>"
		End If
	Next

	If Page<Rs.PageCount Then
		If Rs.PageCount - Page > Pagelen Then Response.Write "<a href="""&PageName&"Page="&Rs.PageCount&""">..."&Rs.PageCount&"</a>"
		Response.Write "<a href="""&PageName&"Page="&Page+1&""">下一页</a>"
		Response.Write "<a href="""&PageName&"Page="&Rs.PageCount&""">尾页</a>"
	End If

	Response.Write "<input type=""text"" id=""Pagego"" value="""&Page&""" onFocus=""if(this.value == '"&Page&"'){this.value='';}"" onBlur=""if(this.value == ''){this.value='"&Page&"';}"" onKeyUp=""this.value=this.value.replace(/\D/g,'')"" onKeyDown=""if(event.keyCode==13){location.href='"&PageName&"Page='+document.getElementById('Pagego').value}"" />"
End If
%>					</div>
					<div class="searchbox"><input type="text" id="keys" value="<%If Keyscode="" Then Response.Write "请输入搜索关键词" Else Response.Write Keyscode%>" onFocus="if(this.value == '<%If Keyscode="" Then Response.Write "请输入搜索关键词" Else Response.Write Keyscode%>'){this.value='';}" onBlur="if(this.value == ''){this.value='<%If Keyscode="" Then Response.Write "请输入搜索关键词" Else Response.Write Keyscode%>';}" onKeyDown="if(event.keyCode==13){location.href='?Keys='+escape(document.getElementById('keys').value)}" /><input type="button" id="searchgo" value="go" onClick="location.href='?Keys='+escape(document.getElementById('keys').value)" /></div>
					<div class="postchkbox">
						<select id="chkact" name="chkact">
							<option value="-1">删除</option>
						</select>
						<input type="button" value="执行" onClick="postchk(1)" class="btn1" />
					</div>
				</td>
			</tr>
		</tfoor>
	</table>
	</form>
<%Rs.Close:Set Rs=Nothing:Set Rs1=Nothing:Conn.Close:Set Conn=Nothing%>
</div>
</body>
</html>
