<!--#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=30
dim i,classid,currentpage,BeginTime,key,bykey,IsLocked,paras,IsCheck,ChannelId
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("IsRem")<>"") then
	IsRem=Cint(request.QueryString("IsRem"))
else
	IsRem=0
end if
if(request.QueryString("ChannelId")<>"") then
	ChannelId=Cint(request.QueryString("ChannelId"))
else
	ChannelId=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&"&ChannelId="&ChannelId&"&IsRem="&IsRem
%>
<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 src="/js/industrys.js" type="text/javascript"></script>
<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="ComName" <%if(bykey="ComName") then response.write("selected=""selected""") end if%>>企业名称</option>
        <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="IsRem" id="IsRem">
        <option value="1" <%if(IsRem=1) then response.write("selected=""selected""") end if%>>推荐</option>
        <option value="0" <%if(IsRem=0) then response.write("selected=""selected""") end if%>>全部</option>
      </select>
      <select name="ChannelId" id="ChannelId">
      <option value="0">不限频道</option>
      <%
			dim sele
			set rs=server.CreateObject("adodb.recordset")
			rs.open "select id,title from catalogs where id<8 or id>10",conn,3,1
			while not rs.eof
				if(ChannelId=rs(0)) then
					sele=" selected"
				else
					sele=""
				end if
				response.Write("<option value="""&rs(0)&""""&sele&">"&rs(1)&"</option>")
				rs.movenext
			wend
			rs.close
			set rs=nothing
			%>
      </select>
      <input type="submit" value="搜索会员">
      <a href="member_batcheck.asp">审核通过所有企业会员</a></div></td>
    </tr>
  </table>
</form>
<form action="member_remove.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="10"><div align="center" class="style1">◆ 会员管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="5%" height="24" bgcolor="#EEEEEE"><div align="center">id</div></td>
    <td width="19%" align="center">企业名称</td>
    <td width="9%" height="24"><div align="center">会员ID</div></td>
    <td width="11%"><div align="center">所属频道</div></td>
    <td width="12%"><div align="center">注册日期</div></td>
    <td width="8%"><div align="center">登录次数</div></td>
    <td width="8%"><div align="center">锁定</div></td>
    <td width="8%" align="center">推荐</td>
    <td width="8%"><div align="center">审核</div></td>
    <td width="12%"><div align="center">详细</div></td>
    </tr>
  <!-- 开始按行循环----------------------->
  <%
  		dim countSql,querySql,newsArr
		set rs=server.createobject("adodb.recordset")
		countSql="select count(*) from t_member,t_member_e where t_member.UserId=t_member_e.UserId and t_member.UserType=1"		
		if(key<>"") then
			Select Case bykey
					Case "ComName"
						countSql=countSql&" and t_member_e.UserName like '%"&key&"%'"
					Case "UserId"
						countSql=countSql&" and t_member.UserId like '%"&key&"%'"
					Case "Email"
						countSql=countSql&" and t_member.Email like '%"&key&"%'"				
					Case Else				
			End Select
		end if
		if(IsLocked>=0) then
			countSql=countSql&" and t_member.IsLocked="&IsLocked
		end if
		if(IsCheck>=0) then
			countSql=countSql&" and t_member.IsCheck="&IsCheck
		end if
		if(ChannelId>0) then
			countSql=countSql&" and t_member.ChannelId="&ChannelId
		end if
		if(IsRem>0) then
			countSql=countSql&" and t_member.UserLevel="&IsRem
		end if
  	rs.open countSql,conn,3,1
		allrec=rs(0)
		rs.close
		set rs=nothing
		'response.Write(countSql)
		totalpage=int((allrec+recpage-1)/recpage)		
		set rs=server.createobject("adodb.recordset")
		'查询sql
		querySql="select top "&recpage&" t.id,t.UserId,t.Email,t.RegIp,t.RegDate,t.LoginNum,t.IsLocked,t.GoldMoney,t.Score,t.IsCheck,t.UserLevel,t.UserType,e.UserName,t.ChannelId,e.Photo from t_member t,t_member_e e where t.id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_member,t_member_e where t_member.UserId=t_member_e.UserId and t_member.UserType=1"
		if(key<>"") then
			Select Case bykey
					Case "ComName"
						querySql=querySql&" and t_member_e.UserName like '%"&key&"%'"
					Case "UserId"
						querySql=querySql&" and t_member.UserId like '%"&key&"%'"
					Case "Email"
						querySql=querySql&" and t_member.Email like '%"&key&"%'"
					Case Else				
			End Select
		end if
		if(IsLocked>=0) then
			querySql=querySql&" and t_member.IsLocked="&IsLocked
		end if
		if(IsCheck>=0) then
			querySql=querySql&" and t_member.IsCheck="&IsCheck
		end if
		if(ChannelId>0) then
			querySql=querySql&" and t_member.ChannelId="&ChannelId
		end if
		if(IsRem>0) then
			querySql=querySql&" and t_member.UserLevel="&IsRem
		end if
		querySql=querySql&" order by t_member.id desc) as t) and t.UserId=e.UserId and t.UserType=1"
		if(key<>"") then
			Select Case bykey
					Case "ComName"
						querySql=querySql&" and e.UserName like '%"&key&"%'"
					Case "UserId"
						querySql=querySql&" and t.UserId like '%"&key&"%'"
					Case "Email"
						querySql=querySql&" and t.Email like '%"&key&"%'"
					Case Else				
			End Select
		end if
		if(IsLocked>=0) then
			querySql=querySql&" and t.IsLocked="&IsLocked
		end if
		if(IsCheck>=0) then
			querySql=querySql&" and t.IsCheck="&IsCheck
		end if
		if(ChannelId>0) then
			querySql=querySql&" and t.ChannelId="&ChannelId
		end if
		if(IsRem>0) then
			querySql=querySql&" and t.UserLevel="&IsRem
		end if
		querySql=querySql&" order by t.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(1,i)%>"></div></td>
			<td height="25" align="left" bgcolor="#FFFFFF">
      <a href="../show.asp?id=<%=newsArr(1,i)%>" target="_blank">
			<%=newsArr(12,i)%>
      <br>
      <img src="<%=newsArr(14,i)%>" width="92" height="92" border="0" />
      </a></td>
			<td height="25" bgcolor="#FFFFFF"><div align="center"><%=newsArr(1,i)%></div></td>
			<td bgcolor="#FFFFFF"><div align="center">
			<%
			select case newsArr(13,i)
				case 1
				 response.Write("新闻频道")
				case 2
					response.Write("汽车频道")
				case 3
					response.Write("旅游频道")
				case 4
					response.Write("分类频道")
				case 5
					response.Write("下载频道")
				case 6
					response.Write("房产频道")
				case 7
					response.Write("婚庆频道")
				case else
					response.Write("默认")
			end select
			%>
      </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 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">
      <%
			if(newsArr(10,i)=0) then
				response.Write("否")
			elseif(newsArr(10,i)=1) then
				response.Write("<font color=""red"">推荐</font>")
			elseif(newsArr(10,i)=2) then
				response.Write("<font color=""green"">置顶</font>")
			end if
			%>
      </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(11,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="10" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="33%" height="35">
            <div align="right">
              <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" onChange="changeAct(this)">
              <option value="0">请选择操作选项↓</option>
              <option value="del">→批量删除</option>
              <option value="remove">→批量移动</option>
              <option value="lock">→批量锁定</option>
              <option value="unlock">→取消锁定</option>
              <option value="rem">→批量推荐</option>
              <option value="unrem">→取消推荐</option>
              <option value="top">→批量置顶</option>
              <option value="untop">→取消置顶</option>
              <option value="channel">→移动频道</option>
              <option value="check">→批量审核</option>
              <option value="uncheck">→取消审核</option>
              </select>
            </div></td>
          <td width="16%" align="center" id="channelcontain" style="display:none;">
          <select name="tochannel" id="tochannel">
					<%
          set rs=server.CreateObject("adodb.recordset")
          rs.open "select id,title from catalogs where id<8 or id>10",conn,3,1
          while not rs.eof
            response.Write("<option value="""&rs(0)&""">"&rs(1)&"</option>")
            rs.movenext
          wend
          rs.close
          set rs=nothing
          %>
          </select>
          </td>
          <td width="39%" style="display:none;" align="center" id="removeContain"><select name="ParentId" id="ParentId" onChange="GetIndustryChilds(this.options[this.selectedIndex].value,0,'IndustryId')">
            <option value="0">一级行业分类</option>
            <script>document.write(GetIndustryFirst(0,''));</script>
          </select>
            <select name="IndustryId" id="IndustryId">
              <option value="0">二级行业分类</option>
            </select>
            <script type="text/javascript">
			GetIndustryChilds(1,0,'IndustryId');
			      </script></td>
          <td width="12%"><input class=Button type="submit" name="Submit2" value="执行操作" onClick="return confirm('您确定执行该操作吗?')"></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>
<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;
	}
}
function changeAct(obj){
	var actType=obj.options[obj.selectedIndex].value;
	if(actType=="remove"){
		document.getElementById("removeContain").style.display="block";
		document.getElementById("channelcontain").style.display="none";
	}	
	else if(actType=="channel"){
		document.getElementById("removeContain").style.display="none";
		document.getElementById("channelcontain").style.display="block";
	}
	else{
		document.getElementById("removeContain").style.display="none";
		document.getElementById("channelcontain").style.display="none";
	}
}
</script>
</body>
</html>
<%
call connclose()
%>
执行时间：<%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%>