<!--#include file="pysjzx_conn.asp"-->
<!--#include file="session.asp"-->
<%
selectid=request("selectid")
if selectid<>"" then
conn.execute "delete from pysjzx_user where userid in ("&selectid&")"
response.Write "<script language='javascript'>alert('删除成功！');window.location.href='managecompany.asp?action=all';</script>"
response.End
end if
'//升级为高级会员
high=request("high")
if high<>"" then
set rs=server.createobject("adodb.recordset") 
sql="select * from pysjzx_user where userid="&high
rs.open sql,conn,1,3
rs("reglx")= 2 
rs.update
response.Redirect "managecompany.asp?action=all"
end if
'//降为普通会员
low=request("low")
if low<>"" then
set rs=server.createobject("adodb.recordset") 
sql="select * from pysjzx_user where userid="&low
rs.open sql,conn,1,3
rs("reglx")= 1
rs.update
response.Redirect "managecompany.asp?action=all"
end if

%>
<html>
<head>
<title>用户管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<script language=javascript>
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script>
</head>
<body>
			  <%	  dim namekey,checkbox,action
		  action=request.QueryString("action")
		  checkbox=request("checkbox")
		  namekey=request("namekey")%>
				<div align="center">
<table cellpadding="3" cellspacing="1" border="1" width="100%" class="tableBorder" bordercolor="#C0C0C0" style="border-collapse: collapse">
  <tr align="center"> 
    <td  class="forumRowHighlight" width=25% bgcolor="#F7F7F7"> <a href="managecompany.asp?action=all"><%if action="all" then %><font  color="#FF0000"><% end if%>所有企业会员</a></font>&nbsp;<%
    set rs=server.createobject("adodb.recordset") 
    	rs.open "select * from [pysjzx_user] where sort=2   ",conn,1,1
    	response.write rs.recordcount
    	rs.close
    %></td>
    <td  class="forumRowHighlight"  width=25% bgcolor="#F7F7F7"><a href="managecompany.asp?action=pass"><%if action="pass" then %><font  color="#FF0000"><% end if%>高级企业会员</font></a>&nbsp;<%
    set rs=server.createobject("adodb.recordset") 
    	rs.open "select * from [pysjzx_user] where sort=2 and reglx=2  ",conn,1,1
    	response.write rs.recordcount
    	rs.close
    %></td>
    <td  class="forumRowHighlight"  width=25% bgcolor="#F7F7F7"><a href="managecompany.asp?action=wait"><%if action="wait" then %><font  color="#FF0000"><% end if%>普通企业会员</font></a>&nbsp;<%
    set rs=server.createobject("adodb.recordset") 
    	rs.open "select * from [pysjzx_user] where sort=2 and reglx=1",conn,1,1
    	response.write rs.recordcount
    	rs.close
    %></td>
  </tr>
</table>	
				</div>
<%'开始分页
				Const MaxPerPage=20 
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
    				if Not isempty(request("page")) then
      				currentPage=Cint(request("page"))
   				else
      				currentPage=1
   				end if 
				
	
		  if namekey="" then namekey=request.QueryString("namekey")
		  if checkbox="" then checkbox=request.querystring("checkbox")
		 '//
		 set rs=server.CreateObject("adodb.recordset")
		 if namekey="" then
		  select case action
		  case "all"
		 	rs.open "select * from [pysjzx_user] where sort=2  order by adddate desc ",conn,1,1
		  case "wait"
		 	rs.open "select * from [pysjzx_user] where sort=2 and reglx=1 order by adddate desc ",conn,1,1
		  case "pass"
		 	rs.open "select * from [pysjzx_user] where sort=2 and reglx=2 order by adddate desc ",conn,1,1
		  end select
		  else
		  if checkbox=1 then
		  rs.open "select * from [pysjzx_user] where sort=2 and company like '%"&namekey&"%' ",conn,1,1
		  else
		  rs.open "select * from [pysjzx_user] where sort=2 and company='"&namekey&"' ",conn,1,1
		  end if
		  end if
		  
				if err.number<>0 then

				end if
  				if rs.eof then
 %><br>
  			<div align="center">
  <table cellpadding="3" cellspacing="1" border="1" width="100%" class="tableBorder" style="border-collapse: collapse" bordercolor="#C0C0C0">
    <tr> 
      <th class="tableHeaderText" colspan=5 bgcolor="#E8F1FF">企业会员管理</th>
    </tr>
    <tr> 
      <td  class="forumRowHighlight" width="25%" bgcolor="#F7F7F7"> <div align="center">登录名</div></td>
      <td  class="forumRowHighlight" width="24%" bgcolor="#F7F7F7"> <div align="center">
		公司名称</div></td>
      <td  class="forumRowHighlight" width="19%" bgcolor="#F7F7F7"> <div align="center">注册时间</div></td>
      <td  class="forumRowHighlight" width="15%" bgcolor="#F7F7F7"> <div align="center">
		会员级别</div></td>
      <td  class="forumRowHighlight" width="12%" bgcolor="#F7F7F7"> <div align="center">操作</div></td>
    </tr>

    <tr> 
      <td  class="forumRowHighlight" colspan="5" bgcolor="#F7F7F7">没有数据</td>
    </tr>
   
    <tr> 
      <td colspan=5 align="center"  class="forumRowHighlight" bgcolor="#F7F7F7"> 
		　</td>
    </tr>
  </table></div>
<%
   				else
	  				totalPut=rs.recordcount

      				if currentpage<1 then
          				currentpage=1
      				end if

      				if (currentpage-1)*MaxPerPage>totalput then
	   					if (totalPut mod MaxPerPage)=0 then
	     					currentpage= totalPut \ MaxPerPage
	   					else
	      					currentpage= totalPut \ MaxPerPage + 1
	   					end if
      				end if

       				if currentPage=1 then
            			showContent
            			showpage totalput,MaxPerPage,"managecompany.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"managecompany.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"managecompany.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0

			%><br>

  <div align="center">

  <table cellpadding="3" cellspacing="1" border="1" width="100%" class="tableBorder" style="border-collapse: collapse" bordercolor="#C0C0C0">
  <form name="form1" method="post" action="">
    <tr> 
      <th class="tableHeaderText" colspan=5 bgcolor="#E8F1FF">企业会员管理</th>
    </tr>
    <tr> 
      <td  class="forumRowHighlight" width="21%" bgcolor="#F7F7F7"> <div align="center">登录名</div></td>
      <td  class="forumRowHighlight" width="21%" bgcolor="#F7F7F7"> <div align="center">
		公司名称</div></td>
      <td  class="forumRowHighlight" width="16%" bgcolor="#F7F7F7"> <div align="center">注册时间</div></td>
      <td  class="forumRowHighlight" width="13%" bgcolor="#F7F7F7"> 
		<p align="center">会员级别</td>
      <td  class="forumRowHighlight" width="10%" bgcolor="#F7F7F7"> <div align="center">操作</div></td>
    </tr>
    <%do while not rs.eof%>
    <tr> 
      <td  class="forumRowHighlight" bgcolor="#F7F7F7"> <div align="center"><a href=listcompany.asp?id=<%=rs("userid")%>><%if rs("reglx")=2 then%><font color="#FF0000"><%end if%><%=trim(rs("username"))%></font></a></div></td>
      <td  class="forumRowHighlight" bgcolor="#F7F7F7"> <div align="center"><%if rs("reglx")=2 then%><font color="#FF0000"><%end if%><%=trim(rs("company"))%></font></div></td>
      <td  class="forumRowHighlight" bgcolor="#F7F7F7"> <div align="center"><%if rs("reglx")=2 then%><font color="#FF0000"><%end if%><%=rs("adddate")%></div></td>
      <td  class="forumRowHighlight" bgcolor="#F7F7F7"> 
		<p align="center"><%if rs("reglx")=2 then%><a href="managecompany.asp?low=<%=rs("userid")%>"  title="点击成为可成普通会员"><font color="#FF0000">高级会员</a></font><%end if%><%if rs("reglx")=1 then%><a href="managecompany.asp?high=<%=rs("userid")%>" title="点击成为可成高级会员">普通</a><%end if%></td>
      <td  class="forumRowHighlight" bgcolor="#F7F7F7"> <div align="center"> 
          <input name="selectid" type="checkbox" id="selectid" value="<%=rs("userid")%>" class="input1">
                  </div></td>
    </tr>
    <%i=i+1
			if i>=MaxPerPage then Exit Do
			rs.movenext
		  loop%>
    <tr> 
      <td colspan=5 align="center"  class="forumRowHighlight" bgcolor="#F7F7F7"> <input class=button type="submit" name="Submit" value="删除所选信息" onClick="return confirm('删除后不可恢复,您确定要删除吗？')">
        全选 
        <input type="checkbox" name="checkbox2" value="Check All" onClick="mm()" class="input1"> 
      </td>
    </tr>
  </table>
</div>
</form>
<%  
				End Sub   
  
					Function showpage(totalnumber,maxperpage,filename)  
  				Dim n
  				
				If totalnumber Mod maxperpage=0 Then  
					n= totalnumber \ maxperpage  
				Else
					n= totalnumber \ maxperpage+1  
				End If
				
				Response.Write "<p align='center' class='contents'> "  
				If CurrentPage<2 Then  
					Response.Write "<font class='contents'>首页 上一页</font> "  
				Else  
					Response.Write "<a href="&filename&"?action="&action&"&page=1&checkbox="&checkbox&"&namekey="&namekey&"action="&action&" class='contents'>首页</a> "  
					Response.Write "<a href="&filename&"?action="&action&"&page="&CurrentPage-1&"&checkbox="&checkbox&"&namekey="&namekey&"action="&action&" class='contents'>上一页</a> "  
				End If
				
				If n-currentpage<1 Then  
					Response.Write "<font class='contents'>下一页 尾页</font>"  
				Else  
					Response.Write "<a href="&filename&"?action="&action&"&page="&(CurrentPage+1)&"&checkbox="&checkbox&"&namekey="&namekey&"action="&action&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?action="&action&"&page="&n&"&checkbox="&checkbox&"&namekey="&namekey&"action="&action&" class='contents'>尾页</a>"  
				End If  
					Response.Write "<font class='contents'> 页次：</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
					Response.Write "<font class='contents'> 共有"&totalnumber&"名注册用户 " 
				End Function  
			%>
<br>
<div align="center">
<table cellpadding="3" cellspacing="1" border="1" width="100%" class="tableBorder" style="border-collapse: collapse" bordercolor="#C0C0C0">
  <form name="form2" method="post" action="managecompany.asp?action=select">
    
    <tr> 
      <th class="tableHeaderText" colspan=6 bgcolor="#E8F1FF">查找会员</th>
    </tr>
    <tr> 
      <td class="forumRowHighlight" align=center bgcolor="#F7F7F7"> 按登公司名称查找: 
        <input name="namekey" type="text" id="namekey" size="12"> &nbsp; <input name="checkbox" type="checkbox" id="checkbox" value="1" checked class="input1">
        模糊查询 
        <input class=button type="submit" name="Submit2" value="查 询"> </td>
    </tr>
  </form>
</table>
				</div>
<br>
</body>
</html> 
  