<!-- #include file="../conn.asp" -->
<!-- #include file="../cls_main.asp" -->
<!-- #include file="../cls_Mesky_showPage.asp" -->
<!-- #include file="../cls_md5.asp" -->
<% MyDbPath = "../"
dim obj
set obj = New admin_user
	obj.AspInit()
set obj = nothing

Class admin_user

	Private Mesky, BatchID, sID, sResName, sToolTip
	Private Sub Class_Initialize()
		Set Mesky = New Cls_Main
	End Sub
	Private Sub Class_Terminate()
		Set Mesky = Nothing
	End Sub
	Public Sub AspInit()
		Response.Write "<HTML><HEAD><TITLE>用户管理</TITLE>" & vbCrLf
		Response.Write "<META http-equiv=Content-Type content=""text/html; charset=gb2312"">" & vbCrLf
		Response.Write "<LINK href=""admin.css"" type=text/css rel=stylesheet>" & vbCrLf
		Response.Write "</HEAD>" & vbCrLf
		Response.Write "<BODY leftmargin=""3"" topmargin=""0"">" & vbCrLf
		Response.Write "<table width=""100%"" border=""0"" cellpadding=""3"" cellspacing=""0"" bordercolor=""#FFFFFF"">" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td height=""25"" background=""../images/menubg.gif""> → <A href=""admin_user.asp"">首页</A>  | <a href=""?action=userSearch&UserSearch=1"">所有用户</a> | <a href=""?action=userSearch&UserSearch=2"">锁定用户</a> | <a href=""?action=userSearch&UserSearch=3"">待审用户</a> | <a href=""?action=userSearch&UserSearch=4"">24H内登录</a> | <a href=""?action=userSearch&UserSearch=5"">24H内注册</a> | <a href=""?action=userSearch&UserSearch=6"">普通用户</a> | <a href=""?action=userSearch&UserSearch=7"">点数用户</a> | <a href=""?action=userSearch&UserSearch=8"">限时用户</a> | <a href=""?action=userSearch&UserSearch=9"">VIP过期</a> | <a href=""?action=userSearch&UserSearch=10"">FTP开启</a> | <a href=""?action=userSearch&UserSearch=11"">FTP禁用</a></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "</table>" & vbCrLf
		
	
		BatchID = Request.Form("UserID")
		If Request.QueryString("UserID") <> "" Then
			sID = CLng(Request.QueryString("UserID"))
		Else
			sID = ""
		End If
			
			If Mesky.adminName = "" Then
				Mesky.strMsg = "<li>非法操作：登录超时或你没有以管理员身份登录系统，<a href=""../admin_login.asp"" target=_top>点此进入管理员登录界面</a>。"
				Call Mesky.SystemMsg
			ElseIf myPermission() = False Then
				Mesky.strMsg = "<li>非法操作：你没有权限进行此项操作，请联系管理员！"
				Call Mesky.SystemMsg
			Else
				Call Main
			End If
		Response.Write "</BODY></HTML>" & vbCrLf
	
	End Sub
	Private Function myPermission()
		myPermission = False
		'If Mesky.checkPermission(Mesky.adminName,"11") Then myPermission = True:Exit Function
		If Mesky.checkPermission(Mesky.adminName, "52") Then myPermission = True: Exit Function
		'If Mesky.checkPermission(Mesky.adminName,"10") Then myPermission = False
	End Function
	Private Sub Main()
		
		If Mesky.F469e80d32(2) <> "1" Then
			Mesky.strMsg = "会员管理系统模块未注册。"
			Call Mesky.SystemMsg
			Exit Sub
		End If
		Select Case Trim(Request("action"))
		Case "isBatchDel" '批量删除
			Call isBatchDel
		Case "isBatchLock"
			Call isBatchLock
		Case "unBatchLock"
			Call unBatchLock
		Case "vip0"
			Call Vip0
		Case "vip1"
			Call Vip1
		Case "vip2"
			Call Vip2
		Case "ftp0"
			Call ftp0
		Case "ftp1"
			Call ftp1
		Case "ftp2"
			Call ftp2
		Case "setuserclass"
			Call SetUserclass
		Case "isDel" '删除
			If Mesky.checkPermission(Mesky.adminName, "12") Then
				Call isDel
			Else
				Mesky.strMsg = "<li>非法操作：你没有权限进行此项操作，请联系管理员！"
				Call Mesky.SystemMsg
			End If
		Case "isAuditing" '审核
			Call isAuditing
		Case "unAuditing" '取消审核
			Call unAuditing
		Case "AllAuditing" '全部审核
			Call AllAuditing
		Case "isTop" '置顶
			Call isTop
		Case "unTop" '取消置顶
			Call unTop
		Case "isHot" '批量推荐
			Call isHot
		Case "unHot" '批量取消推荐
			Call unHot
		Case "isBest" '批量精品
			Call isBest
		Case "unBest" '批量取消精品
			Call unBest
		Case "edit"
			Call edit
		Case "save"
			Call saveedit
		Case "userSearch"
			Call userSearch
		Case Else
			Call Search
		End Select
	End Sub

	Private Sub saveedit()
		Dim Rs, sql, UserIM
		If Not IsObject(Conn) then Call ConnectionDatabase
		sID = CLng(Request.Form("UserID"))
		UserIM = Trim(Request.Form("UserIM(0)")) & "|" & Trim(Request.Form("UserIM(1)")) & "|" & Trim(Request.Form("UserIM(2)")) & "|" & Trim(Request.Form("UserIM(3)")) & "|" & Trim(Request.Form("UserIM(4)")) & "|" & Trim(Request.Form("UserIM(5)")) & "|" & Trim(Request.Form("UserIM(6)")) & "|" & Trim(Request.Form("UserIM(7)"))
		Set Rs = Server.CreateObject("adodb.recordset")
		sql = "select * from Mesky_User where UserID=" & sID
		Rs.open sql, Conn, 1, 3
		Rs("UserEmail") = Trim(Request.Form("UserEmail"))
		Rs("SubmitDownRes") = Trim(Request.Form("SubmitDownRes"))
		Rs("EmbodyDownRes") = Trim(Request.Form("EmbodyDownRes"))
		Rs("DownCredited") = Trim(Request.Form("DownCredited"))
		Rs("SubmitCmsRes") = Trim(Request.Form("SubmitCmsRes"))
		Rs("EmbodyCmsRes") = Trim(Request.Form("EmbodyCmsRes"))
		Rs("CmsCredited") = Trim(Request.Form("CmsCredited"))
		Rs("CAPDateTime") = Trim(Request.Form("CAPDateTime"))
		If Request.Form("UserPassword") <> "" Then Rs("UserPassword") = MD5(Trim(Request.Form("UserPassword")), 32)
		Rs("UserSign") = Trim(Request.Form("UserSign"))
		Rs("UserSex") = Trim(Request.Form("UserSex"))
		Rs("JoinDate") = Trim(Request.Form("JoinDate"))
		Rs("UserLogins") = Trim(Request.Form("UserLogins"))
		Rs("UserState") = Trim(Request.Form("UserState"))
		Rs("UserClass") = Trim(Request.Form("UserClass"))
		If Request.Form("UserBirthday") <> "" Then Rs("UserBirthday") = Trim(Request.Form("UserBirthday"))
		Rs("UserQuesion") = Trim(Request.Form("UserQuesion"))
		If Request.Form("UserAnswer") <> "" Then Rs("UserAnswer") = MD5(Trim(Request.Form("UserAnswer")), 32)
		Rs("VipType") = Trim(Request.Form("VipType"))
		Rs("VipStartDate") = Trim(Request.Form("VipStartDate"))
		Rs("VipEndDate") = Trim(Request.Form("VipEndDate"))
		Rs("Points") = Trim(Request.Form("Points"))
		Rs("ftpstate") = Trim(Request.Form("ftpstate"))
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		If CLng(Request.Form("ftpstate")) = 0 Then Call ftp0
		If CLng(Request.Form("ftpstate")) = 1 Then Call ftp1
		If CLng(Request.Form("ftpstate")) = 2 Then Call ftp2
		Mesky.strMsg = "保存修改操作完成。"
		Call Mesky.SystemMsg

	End Sub
	
	
	Private Sub Search()
	Call Mesky.LoadSetting
		Response.Write "<table width=""98%""  border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td height=""3""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "</table>" & vbCrLf
		Response.Write "<table width=""100%""  border=""0"" cellspacing=""1"" cellpadding=""3"">" & vbCrLf
		Response.Write "<form name=""form1"" method=""post"" action="""">" & vbCrLf
		Response.Write "<input name=""action"" type=""hidden"" value=""userSearch"">" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td height=""25"" colspan=""2"" background=""images/menubg.gif"">·高级查询</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td>注意事项</td>" & vbCrLf
		Response.Write "    <td>在记录很多的情况下搜索条件越多查询越慢，请尽量减少查询条件；最多显示记录数也不宜选择过大</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td>用户名</td>" & vbCrLf
		Response.Write "    <td><input name=""UserName"" type=""text"" id=""UserName"" size=""35"" maxlength=""25""> <input type=checkbox name=""usernamechk"" value=""yes"" checked>用户名完整匹配</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td>用户等级</td>" & vbCrLf
		Response.Write "    <td><select name=""UserClass"" id=""UserClass"">" & vbCrLf
		Response.Write "      <option value="""">所有用户</option>  " & vbCrLf
	
		Dim arrClass, i
		arrClass = Split(Mesky.Setting(140), ",")
		For i = 0 To UBound(arrClass)
			Response.Write ("<option value=""" & i & """>" & arrClass(i) & "</option> ")
		Next
		Response.Write "  </select></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td>Email包含</td>" & vbCrLf
		Response.Write "    <td><input name=""UserEmail"" type=""text"" id=""UserEmail"" size=""35"" maxlength=""25""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td>用户IM包含</td>" & vbCrLf
		Response.Write "    <td><input name=""UserIm"" type=""text"" id=""UserIm"" size=""35"" maxlength=""25"">" & vbCrLf
		Response.Write "      包括主页、联系电话、QQ、UC、ICQ、YAHOO、AIM、MSN</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td>登录IP包含</td>" & vbCrLf
		Response.Write "    <td><input name=""UserLastIP"" type=""text"" id=""UserLastIP"" size=""35"" maxlength=""25""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td>签名包含</td>" & vbCrLf
		Response.Write "    <td><input name=""UserSign"" type=""text"" id=""UserSign"" size=""35"" maxlength=""25""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td>详细资料包含</td>" & vbCrLf
		Response.Write "    <td><input name=""UserInfo"" type=""text"" id=""UserInfo"" size=""35"" maxlength=""25""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td height=""25"" colspan=""2"" background=""images/menubg.gif"">·特殊查询 （注意： &lt;多于&gt; 或 &lt;少于&gt; 已默认包含 &lt;等于&gt;；条件留空则不使用此条件 ）</td>" & vbCrLf
		Response.Write "    </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td colspan=""2"">登录次数:<input type=radio value=more name=""loginR"" checked> 多于" & vbCrLf
		Response.Write "    <input type=radio value=less name=""loginR""> 少于" & vbCrLf
		Response.Write "    <input size=5 name=""loginT"" type=text> 次　" & vbCrLf
		Response.Write "    用户点数:<input type=radio value=more name=""PointsR"" checked> 多于" & vbCrLf
		Response.Write "    <input type=radio value=less name=""PointsR""> 少于" & vbCrLf
		Response.Write "    <input size=5 name=""PointsT"" type=text> 点</td>" & vbCrLf
		Response.Write "    </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td colspan=""2"">注册天数:<input type=radio value=more name=""regR"" checked> 多于" & vbCrLf
		Response.Write "    <input type=radio value=less name=""regR""> 少于" & vbCrLf
		Response.Write "    <input size=5 name=""regT"" type=text> 天　" & vbCrLf
		Response.Write "    帐号期限:<input name=""vipR"" type=radio value=more checked> " & vbCrLf
		Response.Write "    多于" & vbCrLf
		Response.Write "    <input type=radio value=less name=""vipR""> 少于" & vbCrLf
		Response.Write "    <input size=5 name=""vipT"" type=text> 天</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td>&nbsp;</td>" & vbCrLf
		Response.Write "    <td><input type=""submit"" name=""Submit"" value=""    搜 索    ""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  </form>" & vbCrLf
		Response.Write "</table>" & vbCrLf
		Response.Write "<table width=""98%""  border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td height=""3""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "</table>" & vbCrLf
	
	End Sub
	Private Sub userSearch()
		Call Mesky.LoadSetting
		Dim Rs, showPageRs, sql, Keyword, i, q, sCatalog, sKeyword, sColumn, currentPage
		sColumn = "UserID,UserName,UserEmail,SubmitDownRes,EmbodyDownRes,DownCredited,SubmitCmsRes,EmbodyCmsRes,CmsCredited,CAPDateTime,UserSex,JoinDate,UserLogins,LastLogin,UserLastIP,UserState,UserClass,VipType,VipStartDate,VipEndDate,Points,ftpstate"
		
		Select Case Request("userSearch")
		Case 1
			sql = ""
		Case 2
			sql = "UserState=0"
		Case 3
			sql = "UserState=2"
		Case 4
			If IsSqlDataBase = 1 Then
				sql = "datediff(hour,LastLogin," & SqlNowString & ")<25"
			Else
				sql = "datediff('h',LastLogin," & SqlNowString & ")<25"
			End If
		Case 5
			If IsSqlDataBase = 1 Then
				sql = "datediff(hour,JoinDate," & SqlNowString & ")<25"
			Else
				sql = "datediff('h',JoinDate," & SqlNowString & ")<25"
			End If
		Case 6
			sql = "VipType=0"
		Case 7
			sql = "VipType=1"
		Case 8
			sql = "VipType=2"
		Case 9
			sql = "VipType<>0 and VipEndDate<" & SqlNowString & ""
		Case 10
			sql = "ftpstate=1"
		Case 11
			sql = "ftpstate=2"
		Case Else
			If Request("UserName") <> "" Then
				If Request("usernamechk") = "yes" Then
					sql = " UserName='" & Request("UserName") & "'"
				Else
					sql = " UserName like '%" & Request("username") & "%'"
				End If
			End If
			If Request("UserClass") <> "" Then
				If sql = "" Then
					sql = "UserClass = " & CLng(Request("UserClass")) & ""
				Else
					sql = sql & " and UserClass = " & CLng(Request("UserClass")) & ""
				End If
			End If
			If Request("UserEmail") <> "" Then
				If sql = "" Then
					sql = "UserEmail like '%" & Request("UserEmail") & "%'"
				Else
					sql = sql & " and UserEmail like '%" & Request("UserEmail") & "%'"
				End If
			End If
			If Request("UserIm") <> "" Then
				If sql = "" Then
					sql = "UserIm like '%" & Request("UserIm") & "%'"
				Else
					sql = sql & " and UserIm like '%" & Request("UserIm") & "%'"
				End If
			End If
			If Request("UserLastIP") <> "" Then
				If sql = "" Then
					sql = "UserLastIP like '%" & Request("UserLastIP") & "%'"
				Else
					sql = sql & " and UserLastIP like '%" & Request("UserLastIP") & "%'"
				End If
			End If
			If Request("UserSign") <> "" Then
				If sql = "" Then
					sql = "UserSign like '%" & Request("UserSign") & "%'"
				Else
					sql = sql & " and UserSign like '%" & Request("UserSign") & "%'"
				End If
			End If
			If Request("UserInfo") <> "" Then
				If sql = "" Then
					sql = "UserInfo like '%" & Request("UserInfo") & "%'"
				Else
					sql = sql & " and UserInfo like '%" & Request("UserInfo") & "%'"
				End If
			End If
		'======特殊搜索=======
			Dim Tsqlstr
			If Request("loginT") <> "" Then
				If Request("loginR") = "more" Then
					Tsqlstr = " UserLogins >= " & Request("loginT") & ""
				Else
					Tsqlstr = " UserLogins <= " & Request("loginT") & ""
				End If
				If sql = "" Then
					sql = Tsqlstr
				Else
					sql = sql & "and" & Tsqlstr
				End If
			End If
			If Request("PointsT") <> "" Then
				If Request("PointsR") = "more" Then
					Tsqlstr = " Points >= " & Request("PointsT") & ""
				Else
					Tsqlstr = " Points <= " & Request("PointsT") & ""
				End If
				If sql = "" Then
					sql = Tsqlstr
				Else
					sql = sql & "and" & Tsqlstr
				End If
			End If
			If Request("regT") <> "" Then
				If Request("regR") = "more" Then
					If IsSqlDataBase = 1 Then
						Tsqlstr = " datediff(d,JoinDate," & SqlNowString & ") >= " & Request("regT") & ""
					Else
						Tsqlstr = " datediff('d',JoinDate," & SqlNowString & ") >= " & Request("regT") & ""
					End If
				Else
					If IsSqlDataBase = 1 Then
						Tsqlstr = " datediff(d,JoinDate," & SqlNowString & ") <= " & Request("regT") & ""
					Else
						Tsqlstr = " datediff('d',JoinDate," & SqlNowString & ") <= " & Request("regT") & ""
					End If
				End If
				If sql = "" Then
				  sql = Tsqlstr
				Else
				  sql = sql & "and" & Tsqlstr
				End If
			End If
			If Request("vipT") <> "" Then
				If Request("vipR") = "more" Then
					If IsSqlDataBase = 1 Then
						Tsqlstr = " datediff(d,VipStartDate,VipEndDate) >= " & Request("vipT") & ""
					Else
						Tsqlstr = " datediff('d',VipStartDate,VipEndDate) >= " & Request("vipT") & ""
					End If
				Else
					If IsSqlDataBase = 1 Then
						Tsqlstr = " datediff(d,VipStartDate,VipEndDate) <= " & Request("vipT") & ""
					Else
						Tsqlstr = " datediff('d',VipStartDate,VipEndDate) <= " & Request("vipT") & ""
					End If
				End If
				If sql = "" Then
					sql = Tsqlstr
				Else
					sql = sql & "and" & Tsqlstr
				End If
			End If
		End Select
		
		
		If Trim(Request.QueryString("Page")) = "" Then
			currentPage = 1
		Else
			currentPage = Trim(Request.QueryString("Page"))
		End If
		
		Set showPageRs = New cls_Mesky_showPage '创建对象
		With showPageRs
			If IsSqlDataBase = 1 Then
			.DbType = "MSSQL_SP"
			Else
			.DbType = "AC"
			End If
			.RecType = 0
			.RecSql = 0
			.RecTerm = 1
			.CookieName = "mesky_User"  '如果RecTerm＝2,cookiesname="",否则写cookiesname
			.Order = 1              '排序(0顺序1降序),注意要和下面sql里面主键ID的排序对应
			.PageSize = 35          '每页记录条数
			.currentPage = currentPage
		End With
		showPageRs.sql = sColumn & "$Mesky_User$" & sql & "$UserID desc$UserID" '字段,表,条件(不需要where),排序(不需要需要ORDER BY),主键ID
		
		Dim iRecCount, sqlRs
		iRecCount = showPageRs.RecCount() '记录总数
		
		Response.Write "<script language=""JavaScript"">" & vbCrLf
		Response.Write "function doSort() {" & vbCrLf
		Response.Write "    var oE = window.event.srcElement;" & vbCrLf
		Response.Write "    for (var i=0;i<oE.rows[oE.headindex].cells.length;i++) {" & vbCrLf
		Response.Write "        oE.rows[oE.headindex].cells[i].children[1].innerText = """";" & vbCrLf
		Response.Write "    }" & vbCrLf
		Response.Write "    oE.rows[oE.headindex].cells[window.event.sortIndex].children[1].innerText = window.event.sortOrder ? ""↑"" : ""↓"";" & vbCrLf
		Response.Write "}" & vbCrLf
		Response.Write "function sort() {" & vbCrLf
		Response.Write "    document.getElementById(""databox"").sort(2,false,""float"");" & vbCrLf
		Response.Write "}" & vbCrLf
		Response.Write "</script>" & vbCrLf
		
		Response.Write (showPageRs.showPage("?Page={$pages}" & q))
		
		Response.Write "<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbCrLf
		Response.Write "<form name=""myform"" method=""post"" action=""admin_user.asp"">" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td><table width=""100%"" border=""0"" align=""center"" cellpadding=""3"" cellspacing=""1"">" & vbCrLf
		Response.Write "        <tr height=""25"">" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif""><a href=""javascript:SelectAll()"">选择</a></td>" & vbCrLf
		Response.Write "          <td background=""images/menubg.gif"">用户名</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">注册日期</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">登录次数</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">最后登录</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">用户状态</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">用户级别</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">VIP点数</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">VIP用户</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">VIP有效期</td>" & vbCrLf
		Response.Write "          <td align=""center"" background=""images/menubg.gif"">FTP帐号</td>" & vbCrLf
		Response.Write "          </tr>" & vbCrLf
		Response.Write "<SCRIPT language = ""JavaScript"">" & vbCrLf
		Response.Write "//parent.frame.cols=""0,*"";" & vbCrLf
		Response.Write "function SelectAll() {" & vbCrLf
		Response.Write "    for (var i=0;i<document.myform.UserID.length;i++) {" & vbCrLf
		Response.Write "        var e=document.myform.UserID[i];" & vbCrLf
		Response.Write "        e.checked=!e.checked;" & vbCrLf
		Response.Write "    }" & vbCrLf
		Response.Write "}" & vbCrLf
		Response.Write "<!--" & vbCrLf
		Response.Write "function CheckAll(form)  {" & vbCrLf
		Response.Write "  for (var i=0;i<form.elements.length;i++)    {" & vbCrLf
		Response.Write "    var e = form.elements[i];" & vbCrLf
		Response.Write "    if (e.name != 'chkall')       e.checked = form.chkall.checked; " & vbCrLf
		Response.Write "   }" & vbCrLf
		Response.Write "  }" & vbCrLf
		Response.Write "//-->" & vbCrLf
		Response.Write "</script>" & vbCrLf
		
		If iRecCount < 1 Then
			Response.Write "<tr bgcolor=""#FCFCFC""> <td colspan=""11"">Sorry！没有找到任何记录。</td></tr>"
		Else
			'Set sqlRs = showPageRs.ResultSet()  '返回ResultSet
			Rs = showPageRs.ResultSet()  '返回ResultSet
			For i = 0 To UBound(Rs, 2)
			Response.Write "        <tr "
			If i Mod 2 Then
					Response.Write (" class=""tdbg2""")
				Else
					Response.Write (" class=""tdbg3""")
				End If
				Response.Write " onmouseover=""this.style.backgroundColor='#CEE7FF';this.style.color='red'"" onmouseout=""this.style.backgroundColor='';this.style.color=''""> " & vbCrLf
				Response.Write "          <td align=""center"">"
				Response.Write "<input name=""UserID"" type=""checkbox"" value=""" & Rs(0, i) & """>"
				Response.Write "</td>" & vbCrLf
				Response.Write "          <td>" & vbCrLf
				Response.Write "<a href=""?action=edit&UserID=" & Rs(0, i) & """>" & Rs(1, i) & "</a>"
				Response.Write "</a></td>" & vbCrLf
				Response.Write "          <td align=""center"">" & Mesky.FormatMyDate(Rs(11, i), "{Y}/{m}/{d}") & "</td>" & vbCrLf
				Response.Write "          <td align=""center"">" & Rs(12, i) & "</td>" & vbCrLf
				Response.Write "          <td align=""center"">" & Rs(13, i) & "</td>" & vbCrLf
				Response.Write "          <td align=""center"">"
				If Rs(15, i) = 0 Then
					Response.Write ("<font color=red>锁定</font>")
				ElseIf Rs(15, i) = 1 Then
					Response.Write ("正常")
				Else
					Response.Write ("<font color=blue>等待审核</font>")
				End If
				Response.Write "</td>" & vbCrLf
				Response.Write "          <td align=""center"">" & Split(Mesky.Setting(140), ",")(Rs(16, i)) & "</td>" & vbCrLf
				Response.Write "          <td align=""center"">" & Rs(20, i) & "</td>" & vbCrLf
				Response.Write "          <td align=""center"">" & vbCrLf
		
				If Rs(17, i) = 0 Then
					Response.Write ("非VIP")
				ElseIf Rs(17, i) = 1 Then
					Response.Write ("点数用户")
				ElseIf Rs(17, i) = 2 Then
					Response.Write ("包月用户")
				Else
					Response.Write ("未定义")
				End If
				Response.Write "</td>" & vbCrLf
				Response.Write "          <td align=""center"">" & Mesky.FormatMyDate(Rs(18, i), "{Y}-{m}-{d}") & "→" & Mesky.FormatMyDate(Rs(19, i), "{Y}-{m}-{d}") & "</td>" & vbCrLf
				Response.Write "          <td align=""center"">"
				If Rs(21, i) = 0 Then
					Response.Write ("<font color=blue>未开启</font>")
				ElseIf Rs(21, i) = 1 Then
					Response.Write ("启用")
				ElseIf Rs(21, i) = 2 Then
					Response.Write ("<font color=red>禁用</font>")
				Else
					Response.Write ("未知")
				End If
				Response.Write "</td>" & vbCrLf
				Response.Write "          </tr>" & vbCrLf
				Next
			'sqlRs.Close
			'Set sqlRs = Nothing
		End If
		Response.Write "</table>" & vbCrLf
		Response.Write "    <table width=""100%"" border=""0"" align=""center"" cellpadding=""3"" cellspacing=""1"">" & vbCrLf
		Response.Write "        <tr class=""tdbg3""> " & vbCrLf
		Response.Write "            <td><input type=checkbox name=chkall value=on onclick=""CheckAll(this.form)"" id=""chkall""><label for=""chkall"">全选</label><br></td>" & vbCrLf
		Response.Write "            <td align=""center"">管<br>理<br>操<br>作</td>" & vbCrLf
		Response.Write "            <td colspan=""6""><input type=""radio"" name=""action"" value=""isBatchDel"">批量<font color=red>删除</font>用户" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""isBatchLock"">批量<font color=blue>锁定</font>用户" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""unBatchLock"">批量<font color=blue>审核</font>用户 |" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""vip0"">设置为非VIP用户" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""vip1"">设置为点数用户" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""vip2"">设置为包月用户<br>" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""ftp0"">删除 ftp帐号" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""ftp1"">启用 ftp帐号" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""ftp2"">禁用 ftp帐号 |" & vbCrLf
		Response.Write "            <input type=""radio"" name=""action"" value=""setuserclass"">设置用户级别为" & vbCrLf
		Response.Write "            <select name=""UserClass"" id=""UserClass"">    " & vbCrLf
			Dim arrClass
			arrClass = Split(Mesky.Setting(140), ",")
			For i = 1 To UBound(arrClass)
			Response.Write ("<option value=""" & i & """>" & arrClass(i) & "</option> ")
			Next
		Response.Write "  </select>" & vbCrLf
		Response.Write "            <br><input type=""submit"" name=""Submit3"" value=""执行操作"" onclick=""{if(confirm('您确定执行的操作吗?')){this.document.myform.submit();return true;}return false;}""> </td>" & vbCrLf
		Response.Write "        </tr>" & vbCrLf
		Response.Write vbCrLf
		Response.Write "</table></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "</form>" & vbCrLf
		Response.Write "</table> " & vbCrLf
		
		Response.Write (showPageRs.showPage("?Page={$pages}" & q))
			Rs = Null
			showPageRs = Null
			Set showPageRs = Nothing
	End Sub
	Private Sub edit()
		Call Mesky.LoadSetting
		Dim Rs
		Set Rs = Mesky.Execute("select * from Mesky_User where UserID=" & sID)
		Response.Write "<script language=""JavaScript"" src=""js/MyUserinfo.js""></script>" & vbCrLf
		Response.Write "<table width=""100%""  border=""0"" align=""center"" cellpadding=""3"" cellspacing=""1"">" & vbCrLf
		Response.Write "<form action=""?action=save"" method=""post"" name=""edituser""><input name=""UserID"" type=""hidden"" value=""" & Rs("UserID") & """>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td colspan=""2"" align=""center""  bgcolor=""#EFEFEF"">用户帐号设置</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">用户名：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserName"" type=""text"" size=""40"" maxlength=""30"" value=""" & Rs("UserName") & """ readonly></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">密码：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserPassword"" type=""text"" size=""40"" maxlength=""50"" value=""""> 如果不修改请留空</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">邮箱：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserEmail"" type=""text"" size=""40"" maxlength=""50"" value=""" & Rs("UserEmail") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">密码问题：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserQuesion"" type=""text"" size=""40"" maxlength=""50"" value=""" & Rs("UserQuesion") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">密码答案：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserAnswer"" type=""text"" size=""40"" maxlength=""50""> 如果不修改请留空</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">上传的下载资源数：</td>" & vbCrLf
		Response.Write "    <td><input name=""SubmitDownRes"" type=""text"" size=""20"" maxlength=""10"" value=""" & Rs("SubmitDownRes") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">收录上传的下载资源数：</td>" & vbCrLf
		Response.Write "    <td><input name=""EmbodyDownRes"" type=""text"" size=""20"" maxlength=""10"" value=""" & Rs("EmbodyDownRes") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">下载信用等级：</td>" & vbCrLf
		Response.Write "    <td><input name=""DownCredited"" type=""text"" size=""20"" maxlength=""10"" value=""" & Rs("DownCredited") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">上传的文章资源数：</td>" & vbCrLf
		Response.Write "    <td><input name=""SubmitCmsRes"" type=""text"" size=""20"" maxlength=""10"" value=""" & Rs("SubmitCmsRes") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">收录上传的文章资源数：</td>" & vbCrLf
		Response.Write "    <td><input name=""EmbodyCmsRes"" type=""text"" size=""20"" maxlength=""10"" value=""" & Rs("EmbodyCmsRes") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">文章信用等级：</td>" & vbCrLf
		Response.Write "    <td><input name=""CmsCredited"" type=""text"" size=""20"" maxlength=""10"" value=""" & Rs("CmsCredited") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">信用等级加点时间：</td>" & vbCrLf
		Response.Write "    <td><input name=""CAPDateTime"" type=""text"" size=""20"" maxlength=""15"" value=""" & Rs("CAPDateTime") & """ onfocus=""show_cele_date(CAPDateTime,'','',CAPDateTime)""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">注册日期：</td>" & vbCrLf
		Response.Write "    <td><input name=""JoinDate"" type=""text"" size=""20"" maxlength=""30"" value=""" & Rs("JoinDate") & """ onfocus=""show_cele_date(JoinDate,'','',JoinDate)""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">签名：</td>" & vbCrLf
		Response.Write "    <td><textarea name=""UserSign"" cols=""40"" rows=""5"">" & Rs("UserSign") & "</textarea></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">性别：</td>" & vbCrLf
		Response.Write "    <td><input type=""radio"""
		If Rs("UserSex") = 1 Then Response.Write (" checked")
		Response.Write " value=""1"" name=""UserSex""><img src=""images/icon_male.gif"" align=""absmiddle"">男孩 " & vbCrLf
		Response.Write "<input type=""radio"""
		If Rs("UserSex") = 0 Then Response.Write (" checked")
		Response.Write "value=""0"" name=""UserSex""><img src=""images/icon_female.gif"" align=""absmiddle"">女孩</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">用户生日：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserBirthday"" type=""text"" size=""20"" maxlength=""15"" value=""" & Rs("UserBirthday") & """ onfocus=""show_cele_date(UserBirthday,'','',UserBirthday)""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Dim arrUserIM
		arrUserIM = Split(Rs("UserIM"), "|")
		Response.Write "    <td align=""right"">个人主页：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserIM(0)"" type=""text"" size=""40"" maxlength=""100"" value=""" & arrUserIM(0) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">联系电话：</td>" & vbCrLf
		Response.Write "    <td ><input name=""UserIM(1)"" type=""text"" size=""40"" maxlength=""50"" value=""" & arrUserIM(1) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">QQ 号码：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserIM(2)"" type=""text"" size=""40"" maxlength=""50"" value=""" & arrUserIM(2) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">ICQ号码：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserIM(3)"" type=""text"" size=""40"" maxlength=""50"" value=""" & arrUserIM(3) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">MSN：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserIM(4)"" type=""text"" size=""40"" maxlength=""50"" value=""" & arrUserIM(4) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">AIM：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserIM(5)"" type=""text"" size=""40"" maxlength=""50"" value=""" & arrUserIM(5) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">Yahoo：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserIM(6)"" type=""text"" size=""40"" maxlength=""50"" value=""" & arrUserIM(6) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">UC：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserIM(7)"" type=""text"" size=""40"" maxlength=""50"" value=""" & arrUserIM(7) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">登录次数：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserLogins"" type=""text"" size=""20"" maxlength=""15"" value=""" & Rs("UserLogins") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">最后登录时间：</td>" & vbCrLf
		Response.Write "    <td><input name=""LastLogin"" type=""text"" size=""20"" maxlength=""25"" value=""" & Rs("LastLogin") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">最后登录IP：</td>" & vbCrLf
		Response.Write "    <td><input name=""UserLastIP"" type=""text"" size=""20"" maxlength=""15"" value=""" & Rs("UserLastIP") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">用户状态：</td>" & vbCrLf
		Response.Write "    <td><input type=""radio"" name=""UserState"" value=""0"""
		If Rs("UserState") = 0 Then Response.Write (" checked")
		Response.Write ">锁定" & vbCrLf
		Response.Write "    <input type=""radio"" name=""UserState"" value=""1"""
		If Rs("UserState") = 1 Then Response.Write (" checked")
		Response.Write ">正常       　" & vbCrLf
		Response.Write "    <input type=""radio"" name=""UserState"" value=""2"""
		If Rs("UserState") = 2 Then Response.Write (" checked")
		Response.Write ">等待验证</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">用户级别：</td>" & vbCrLf
		Response.Write "    <td>"
		Response.Write "<select name=""UserClass"">" & vbCrLf
		Dim arrClass, i
		arrClass = Split(Mesky.Setting(140), ",")
		For i = 0 To UBound(arrClass)
		Response.Write ("<option value=""" & i & """")
		If Rs("UserClass") = i Then Response.Write (" selected")
		Response.Write (">" & arrClass(i) & "</option> ")
		Next
		Response.Write " </select>" & vbCrLf
		Response.Write "</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">用户积分点：</td>" & vbCrLf
		Response.Write "    <td><input name=""Points"" type=""text"" size=""20"" maxlength=""15"" value=""" & Rs("Points") & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">用户类型：</td>" & vbCrLf
		Response.Write "    <td><input type=""radio"" name=""VipType"" value=""0"""
		If Rs("VipType") = 0 Then Response.Write (" checked")
		Response.Write ">普通用户 " & vbCrLf
		Response.Write "      <input type=""radio"" name=""VipType"" value=""1"""
		If Rs("VipType") = 1 Then Response.Write (" checked")
		Response.Write ">点数用户" & vbCrLf
		Response.Write "      <input type=""radio"" name=""VipType"" value=""2"""
		If Rs("VipType") = 2 Then Response.Write (" checked")
		Response.Write ">限时用户</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">VIP帐号有效期开始时间：</td>" & vbCrLf
		Response.Write "    <td><input name=""VipStartDate"" type=""text"" size=""20"" maxlength=""25"" value=""" & Rs("VipStartDate") & """ onfocus=""show_cele_date(VipStartDate,'','',VipStartDate)""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">VIP帐号有效期结束时间：</td>" & vbCrLf
		Response.Write "    <td><input name=""VipEndDate"" type=""text"" size=""20"" maxlength=""25"" value=""" & Rs("VipEndDate") & """ onfocus=""show_cele_date(VipEndDate,'','',VipEndDate)""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">FTP帐号状态：</td>" & vbCrLf
		Response.Write "    <td><input type=""radio"" name=""ftpstate"" value=""0"""
		If Rs("ftpstate") = 0 Then Response.Write (" checked")
		Response.Write ">未开设 " & vbCrLf
		Response.Write "      <input type=""radio"" name=""ftpstate"" value=""1"""
		If Rs("ftpstate") = 1 Then Response.Write (" checked")
		Response.Write ">启用" & vbCrLf
		Response.Write "      <input type=""radio"" name=""ftpstate"" value=""2"""
		If Rs("ftpstate") = 2 Then Response.Write (" checked")
		Response.Write ">禁用</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">&nbsp;</td>" & vbCrLf
		Response.Write "    <td><input type=""submit"" name=""Submit"" value=""提交修改"">" & vbCrLf
		Response.Write "      <input type=""reset"" name=""Submit"" value=""重置""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "</form>" & vbCrLf
		Response.Write "</table>" & vbCrLf
		Set Rs = Nothing
	End Sub
	Private Sub isBatchDel()
		If BatchID <> "" Then
			Mesky.Execute ("delete from Mesky_User where UserID in (" & BatchID & ")")
			Mesky.Execute ("delete from ftp_UserAccounts where Mesky_UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“批量删除”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
	End Sub
	
	Private Sub isBatchLock()
		If BatchID <> "" Then
			Mesky.Execute ("update Mesky_User set UserState=0 where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“批量锁定用户”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
	End Sub
	
	Private Sub unBatchLock()
		If BatchID <> "" Then
			Mesky.Execute ("update Mesky_User set UserState=1 where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“批量审核用户”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
	End Sub
	
	Private Sub AllLock()
		Mesky.Execute ("update Mesky_User set UserState=0")
		Mesky.strMsg = "<li>“全部审核”操作成功！</li>"
		Call Mesky.SystemMsg
	End Sub
	
	Private Sub Vip0()
		If BatchID <> "" Then
			Mesky.Execute ("update Mesky_User set VipType=0 where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“设置为非VIP用户”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
	End Sub
	
	Private Sub Vip1()
		If BatchID <> "" Then
			Mesky.Execute ("update Mesky_User set VipType=1 where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“设置为点数用户”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
	End Sub
	
	Private Sub Vip2()
		If BatchID <> "" Then
			Mesky.Execute ("update Mesky_User set VipType=2 where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“设置为包月用户”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
	End Sub
	Private Sub ftp0()
		If BatchID <> "" Then
			Mesky.Execute ("delete from ftp_UserAccounts where UserID in (" & BatchID & ")")
			Mesky.Execute ("update Mesky_User set FtpState=0 where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“删除用户ftp帐号”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
		
	End Sub
	Private Sub ftp1()
		If BatchID <> "" Then
			Mesky.Execute ("update Mesky_User set FtpState=1 where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“启用用户ftp帐号”操作成功！</li>"
			Dim arrUserID, i
			arrUserID = Split(BatchID, ",")
			For i = 0 To UBound(arrUserID)
				Call actionftp(arrUserID(i))
			Next
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
		
	End Sub
	Private Sub ftp2()
		If BatchID <> "" Then
			Mesky.Execute ("update ftp_UserAccounts set Disable=1 where Mesky_UserID in (" & BatchID & ")")
			Mesky.Execute ("update Mesky_User set FtpState=2 where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“禁用用户ftp帐号”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
		
	End Sub
	Private Sub SetUserclass()
		If BatchID <> "" Then
			Mesky.Execute ("update Mesky_User set UserClass=" & CLng(Request.Form("UserClass")) & " where UserID in (" & BatchID & ")")
			Mesky.strMsg = "<li>“设置用户级别”操作成功！</li>"
		Else
			Mesky.strMsg = "<li>没有选择任何用户，本次操作被取消！</li>"
		End If
		Call Mesky.SystemMsg
	End Sub
	Private Sub actionftp(UserID)
	Call Mesky.LoadSetting
		Dim Rs, sql, ftpRs
		Dim Mesky_UserName, Mesky_Password
		Set Rs = Mesky.Execute("select UserID,UserName,UserPassword from Mesky_User where UserID=" & UserID)
		If Rs.EOF And Rs.BOF Then
			Set Rs = Nothing
			Exit Sub
		Else
			Set ftpRs = Mesky.Execute("select Mesky_UserID from ftp_UserAccounts where Mesky_UserID=" & UserID)
			If Not (ftpRs.EOF And ftpRs.BOF) Then
				Mesky.Execute ("Update ftp_UserAccounts set Disable=0 where Mesky_UserID=" & UserID)
				Set ftpRs = Nothing
				Set Rs = Nothing
				Exit Sub
			Else
				Mesky_UserName = Rs(1)
				Mesky_Password = Rs(2)
			End If
			Set ftpRs = Nothing
		End If
		Set Rs = Nothing
		
		If Not IsObject(Conn) Then Call ConnectionDatabase
		Set Rs = Server.CreateObject("adodb.recordset")
		sql = "select * from ftp_UserAccounts where (Name is null)"
		Rs.open sql, Conn, 1, 3
		Rs.AddNew
		Rs("Mesky_UserID") = UserID
		Rs("Mesky_UserName") = Mesky_UserName
		Rs("Mesky_Password") = Mesky_Password
		Rs("Name") = Mesky_UserName
		Rs("Password") = ftpPassword(Trim(Request.Form("Password")))
		Rs("PassType") = 0
		Rs("ChangePass") = 0
		Rs("SKeyValues") = ""
		Rs("Access") = Mesky.Setting(124) & "|" & Mesky.Setting(125)
		Rs("HomeDir") = Mesky.Setting(124)
		Rs("Privilege") = 0
		Rs("NeedSecure") = 0
		Rs("LogMesFile") = Server.MapPath("ftpLogMesFile.txt")
		Rs("Disable") = 0
		Rs("RelPaths") = -1
		Rs("HideHidden") = -1
		Rs("AlwaysLogin") = 0
		Rs("MaxUsers") = Mesky.Setting(127)
		Rs("MaxSpeedUp") = Mesky.Setting(128) * 1024
		Rs("MaxSpeedDown") = Mesky.Setting(129) * 1024
		Rs("MaxIP") = Mesky.Setting(130)
		Rs("IdleTimeOut") = Mesky.Setting(131)
		Rs("SessionTimeOut") = Mesky.Setting(132)
		Rs("QuotaEnable") = 0
		Rs("QuotaCurrent") = 0
		Rs("QuotaMax") = 0
		Rs("RatioType") = 0
		Rs("RatioUp") = 1
		Rs("RatioDown") = 1
		Rs("RatioCredit") = 0
		Rs("Expiration") = "1980-1-1"
		Rs("Groups") = ""
		Rs("Notes") = ""
		Rs.Update
		Rs.Close
		'If IsObject(Conn) Then Call CloseConn
	End Sub
		Private Function getRandomChar(intStartInterval, intEndInterval)
			Randomize
			Dim intChar
			intChar = (Int(255 * Rnd) Mod (intEndInterval - intStartInterval + 1)) + intStartInterval
			getRandomChar = Chr(intChar)
		End Function
		
		Public Function ftpPassword(s)
			Dim char1, char2			
			char1 = getRandomChar(Asc("a"), Asc("z"))
			char2 = getRandomChar(Asc("a"), Asc("z"))
			ftpPassword = char1 & char2 & MD5(char1 & char2 & Trim(s), 32)
		End Function
		
	Private Sub isDel() '单个删除
		If sID <> "" Then
			Mesky.Execute ("delete from Mesky_Down_Resource where ID=" & sID & "")
			Mesky.Execute ("delete from Mesky_Down_Address where ResourceID=" & sID & "")
			Mesky.Execute ("delete from Mesky_Down_Comment where ResourceID=" & sID & "")
			'Mesky.strMsg = "<li>“批量删除”操作成功！</li>"
		End If
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub isAuditing() '单个审核
		If sID <> "" Then Mesky.Execute ("update Mesky_Down_Resource set isAuditing=1 where ID=" & sID & "")
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub unAuditing() '取消审核
		If sID <> "" Then Mesky.Execute ("update Mesky_Down_Resource set isAuditing=0 where ID=" & sID & "")
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub AllAuditing()
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub isTop() '置顶
		If sID <> "" Then Mesky.Execute ("update Mesky_Down_Resource set isTop=1 where ID=" & sID & "")
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub unTop() '取消置顶
		If sID <> "" Then Mesky.Execute ("update Mesky_Down_Resource set isTop=0 where ID=" & sID & "")
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub isHot() '批量推荐
		If sID <> "" Then Mesky.Execute ("update Mesky_Down_Resource set isHot=1 where ID=" & sID & "")
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub unHot() '批量取消推荐
		If sID <> "" Then Mesky.Execute ("update Mesky_Down_Resource set isHot=0 where ID=" & sID & "")
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub isBest() '批量精品
		If sID <> "" Then Mesky.Execute ("update Mesky_Down_Resource set isBest=1 where ID=" & sID & "")
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Sub unBest() '批量取消精品
		If sID <> "" Then Mesky.Execute ("update Mesky_Down_Resource set isBest=0 where ID=" & sID & "")
		Response.Redirect Mesky.RefererPage
	End Sub
	Private Function checkResAdmin(sName)
		checkResAdmin = True
	End Function
	Public Sub OnEndPage()
		Response.Write Mesky.CopyRight
	End Sub ' OnEndPage

End Class %>