<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_popfun.asp -->
<!-- #include file=../inc/bbsmanage_Fun.asp -->
<%
DEF_BBS_HomeUrl = "../../"
Dim GBL_ID
initDatabase
GBL_CHK_TempStr = ""
GBL_ID = checkSupervisorPass

SiteHead(DEF_SiteNameString & " - 管理员")
UserTopicTopInfo
DisplayUserNavigate("用户管理")
If GBL_CHK_Flag=1 Then
	UserBrowser
Else%>
	<table width=96%>
	<tr>
	<td>
	<%
	If Request("submitflag")="" Then
		Response.Write "<br><b>请先登录</b>"
	Else
		Response.Write "<br><p align=left><font color=ff0000 class=RedFont><b>" & GBL_CHK_TempStr & "</b></font>"
	End If
	DisplayLoginForm
	Response.Write "</p>"%>
	</td>
	</tr>
	</table>
<%End If
UserTopicBottomInfo
closeDataBase
SiteBottom
If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString

Function UserBrowser

	GBL_CHK_TempStr=""
	Dim Rs,SQL
	Dim UpDownPageFlag
	UpDownPageFlag = Request("UpDownPageFlag")

	Dim Start,recordCount,key
	recordCount=0
	
	Dim SQLendString

	Start = Left(Trim(Request("Start")),14)
	Start = start
	If isNumeric(Start)=0 or Start="" Then Start=0
	Start = cCur(Start)
	key = Request.Form("key")
	If key="" Then key = Request("key")

	Dim SQLCountString,whereFlag
	SQLendString=""
	whereFlag = 0

	Rem 下面的代码使目前暂不提供城市分类双重查询

	If key<>"" Then
		If whereFlag = 1 Then
			SQLendString = SQLendString & " and LeadBBS_User.UserName='" & Replace(key,"'","''") & "'"
		Else
			SQLendString = SQLendString & " where LeadBBS_User.UserName='" & Replace(key,"'","''") & "'"
			whereFlag = 1
		End If
	End If
	SQLCountString = SQLendString
	Dim MaxRecordID,MinRecordID
	MaxRecordID = 0
	MinRecordID = 0
	Dim FirstID,LastID	
	If key="" Then
		If UpDownPageFlag = "1" and Start>0 then
			If whereFlag = 1 Then
				SQLendString = SQLendString & " and LeadBBS_User.ID<" & Start
			Else
				SQLendString = SQLendString & " where LeadBBS_User.ID<" & Start
				whereFlag = 1
			End If
		Else
			If whereFlag = 1 Then
				SQLendString = SQLendString & " and LeadBBS_User.ID>" & Start
			Else
				SQLendString = SQLendString & " where LeadBBS_User.ID>" & Start
				whereFlag = 1
			End If
		end If
	
		If UpDownPageFlag = "1" then
			'If DEF_IDFocusFlag<> 2 Then SQLendString = SQLendString & " Order by  LeadBBS_User.ID DESC"
			SQLendString = SQLendString & " Order by  LeadBBS_User.ID DESC"
		Else
			'If DEF_IDFocusFlag<> 1 Then SQLendString = SQLendString & " Order by  LeadBBS_User.ID ASC"
			SQLendString = SQLendString & " Order by  LeadBBS_User.ID ASC"
		End If
	
		SQL = "select Max(id) from LeadBBS_User " & SQLCountString
		Set Rs = Con.ExeCute(SQL)
		GBL_DBNum = GBL_DBNum + 1
		
		If not Rs.Eof Then
			If Rs(0) <> "" Then
				MaxRecordID = cCur(Rs(0))
			Else
				MaxRecordID = 0
			End If
		End If
		Rs.Close
		Set Rs = Nothing
		SQL = "select Min(id) from LeadBBS_User " & SQLCountString
		Set Rs = Con.ExeCute(SQL)
		GBL_DBNum = GBL_DBNum + 1
	
		If not Rs.Eof Then
			If Rs(0) <> "" Then
				MinRecordID = cCur(Rs(0))
			else
				MinRecordID = 0
			end If
		End If
	
		Rs.Close
		Set Rs = Nothing
		SQL = "select UserCount from LeadBBS_SiteInfo"
		Set Rs = Con.ExeCute(SQL)
		GBL_DBNum = GBL_DBNum + 1
		If Rs.Eof then
			recordCount=0
		Else
			recordCount=cCur(rs(0))
			If recordCount="" or isNull(recordCount) or len(recordCount)<1 Then recordCount=0
		End If
		Rs.Close
		Set Rs = Nothing
	Else
		
	End If
	
	SQL = "select TOP "&DEF_MaxListNum&" LeadBBS_User.ID,LeadBBS_User.UserName,LeadBBS_User.Points,LeadBBS_User.ApplyTime,LeadBBS_User.Prevtime from LeadBBS_User " & SQLendString
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	Dim Num
	Dim GetData
	If Not rs.Eof Then
		GetData = Rs.GetRows(-1)
		Num = Ubound(GetData,2)+1
		If Num > Recordcount Then RecordCount = Num
	Else
		Num = 0
	End If
	Rs.close
	Set Rs = Nothing
	
	Dim i,N
	If Num>0 Then
		i=1
	
	Dim MinN,MaxN,StepValue
	SQL = ubound(getdata,2)
	If UpDownPageFlag = "1" then
		MinN = SQL
		MaxN = 0
		StepValue = -1
	Else
		MinN = 0
		MaxN = SQL
		StepValue = 1
	End If
	
	LastID = cCur(GetData(0,MaxN))
	FirstID = cCur(GetData(0,MinN))
	
	
	Dim EndwriteQueryString,PageSplictString
	EndwriteQueryString = "?GBL_CTG_ID=0"
	If key<>"" Then EndwriteQueryString = EndwriteQueryString & "&key=" & urlencode(key)

	PageSplictString = PageSplictString & "<table border=0 cellspacing=0 cellpadding=0><tr><td>&nbsp;"
	if FirstID>MinRecordID and FirstID<>0 then
		PageSplictString = PageSplictString & "<a href=UserManage.asp" & EndwriteQueryString & "&Start=0&SubmitFlag=3829EwoqIaNfoG>首页</a> " & VbCrLf
	else
		PageSplictString = PageSplictString & "<font color=999999 class=GrayFont>首页</font> " & VbCrLf
	end if

	if FirstID > MinRecordID and FirstID<>0 then
		PageSplictString = PageSplictString & " <a href=UserManage.asp" & EndwriteQueryString & "&Start=" & FirstID & "&UpDownPageFlag=1&SubmitFlag=3829EwoqIaNfoG>上页</a> " & VbCrLf
	else
		PageSplictString = PageSplictString & " <font color=999999 class=GrayFont>上页</font> " & VbCrLf
	end if

	if LastID<MaxRecordID and LastID<>0 then
		PageSplictString = PageSplictString & " <a href=UserManage.asp" & EndwriteQueryString & "&Start=" & LastID & "&SubmitFlag=3829EwoqIaNfoG>下页</a> " & VbCrLf
	else
		PageSplictString = PageSplictString & " <font color=999999 class=GrayFont>下页</font> " & VbCrLf
	end if

	if LastID < MaxRecordID and LastID<>0 then
		PageSplictString = PageSplictString & " <a href=UserManage.asp" & EndwriteQueryString & "&Start=" & MaxRecordID+1 & "&UpDownPageFlag=1&SubmitFlag=3829EwoqIaNfoG>尾页</a> " & VbCrLf
	else
		PageSplictString = PageSplictString & " <font color=999999 class=GrayFont>尾页</font> " & VbCrLf
	end if
	PageSplictString = PageSplictString & "共<b>" & recordCount & "</b>条信息"
	If (recordCount mod DEF_MaxListNum)=0 Then
		PageSplictString = PageSplictString & " 计<b>" & clng(recordCount/DEF_MaxListNum) & "</b>页"
	Else
		If recordCount>=DEF_MaxListNum Then
			PageSplictString = PageSplictString & " 计<b>" & clng(recordCount/DEF_MaxListNum)+1 & "</b>页"
		Else
			PageSplictString = PageSplictString & " 计<b>1</b>页"
		End If
	End If
	PageSplictString = PageSplictString & " 每页<b>" & DEF_MaxListNum & "</b>条"
	PageSplictString = PageSplictString & "</td><td><form action=UserManage.asp><input size=6 name=key value=" & chr(34) & htmlencode(key) & """ class=fminpt><input type=submit name=submit value=搜 class=fmbtn>[请输全名]</td></form></tr></table>"
	%><br><br>
	<script language=javascript>
	function opw(f,r,id)
	{
		window.open(f+'&'+r+'='+id,'','width=450,height=37,scrollbars=auto,status=yes');
	}
	</script>
	<table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="<%=DEF_BBS_LightColor%>" class=TBBG1>
	<tr bgcolor=<%=DEF_BBS_TableHeadColor%> class=TBfour> 
		<td height="30" valign="top" colspan=5> 
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="20">
					<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="3">
					<tr>
						<td></td>
					</tr>
					</table>
					<%=PageSplictString%></td>
			</tr>
			</table>
		</td>
	</tr>
	<tr bgcolor="<%=DEF_BBS_LightestColor%>" class=TBBG9>
		<td wdith=15%><b>ID</b></td>
		<td wdith=30%><b>名称</b></td>
		<td wdith=15%><b>积分</b></td>
		<td wdith=20%><b>注册时间</b></td>
		<td wdith=20%><b>最后登录</b></td>
	</tr>
<%
		For N = MinN to MaxN Step StepValue
			%>
	<tr bgcolor="<%=DEF_BBS_LightestColor%>" class=TBBG9>
		<td height="20"><%=GetData(0,n)%></td>
		<td>
  			<a href=<%=DEF_BBS_HomeUrl%>User/LookUserInfo.asp?id=<%=GetData(0,n)%>><%=htmlencode(GetData(1,n))%></a>
  			<a href=UserModify.asp?Form_ID=<%=GetData(0,n)%> title=修改用户资料及权限><font color=008800 class=GreenFont>修改</font></a>
  			<a href=UserDelete.asp?GBL_CTG_DELETEID=<%=GetData(0,n)%>><font color=ff0000 class=RedFont title=仅单纯的删除用户资料>删</font></a>
  			<a href='javascript:opw("UpdateUserAnnounce2.asp?BoardID=<%=GBL_board_ID%>","ID",<%=GetData(0,n)%>);' title=修复用户发帖量及等级数据和短消息状态>修复</a>
  			<a href='javascript:opw("DelUserAllAnnounce.asp?BoardID=<%=GBL_board_ID%>","DelUserID",<%=GetData(0,n)%>);' title=删除此用户的好友资料，帖子收藏，发表帖子，上传附件等资料，不减积分>删资料</a>
  			<a href='javascript:opw("DelUserAllAnnounce.asp?BoardID=<%=GBL_board_ID%>&dflag=onlyupload","DelUserID",<%=GetData(0,n)%>);' title=此项同删除资料的区别在于只删除用户的上传附件>删附件</a></td>
		<td><%=GetData(2,n)%></td>
		<td><%=RestoreTime(Left(GetData(3,n),8))%></td>
		<td><%=RestoreTime(Left(GetData(4,n),8))%></td>
	</tr><%
			i = i+1
			If i > DEF_MaxListNum then Exit For
		next
%>
	<tr bgcolor=<%=DEF_BBS_TableHeadColor%> class=TBfour>
		<td height="30" valign="bottom" colspan=5>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="20">
					<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="3">
					<tr>
						<td></td>
					</tr>
					</table>
					<%=PageSplictString%></td>
			</tr>
			</table>
		</td>
	</tr>
	</table>
	<%
	Else
		Response.Write "<br>" & GBL_CHK_TempStr & "		<TR><td><br><p>没有符合条件的记录。</td></tr>" & VbCrLf
	End If

End Function
%>