<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p20")
'''''''''''''''''''''''''''''''''''''''''''''''
const recpage=15
dim i,classid,currentpage,BeginTime,key,bykey,IsLocked,paras,IsCheck,UserType
BeginTime=Timer

bykey=trim(request.QueryString("bykey"))
key=trim(request.QueryString("key"))
if(request.QueryString("IsLocked")<>"") then
	IsLocked=Cint(request.QueryString("IsLocked"))
else
	IsLocked=0
end if
if(request.QueryString("IsCheck")<>"") then
	IsCheck=Cint(request.QueryString("IsCheck"))
else
	IsCheck=0
end if
if(request.QueryString("UserType")<>"") then
	UserType=Cint(request.QueryString("UserType"))
else
	UserType=0
end if
if not isempty(request.QueryString("page")) then 
	currentpage=Clng(request.QueryString("page"))
else 
	currentpage=1
end if
paras="key="&key&"&bykey="&bykey&"&IsLocked="&IsLocked&"&IsCheck="&IsCheck&"&UserType="&UserType
%>
<html>
<head>
<title>会员管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
	font-size:12px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
form{margin:0;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="?<%=paras%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href=gourl;
}
function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
</head>
<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>

<form name="form3" method="get" action="?">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="32"><div align="center">关键字：
        <input name="key" type="text" id="key" value="<%=key%>">
      按：
      <select name="bykey" id="bykey">
        <option value="UserId" <%if(bykey="UserId") then response.write("selected=""selected""") end if%>>会员ID</option>
        <option value="Email" <%if(bykey="Email") then response.write("selected=""selected""") end if%>>会员邮箱</option>
      </select>
      <select name="IsLocked" id="IsLocked">
        <option value="1" <%if(IsLocked=1) then response.write("selected=""selected""") end if%>>锁定</option>
        <option value="0" <%if(IsLocked=0) then response.write("selected=""selected""") end if%>>未锁定</option>
        <option value="-1" <%if(IsLocked=-1) then response.write("selected=""selected""") end if%>>全部</option>
      </select>
      <select name="IsCheck" id="IsCheck">
        <option value="1" <%if(IsCheck=1) then response.write("selected=""selected""") end if%>>已通过审核</option>
        <option value="0" <%if(IsCheck=0) then response.write("selected=""selected""") end if%>>未通过审核</option>
        <option value="-1" <%if(IsCheck=-1) then response.write("selected=""selected""") end if%>>全部</option>
      </select>
      <select name="UserType" id="UserType">
        <option value="1" <%if(UserType=1) then response.write("selected=""selected""") end if%>>企业会员</option>
        <option value="0" <%if(UserType=0) then response.write("selected=""selected""") end if%>>个人会员</option>
        <option value="-1" <%if(UserType=-1) then response.write("selected=""selected""") end if%>>全部</option>
      </select>
      <input type="submit" value="搜索会员">
      </div></td>
    </tr>
  </table>
</form>
<form action="member_do.asp" name="form1" method="post" enctype="application/x-www-form-urlencoded">
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td height="25" colspan="13"><div align="center" class="style1">◆ 会员管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="3%" height="24" bgcolor="#EEEEEE"><div align="center">id</div></td>
    <td width="7%" align="center">会员类别</td>
    <td width="12%" height="20"><div align="center">会员ID</div></td>
    <td width="14%"><div align="center">邮箱</div></td>
    <td width="10%"><div align="center">注册IP</div></td>
    <td width="10%"><div align="center">注册日期</div></td>
    <td width="7%"><div align="center">登录次数</div></td>
    <td width="6%" align="center">积分</td>
    <td width="4%" align="center">推荐</td>
    <td width="4%"><div align="center">锁定</div></td>
    <td width="7%" align="center">密码重置</td>
    <td width="8%"><div align="center">审核</div></td>
    <td width="8%"><div align="center">详细</div></td>
    </tr>
  <!-- 开始按行循环----------------------->
  <%
  		dim countSql,querySql,newsArr
		set rs=server.createobject("adodb.recordset")
		countSql="select count(*) from t_member where 1=1"		
		if(key<>"") then
			Select Case bykey
					Case "UserId"
						countSql=countSql&" and UserId like '%"&key&"%'"
					Case "Email"
						countSql=countSql&" and Email like '%"&key&"%'"				
					Case Else				
			End Select
		end if
		if(IsLocked>=0) then
			countSql=countSql&" and IsLocked="&IsLocked
		end if
		if(IsCheck>=0) then
			countSql=countSql&" and IsCheck="&IsCheck
		end if
		if(UserType>=0) then
			countSql=countSql&" and UserType="&UserType
		end if
  	rs.open countSql,conn,3,1
		allrec=rs(0)
		rs.close
		set rs=nothing
		totalpage=int((allrec+recpage-1)/recpage)		
		set rs=server.createobject("adodb.recordset")
		'查询sql
		querySql="select top "&recpage&" id,UserId,Email,RegIp,RegDate,LoginNum,IsLocked,GoldMoney,Score,IsCheck,UserType,UserLevel from t_member where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_member where 1=1"
		if(key<>"") then
			Select Case bykey
					Case "UserId"
						querySql=querySql&" and UserId like '%"&key&"%'"
					Case "Email"
						querySql=querySql&" and Email like '%"&key&"%'"
					Case Else				
			End Select
		end if
		if(IsLocked>=0) then
			querySql=querySql&" and IsLocked="&IsLocked
		end if
		if(IsCheck>=0) then
			querySql=querySql&" and IsCheck="&IsCheck
		end if
		if(UserType>=0) then
			querySql=querySql&" and UserType="&UserType
		end if
		querySql=querySql&" order by id desc) as t) "
		if(key<>"") then
			Select Case bykey
					Case "UserId"
						querySql=querySql&" and UserId like '%"&key&"%'"
					Case "Email"
						querySql=querySql&" and Email like '%"&key&"%'"
					Case Else				
			End Select
		end if
		if(IsLocked>=0) then
			querySql=querySql&" and IsLocked="&IsLocked
		end if
		if(IsCheck>=0) then
			querySql=querySql&" and IsCheck="&IsCheck
		end if
		if(UserType>=0) then
			querySql=querySql&" and UserType="&UserType
		end if
		querySql=querySql&" order by id desc "
		'response.write(querySql)
		rs.open querySql,conn,3,1
		if rs.eof or rs.bof then
			response.Write("未找到相关信息!")
			response.End()
		else
			newsArr=rs.GetRows()
		end if
		rs.close
		set rs=nothing
		if isarray(newsArr) then
			for i=0 to ubound(newsArr,2)
		%>
		<tr>
			<td height="25" bgcolor="#FFFFFF"><div align="center"><input type="checkbox" name="newsid" value="<%=newsArr(0,i)%>"></div></td>
			<td height="25" align="center" bgcolor="#FFFFFF">
      <%
			if(newsArr(10,i)=0) then
				response.Write("<span style=""color:green;"">个人会员</span>&nbsp;")
			else
				response.Write("<span style=""color:red;"">企业会员</span>&nbsp;")
			end if
			%>
      </td>
			<td height="20" bgcolor="#FFFFFF"><div align="center"><a href="member_stat.asp?id=<%=newsArr(1,i)%>"><%=newsArr(1,i)%></a></div></td>
			<td bgcolor="#FFFFFF">
				<div align="center"><%=newsArr(2,i)%></div></td>
			<td bgcolor="#FFFFFF"><div align="center"><%=newsArr(3,i)%></div></td>
			<td bgcolor="#FFFFFF"><div align="center"><%=newsArr(4,i)%></div></td>
			<td bgcolor="#FFFFFF"><div align="center"><%=newsArr(5,i)%></div></td>
			<td align="center" bgcolor="#FFFFFF"><a href="member_score.asp?id=<%=newsArr(0,i)%>"><%=newsArr(8,i)%></a></td>
			<td align="center" bgcolor="#FFFFFF">
      <%
			if(newsArr(11,i)=0) then
				response.Write("否")
			else
				response.Write("<font color=""red"">是</font>")
			end if
			%>
      </td>
			<td bgcolor="#FFFFFF"><div align="center">
			<%
			if(newsArr(6,i)=0) then
				response.Write("否")
			else
				response.Write("<font color=""red"">是</font>")
			end if
			%>
			</div></td>
			<td align="center" bgcolor="#FFFFFF"><a href="member_passreset.asp?id=<%=newsArr(0,i)%>" onClick="return confirm('点击确定，会员密码将重置为123456。')">重置</a></td>
			<td bgcolor="#FFFFFF"><div align="center">
				<%
			if(newsArr(9,i)=0) then
				response.Write("<span style=""color:gray;"">未通过</span>&nbsp;<a href=""member_check.asp?id="&newsArr(0,i)&"&vals=1""><span style=""color:red;"">通过?</span></a>")
			else
				response.Write("<span style=""color:green;"">已通过</span>&nbsp;<a href=""member_check.asp?id="&newsArr(0,i)&"&vals=0"">拒绝?</a>")
			end if
			%>
			</div></td>
			<td bgcolor="#FFFFFF"><div align="center">
      <%
			if(newsArr(10,i)=0) then
				response.Write("<a href=""member_personal.asp?id="&newsArr(1,i)&""">修改</a>")
			else
				response.Write("<a href=""member_enterprise.asp?id="&newsArr(1,i)&""">修改</a>")
			end if
			%>
      <a href="member_show.asp?id=<%=newsArr(1,i)%>">详细</a></div></td>
		</tr>  
		<%
      next
    end if
    %>
    <tr>
      <td height="22" colspan="13" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="35">
            <div align="center">
              <input class=Button type="button" name="chkall" value="全选" onClick="CheckAll(this.form)">
              <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
              管理选项：
              <select name="act">
                <option value="0">请选择操作选项↓</option>
                <option value="del">→批量删除</option>
                <option value="lock">→批量锁定</option>
                <option value="unlock">→取消锁定</option>
                </select>
              <input class=Button type="submit" name="Submit2" value="执行操作" onClick="return confirm('您确定执行该操作吗?')">
            </div></td>
          </tr>
      </table></td>
    </tr>
  <!--按行循环结束------------------------>
</table>
</form>
<table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<form name="form2" method="post" action="" style="margin:0 0 0 0">
      <div align="center">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='?"&paras&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='?"&paras&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
            <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
<input name="page" type="text" size="5" onKeyPress="if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
        </div>
    </form></td>
  </tr>
</table>
<div align="center" style="line-height:25px;">提示：点击会员ID查看会员活跃度情况&nbsp;&nbsp;执行时间：<%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%></div>
<div align="center"></div>
<script language="javascript">
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  {  
		var e = form.elements[i];  
		if (e.name != 'chkall')  
		e.checked = true // form.chkall.checked;  
	}  
} 
 
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name != 'chkall')
		e.checked=!e.checked;
	}
}
</script>
</body>
</html>
<%
call connclose()
%>
             