<%
'……………………版权信息……………………
'本软件已登记软件著作权，版权归广州恒浪网络科技有限公司所有。所有代码都已经注册登记！
'任何未经许可的修改、复制、提供下载、出售等均属违法侵权行为，请尊重版权，勿以身试法！谢谢！
'请保留此版权信息，请尊重版权，勿以身试法！谢谢！
'网    址：http://www.Howave.Net
'技术论坛：http://BBS.Howave.Net
'联系邮箱：websky888@gmail.com 
'……………………版权信息……………………
%>
<!--#include file="conn/hl_conn.asp" -->
<!--#include file="inc/hl_manage.inc" -->
<!--#include file="inc/hl_function.asp"-->
<!--#include file="inc/UpiConfig.asp"-->
<!--#include file="inc/md5.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">
<!--
.STYLE94 {color: #FF0000}
-->
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>会员管理</title>
<style type="text/css">
<!--
body {
	margin-top: 0px;
	margin-left: 0px;
}

.STYLE92 {font-size: 13px}
.STYLE93 {font-size: 12px}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style>
<script language=Javascript>
function checkAll(e, itemName)
{
  var aa = document.getElementsByName(itemName);
  for (var i=0; i<aa.length; i++)
   aa[i].checked = e.checked;
}
function checkItem(e, allName)
{
  var all = document.getElementsByName(allName)[0];
  if(!e.checked) all.checked = false;
  else
  {
    var aa = document.getElementsByName(e.name);
    for (var i=0; i<aa.length; i++)
     if(!aa[i].checked) return;
    all.checked = true;
  }
}
function checkall(all)//用于判断全选记录的函数
{
  var a = document.getElementsByName("answer");
  for (var i=0; i<a.length; i++) a.checked = all.checked;
}
</script>


</head>

<body>

<table width="808" border="0" align="center" cellpadding="0" cellspacing="0" background="img/r3_c3.jpg">
  <tr>
    <td width="59" height="24">&nbsp;</td>
    <td width="587" valign="bottom"><span class="STYLE92"><a href="Admin_user.asp" target="_self" class="STYLE92">会员管理</a></span></td>
    <td width="174" valign="bottom"><div align="center" class="STYLE92"><a href="user_Add.asp">添加用户</a></div></td>
  </tr>
  <tr>
    <td height="7"></td>
    <td colspan="2"></td>
  </tr>
</table>
<%
Dim AdminName,Md5Info,Interface_Action,UserEmail,UserQuestion,UserPassword,Sex,UserAnswer,U_Pass
UserID=ReplaceBadChar(replace(request("UserID"),"'",""))
ComeUrl = "Admin_user.asp"
Action=ReplaceBadChar(replace(request("action"),"'",""))

if Action="" then 
  Call Main()
  else
  Select Case Action
  Case "Del"
     Call Del()
  Case "Modify"
     Call Modify()
  Case "Show"
     Call Show()
  Case "Search"
     Call Search()
  Case "AddUser"
     Call AddUser()
 Case "DelMembers"
     Call DelMembers()
  end Select
end if
%>
<%Sub Main()%>
  <form id="form2" name="form2" method="post" action="Admin_user.asp">
  <input type="hidden" name="action" value="DelMembers" />
  <table width="808" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
    <td width="8"></td>
    <td width="810" align="left"><table width="808" style="BORDER-COLLAPSE: collapse" bordercolor="#A0D3FE" cellspacing="0" cellpadding="2"  align="center" border="1" bgcolor="#EEF9FD">
      <tr>
        <td width="47" height="31" align="center"><span class="STYLE93">选中</span></td>
        <td width="120" align="center"><span class="STYLE93">用户名</span></td>
        <td width="93" align="center"><span class="STYLE93">真实姓名</span></td>
        <td width="113" align="center"><span class="STYLE93">注册时间</span></td>
        <td width="134" align="center"><span class="STYLE93">最后登录IP</span></td>
        <td width="111" align="center"><span class="STYLE93">最后登录时间</span></td>
        <td width="67" align="center"><span class="STYLE93">登录次数</span></td>
        <td width="135" align="center"><span class="STYLE93">操作</span></td>
      </tr>
	  <%   MaxPerPage=20
	  set rs=server.CreateObject("adodb.recordset")
	      sql="select * from hl_user order by id desc"
		  rs.open sql,conn,1,1
          rs.PageSize=MaxPerPage
		  maxpage=rs.recordcount \ rs.pagesize+1
          pagecount=rs.PageCount 
          page=int(request.QueryString ("page"))
           if page<=0 then page=1
           if request.QueryString("page")="" then page=1
           rs.AbsolutePage=page 
           i=0
		  do while not rs.eof and i<rs.PageSize
		  i=i+1
		  response.Write "<tr onmouseover=""this.style.backgroundColor='#BFDFFF'"" onmouseout=""this.style.backgroundColor=''"" align='middle'>"
		  response.Write "<td align='center'><input type=checkbox name='delid' value='"&rs("username")&"'></td>"
		  response.Write "<td align='center'><span class='STYLE93'>"&rs("username")&"</span></td>"
		  response.Write "<td align='center'><span class='STYLE93'>"&rs("truename")&"</span></td>"
		  response.Write "<td align='center' ><span class='STYLE93'>"&rs("adddate")&"</span></td>"
		  response.Write "<td align='center' ><span class='STYLE93'>"&rs("loginip")&"</span></td>"
		  response.Write "<td align='center' ><span class='STYLE93'>"&rs("lastlogin")&"</span></td>"
		  response.Write "<td align='center' ><span class='STYLE93'>"&rs("logins")&"</span></td>"
		  response.Write "<td align='center' ><span class='STYLE93'>&nbsp;<a href='Admin_user.asp?action=Show&UserID="&rs("id")&"' target='_self'>查看</a>&nbsp;&nbsp;</span></td>"
		  response.Write "</tr>"
		  rs.movenext
		  loop
		  
%>
          <tr>
            <td width="20%" height="30" valign="middle" colspan="8"><input type="checkbox" name="mmAll" onClick="checkAll(this, 'delid')"/>
              <span class="STYLE93"> 会员全选</span>          
              <span class="STYLE93">共 <strong><%=rs.recordcount%></strong>个会员&nbsp;
                <a href="Admin_user.asp?page=1" target="_self">首页</a>&nbsp;&nbsp;
                <% if (page-1)>0 then%>
                <a href="Admin_user.asp?page=<%=page-1%>" target="_self">上一页</a>&nbsp;&nbsp;
                <% end if
		      if page<maxpage then
			%>
                <a href="Admin_user.asp?page=<%=page+1%>" target="_self">下一页</a>&nbsp;&nbsp;
                <% end if%>
                <a href="Admin_User.asp?page=<%=maxpage%>" target="_self">尾页</a>&nbsp;&nbsp;页次:<strong><%=page&"/"&maxpage%></strong>页&nbsp;&nbsp;
                <select onChange="javascript:window.location='Admin_User.asp?MaxPerPage=<%=maxpage%>&page='+this.options[this.selectedIndex].value;" size="1" name="page">
                  <%
			    for iNum=1 to maxpage
				  if page=iNum then
				   response.Write "<option value='"&iNum&"' selected='selected'>第"&iNum&"页</option>"
				   else
			       response.Write "<option value='"&iNum&"' >第"&iNum&"页</option>"
				  end if
				next
			 rs.close
			 set rs=nothing
			 %>
            </select></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="del" value="删除" onClick="return confirm('确定要删除所选会员吗？');" /></td></tr>
       </table>
	   </form>
	   <br />
	   <table width="808" height="25" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
         <tr><form action="Admin_user.asp?action=Search" method="post" name="form1" class="STYLE92" id="form1">
           <td height="25">
		   
             <span class="STYLE92">会员查询</span>&nbsp;<input type="text" name="SearchStr" />
             <label><span class="STYLE92">查询类型</span>
             <select name="SearchType">
               <option value="accurate">精确</option>
               <option value="fuzzy">模糊</option>
             </select>
             </label>
             <input type="submit" name="Submit" value="搜索" />
             <span class="STYLE92">(当查询记录数比较多时请使用精确查询)           </span></td>
         </form>
         </tr>
       </table>
<%
end Sub

Sub Show()'======================显示会员信息
      set rs=server.CreateObject("adodb.recordset")
	      sql="select * from hl_user where id="&UserID
		  rs.open sql,conn,1,1
%>
	   <table width="808" style="BORDER-COLLAPSE: collapse" bordercolor="#A0D3FE" cellspacing="0" cellpadding="2"  align="center" border="1" bgcolor="#EEF9FD">
         <form action="Admin_user.asp?action=Modify" method="post" name="userinformation">
		 <input type="hidden" name="UserID" value="<%=UserID%>" />
           <tr align="middle">
             <td colspan="3" height="22"><p style="line-height: 150%;font-size:12px"><strong>查 看 会 员 详 细 信 息</strong></p></td>
             <td height="22" colspan="3"><span style="line-height: 150%;font-size:12px"><strong>通 行 证 信 息</strong></span></td>
           </tr>
           <tr>
             <td width="23%" class="STYLE93">用 户 名：
             <input  readonly="readonly" size="18" value="<%=rs("username")%>" name="username" /></td>
             <td width="26%" class="STYLE93">真实姓名：
             <input type=text size="18" name="truename"  value="<%=rs("truename")%>"/></td>
             <td width="20%" class="STYLE93">昵称：
             <input type=text size="18" name="nickname"  value="<%=rs("nickname")%>"/></td>
             <td width="31%" class="STYLE93">用户密码：
             <input name="userpassword" type=text id="userpassword" size="16" />
             <span class="STYLE94">*不修改请留空</span></td>
           </tr>
           <tr>
             <td width="23%" class="STYLE93">性别
               <label>
               <input type="radio" name="sex" value="1" <%if rs("sex")=1 then%>checked<%end if%>/>
              男  
              <input type="radio" name="sex" value="2" <%if rs("sex")=2 then%>checked<%end if%>/>
              女
               <input type="radio" name="sex" value="3" <%if rs("sex")=3 then%>checked<%end if%>/>
             保密             </label></td>
             <td class="STYLE93">单位名称：
               <input type=text size="18" name="company"  value="<%=rs("company")%>"/></td>
             <td class="STYLE93">最后登陆时间：
             <input type=text size="14" name="lastlogin"  value="<%=rs("lastlogin")%>"/></td>
             <td class="STYLE93">提示问题：
             <input name="userquestion" type=text id="userquestion" value="<%=rs("userquestion")%>" size="16"/></td>
           </tr>
           <tr>
             <td colspan="2" class="STYLE93">联系地址：
               <input type=text size="40" name="address"  value="<%=rs("address")%>"/></td>
             <td class="STYLE93">邮政编码：
               <input type=text size="18" name="post" value="<%=rs("post")%>"/></td>
             <td class="STYLE93">提示答案：
               <input name="useranswer" type="text" id="useranswer" size="16"/>
               <span class="STYLE94">*不修改请留空</span></td>
           </tr>
           <tr>
             <td class="STYLE93">办公电话：
               <input type=text size="18" name="companyphone" value="<%=rs("companyphone")%>"/></td>
             <td class="STYLE93">家庭电话：
               <input type=text size="18" name="homephone" value="<%=rs("homephone")%>"/></td>
             <td class="STYLE93">传真号码：
               <input type=text size="18" name="fax" value="<%=rs("fax")%>"/></td>
             <td class="STYLE93"> E-Mail ：  
               <input name="useremail" type="text" id="useremail" value="<%=rs("useremail")%>" size="16"/>
*</td>
           </tr>
           <tr>
             <td class="STYLE93">主页地址：
               <input type=text size="18" name="homepage" value="<%=rs("homepage")%>"/></td>
             <td class="STYLE93">手机号码：
             <input type=text size="18" name="mobilephone" value="<%=rs("mobilephone")%>"/></td>
             <td class="STYLE93">ＱＱ号码：
               <input name="qq" value="<%=rs("qq")%>" size="18" type=text /></td>
             <td class="STYLE93">&nbsp;</td>
           </tr>
           <tr>
             <td class="STYLE93">注册日期：             
             <input name="adddate" id="adddate" value="<%=rs("adddate")%>" size="18" type=text /></td>
             <td class="STYLE93">MSN 号码：
             <input type=text size="18" name="msn" value="<%=rs("msn")%>"/></td>
             <td class="STYLE93">&nbsp;</td>
             <td class="STYLE93">&nbsp;</td>
           </tr>
           <tr align="middle">
             <td height="46" colspan="6" align="center"><label>
             <input type="button" name="Submit3" value="返回上一页" onClick="javascript:history.go(-1);"/>
             </label>
             <input type="submit" value="保存会员信息" name="Submit2" />
                 <input onClick="window.location.href='Admin_User.asp?Action=ModifyPurview&amp;UserID=114'" type="hidden" value="修改会员权限" name="Submit2" />
                 <input onClick="if(confirm('确定要删除此会员吗？')){window.location.href='Admin_User.asp?Action=Del&amp;UserID=<%=rs("id")%>';}" type="button" value="删除会员" name="Submit2" />
                 <input onClick="if(confirm('确定要锁定此会员吗？')){window.location.href='Admin_User.asp?Action=Lock&amp;UserID=114';}" type="hidden" value="锁定会员" name="Submit2" />
             <br /></td>
           </tr>
         </form>
      </table></td>
  </tr>
<%rs.close
 set rs=nothing
end Sub%>

<%
Sub Search()
%>
<table width="808" style="BORDER-COLLAPSE: collapse" bordercolor="#A0D3FE" cellspacing="0" cellpadding="2"  align="center" border="1" bgcolor="#EEF9FD">
      <tr>
        <td width="47" height="31" align="center"><span class="STYLE93">选中</span></td>
        <td width="120" align="center"><span class="STYLE93">用户名</span></td>
        <td width="93" align="center"><span class="STYLE93">真实姓名</span></td>
        <td width="113" align="center"><span class="STYLE93">注册时间</span></td>
        <td width="134" align="center"><span class="STYLE93">最后登录IP</span></td>
        <td width="111" align="center"><span class="STYLE93">最后登录时间</span></td>
        <td width="67" align="center"><span class="STYLE93">登录次数</span></td>
        <td width="135" align="center"><span class="STYLE93">操作</span></td>
      </tr>
<%
Set rs_sh=server.CreateObject("adodb.recordset")
       IF Request("SearchType")="accurate" Then
           rs_sh.open "select * from hl_user where username='"&Trim(request.form("SearchStr"))&"'",conn,1,1
       Else 
           rs_sh.open "select id,username,truename,adddate,loginip,lastlogin,logins from hl_user where  username like '%"&Trim(request.form("SearchStr"))&"%'",conn,1,1
       End If 
do while not rs_sh.eof
 response.Write "<tr onmouseover=""this.style.backgroundColor='#BFDFFF'"" onmouseout=""this.style.backgroundColor=''"" align='middle'>"
response.Write "<td align='center'><input type=checkbox name=select value='"&rs_sh("id")&"'></td>"
response.Write "<td align='center'><span class='STYLE93'>"&rs_sh("username")&"</span></td>"
response.Write "<td align='center'><span class='STYLE93'>"&rs_sh("truename")&"</span></td>"
response.Write "<td align='center' ><span class='STYLE93'>"&rs_sh("adddate")&"</span></td>"
response.Write "<td align='center' ><span class='STYLE93'>"&rs_sh("loginip")&"</span></td>"
response.Write "<td align='center' ><span class='STYLE93'>"&rs_sh("lastlogin")&"</span></td>"
response.Write "<td align='center' ><span class='STYLE93'>"&rs_sh("logins")&"</span></td>"
response.Write "<td align='center' ><span class='STYLE93'>&nbsp;<a href='Admin_user.asp?action=Show&UserID="&rs_sh("id")&"' target='_self'>查看</a>&nbsp;<a href='Admin_user.asp?action=Del&UserID="&rs_sh("id")&"' target='_self' onclick=""return confirm('确定要删除此会员吗？');"">删除</a></span></td>"
response.Write "</tr>"
rs_sh.movenext
loop
response.Write "</table>"
rs_sh.close
set rs_sh=nothing
End Sub

Sub Modify()
       set rsReg=server.CreateObject("adodb.recordset")
        sql_Reg="select * from hl_user where id="&UserID
		rsReg.open sql_Reg,conn,1,3
		U_Pass=rsReg("UserPassword")
       	        rsReg("truename") = Trim(Request("truename"))
		rsReg("sex") = Trim(Request("sex"))
		rsReg("company") = Trim(Request("company"))
		rsReg("address") = Trim(Request("address"))
		rsReg("companyphone") = Trim(Request("companyphone"))
		rsReg("homephone") = Trim(Request("homephone"))
		rsReg("homepage") = Trim(Request("homepage"))
		rsReg("mobilephone") = Trim(Request("mobilephone"))
		rsReg("nickname") = Trim(Request("nickname"))
		rsReg("post") = Trim(Request("post"))
		rsReg("fax") = Trim(Request("fax"))
		rsReg("qq") = Trim(Request("qq"))
		rsReg("msn") = Trim(Request("msn"))
		rsReg("adddate") = Trim(Request("adddate"))
		rsReg("lastlogin") = Trim(Request("lastlogin"))
		rsReg("userquestion") = Trim(Request("userquestion"))
		if Trim(Request("useranswer"))<>"" then rsReg("useranswer") = Trim(Request("useranswer"))
		if Trim(Request("userpassword"))<>"" then rsReg("userpassword") = Md5(Replace(Trim(Request("userpassword")),"'",""),32)
		rsReg("useremail") = Trim(Request("useremail"))
		rsReg.update
		rsReg.close
		set rsReg=nothing
		AdminName=Trim(Request("username"))		
		UserEmail=Trim(Request("useremail"))
		UserQuestion=Trim(Request("userquestion"))
		UserPassword=U_Pass
		Interface_Action="ModifyInfo"
		if Trim(Request("useranswer"))<>"" then  UserAnswer=Md5(Trim(Request("useranswer")),32)		
		Call Interface()
		
		if Trim(Request("userpassword"))<>"" then 
			Interface_Action="ModifyPsw"
			UserPassword=Md5(Replace(Trim(Request("userpassword")),"'",""),32)
			Call Interface()
		End If
		
		
End Sub
Sub Del()
    set rs=server.CreateObject("adodb.recordset")
	sql_D="select * from hl_user where id="&UserID
	
	rs.open sql_D,conn,1,1
	AdminName=rs("username")
	UserPassword=rs("userpassword")
	rs.close
	set rs=nothing
    Interface_Action="DelUser"
	Call Interface()
	 set rs_del=server.CreateObject("adodb.recordset")
	 sql_del="delete * from hl_user where id="&UserID
	 rs_del.open sql_del,conn,1,3	
	 rs_del.close
	 set rs_del=nothing
end sub

Sub DelMembers()
DleName=Request.form("delid")
DleoneName = Split(DleName, ",")
str=""
For j = 0 To UBound(DleoneName)
str=str+"username='"&Trim(DleoneName(j))&"' or "
Next
str=str+"r"
str=replace(str,"or r","")
	Del_Member_sql="delete from hl_user where "&str
	AdminName=DleName
	Interface_Action="DelUser"
	Call Interface()
	conn.Execute Del_Member_sql
End Sub
Sub Interface()
            
			Md5Info=MD5(AdminName & SecurityKey, 32)
			Response.Write "<br><div align='center'><span style='font-size:9pt'>正在更新通行证资料，请稍等...</span></div>" & vbCrLf
			Response.Write "<meta http-equiv=""refresh"" content=""" & RefreshTime & ";URL="&ComeUrl&""" />"&vbCrLf
			If IsNull(SecurityKey) = False And SecurityKey <> "" And IsNull(arrUpiUrls) = False And arrUpiUrls <> "" Then
            HLUpi = Split(arrUpiUrls, "|")
			For iNums = 0 To UBound(HLUpi)
			Response.Write "<script src=""" & HLUpi(iNums) & "?action="&Interface_Action&"&Md5Info=" & Md5Info & "&name=" & AdminName & "&pass="&UserPassword&"&email=" &UserEmail& "&question="&UserQuestion&"&answer="&UserAnswer&"&oldpass="&U_Pass&"""></script>"& vbCrLf
			
			Next
            End If
            			
End Sub
%>
</body>
</html>
