<!-- #include file="conn.asp" -->
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<script language="JavaScript">
<!--
function  check() {
if(document.searchid.action[0].checked==false && document.searchid.action[1].checked==false && document.searchid.action[2].checked==false)
		{
			alert("请选择您执行的操作!");
			document.searchid.action[0].focus();
			return false;
		}
 else
	document.searchid.submit();
}// -->
</script>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<div align="center">
<table width="90%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#000063">
                        <form name="form1" method="post" action="">
                          <tr align="center" bgcolor="#FFFFDD">
                            <td bgcolor="#FEF49C">搜索</td>
                            <td bgcolor="#FFFFDD"><input name="key" type="text" value="<%=request("key")%>" size="40"></td>
                            <td bgcolor="#FFFFDD"><input name="Submit" type="submit" class="input2" value="提交"></td>
                            <td bgcolor="#FFF79C">&nbsp;</td>
                            <td bgcolor="#FFF79C">&nbsp;</td>
                          </tr>
                        </form>
  </table>                  
<br>
  <table width="90%"  border="0" cellpadding="1" cellspacing="1" bgcolor="#000066">
  <form name="searchid" method="post" action="">
<tr align="center" bgcolor="#FFCC33">
                      <td width="6%" bgcolor="#FFCC33">编号</td>
                      <td bgcolor="#FFCC33"> 单位名称</td>
                      <td width="20%"> 联系方式</td>
                      <td width="14%" bgcolor="#FFCC33"> 用户名</td>
                      <td width="14%" bgcolor="#FFCC33">密码</td>
                      <td width="12%" bgcolor="#FFCC33">登记日期</td>
                      <td width="5%"><script language=javascript>  
function  selectAll(checkBoxName){  
           var  elms  =  document.getElementsByName(checkBoxName);  
           if  (elms.length<1)  return;  
           var  allChecked  =  true;  
           for  (var  i=0;i<elms.length;i++)  
                       if  (elms[i].type=="checkbox")  
                                   allChecked  &=  elms[i].checked;  
           for  (var  i=0;i<elms.length;i++)  
                       if  (elms[i].type=="checkbox"){  
                                               elms[i].checked  =  !allChecked;  
                                               if  (elms[i].onClick)  elms[i].onClick();  
                       }  
}   
function  mm(o)  
{  
     var  a  =  document.getElementsByName("selAnnounce");  
     for  (var  i=0;  i<a.length;  i++){  
         a[i].checked  =  o.checked;  
     }  
       
}  
</script>
                        <input name="checkbox"  type=checkbox  onClick="mm(this)"  value="Check  All"></td>
</tr>
                  <%
page=request.querystring("page")
key=request("key")
DIM totalPut
DIM CurrentPage
DIM TotalPages
DIM i,j
const MaxPerPage=10

if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if

if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
select case request.form("action")
case "del_com"
call del_com(id)
case "pas_com"
call pas_com(id)
case "vip_com"
call vip_com(id)
end select
next
else
select case request.form("action")
case "del_com"
call del_com(clng(idlist))
case "pas_com"
call pas_com(clng(idlist))
case "vip_com"
call vip_com(clng(idlist))
end select
end if
end if

dim rs
dim sql
pass=cstr(request.QueryString("pass"))
if pass="2" or pass="False" then pass=False else pass=True end if
vips=cstr(request.QueryString("vips"))
if vips="2" or vips="True" then vips=True else vips=False end if
set rs=server.createobject("adodb.recordset")
if pass=False then
sql = "select * from com_user where pas=False and company like '%" & key & "%' order by idate desc"
elseif vips=True then
sql = "select * from com_user where vip=True and company like '%" & key & "%' order by idate desc"
else
sql = "select * from com_user where pas=True and vip=False and company like '%" & key & "%' order by idate desc"
end if
rs.open sql,conn,1,1 
if rs.eof and rs.bof then 
response.write "<p align='center'>对不起，没有您要查询的信息</p>" 
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 totalput,MaxPerPage
showpage totalput,MaxPerPage,""
else 
if (currentPage-1)*MaxPerPage<totalPut then 
rs.move (currentPage-1)*MaxPerPage 
dim bookmark 
bookmark=rs.bookmark 
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,""
else 
currentPage=1 
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,""
end if 
end if 
rs.close 
end if 
set rs=nothing
sub showContent (totalput,MaxPerPage)
do while not rs.eof%>

                    <tr class="hand" align="center" bgcolor="#FDFEF5" onmouseover="this.style.backgroundColor='eff7ff'" onmouseout="this.style.backgroundColor='#FDFEF5'">
                      <td bgcolor="#FDFEF5"><%=rs("com_id")%></td>
                      <td><%=rs("company")%></td>
                      <td><%=rs("tel")%></td>
                      <td><%=rs("com_name")%></td>
                      <td><%=rs("com_pass")%></td>
                      <td><%=rs("idate")%></td>
                      <td><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("com_id"))%>'></td>
                    </tr>
                  <% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%> <tr bgcolor="#FFCC33">
                      <td align="center">操作</td>
                      <td colspan="6" align="right" class="blue">
						<input type="radio" name="action" value="pas_com">
                        审核
						<input type="radio" name="action" value="vip_com">
                        VIP
						<input type="radio" name="action" value="del_com">
                        删除&nbsp;
<input name="button" type="button" onClick="check()" value='提交'>&nbsp;</td>
                    </tr>
 </form>
</table>
<%
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 
if CurrentPage<2 then 
response.write "<table border=0 width=80% cellspacing=0 cellpadding=0>" 
response.write "<tr height=50>"
response.write "<td>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条信息</td>" 
response.write "<td align=right>"
response.write "【最前页】【上一页】" 
else 
response.write "<table border=0 width=90% cellspacing=0 cellpadding=0>"
response.write "<tr height=30>"
response.write "<td>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条信息</td>"
response.write "<td align=right>"
response.write "【<a href="&filename&"?page=1&key="&key&"&pass="&pass&"&vips="&vips&">最前页</a>】" 
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&key="&key&"&pass="&pass&"&vips="&vips&">上一页</a>】" 
end if 
if n-currentpage<1 then 
response.write "【下一页】【最后页】" 
else 
response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&key="&key&"&pass="&pass&"&vips="&vips&">" 
response.write "下一页</a>】【<a href="&filename&"?page="&n&"&key="&key&"&pass="&pass&"&vips="&vips&">最后页</a>】" 
end if 
response.write "</td>"
response.write "</tr>"
response.write "</table>"
response.write "</form>"
end function
%>
</div>
</body>
</html>
<%
sub del_com(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="delete from [com_user] where com_id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub 

sub pas_com(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="update com_user set pas=abs(abs(cint(pas))-1) where com_id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "审 核 失 败 !<br>"
end if
End sub 

sub vip_com(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="update com_user set vip=abs(abs(cint(vip))-1) where com_id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "设 置 VIP 失 败 !<br>"
end if
End sub 
%>