admin_user.asp
来自「这是一套基于WEB的网站管理系统」· ASP 代码 · 共 730 行 · 第 1/2 页
ASP
730 行
<!--#include file="setup.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/chkinput.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称:新云网站管理系统
' 当前版本:NewCloud Site Management System Version 2.0.0
' 文件名称:admin_user.asp
' 更新日期:2004-11-20
' 官方网站:新云网络(www.newasp.net www.newasp.cn) QQ:94022511
'=====================================================================
' Copyright 2002-2005 newasp.net - All Rights Reserved.
' newasp is a trademark of newasp.net
'=====================================================================
Dim Action
Dim i,ii,RsObj
Dim keyword,findword,strClass,sUserGroup,foundsql
Dim seluserid,UserGrade,UserGroupStr,UserPassWord,username
Dim maxperpage,CurrentPage,totalnumber,TotalPageNum,userlock
Action = LCase(Request("action"))
Select Case Trim(Action)
Case "save"
If Not ChkAdmin("AddUser") Then
Server.Transfer("showerr.asp")
Response.End
End If
Call SaveUser
Case "modify"
Call ModifyUser
Case "add"
If Not ChkAdmin("AddUser") Then
Server.Transfer("showerr.asp")
Response.End
End If
Call AddUser
Case "edit"
Call EditUser
Case "del"
Call DeleteUser
Case Else
Call MainPage
End Select
If FoundErr = True Then
ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
CloseConn
Private Sub PageTop()
Response.Write "<table border=0 align=center cellpadding=3 cellspacing=1 class=TableBorder>"
Response.Write " <tr>"
Response.Write " <th colspan=2>会员管理</th>"
Response.Write " </tr>"
Response.Write " <tr><form method=Post name=myform action=admin_user.asp onSubmit='return JugeQuery(this);'>"
Response.Write " <td class=TableRow1>搜索:"
Response.Write " <input name=keyword type=text size=20>"
Response.Write " 条件:"
Response.Write " <select name=queryopt>"
Response.Write " <option value=1 selected>会员名称</option>"
Response.Write " <option value=2>真实姓名</option>"
Response.Write " <option value=3>用户昵称</option>"
Response.Write " </select> <input type=submit name=Submit value='开始搜索' class=Button></td>"
Response.Write " <td class=TableRow1>"
Response.Write " </td></form>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td colspan=2 class=TableRow2><strong>操作选项:</strong> <a href='admin_user.asp'>会员管理首页</a> | "
Response.Write " <a href='admin_user.asp?action=add'><font color=blue>添加会员</font></a> | "
Response.Write " <a href='admin_user.asp?lock=1'><font color=blue>等待验证的会员</font></a> "
Set RsObj = Newasp.Execute("Select GroupName,Grades From NC_UserGroup where Grades <> 0 order by Groupid")
Do While Not RsObj.EOF
Response.Write " | <a href=admin_user.asp?UserGrade="
Response.Write RsObj("Grades")
Response.Write ">"
Response.Write RsObj("GroupName")
Response.Write "</a>" & vbCrLf
RsObj.movenext
Loop
Set RsObj = Nothing
Response.Write " </td>"
Response.Write " </tr>"
Response.Write "</table>"
Response.Write "<br>"
End Sub
Private Sub MainPage()
Call PageTop
If Not ChkAdmin("AdminUser") Then
Server.Transfer("showerr.asp")
Response.End
End If
If Not IsEmpty(Request("seluserid")) Then
seluserid = Request("seluserid")
Select Case Newasp.CheckStr(Request("act"))
Case "删除用户"
Call BatDelUser
Case "激活用户"
Call NolockUser
Case "锁定用户"
Call IslockUser
Case "转移用户"
Call MoveUser
Case Else
Response.Write "无效参数!"
End Select
End If
%>
<table border=0 align=center cellpadding=3 cellspacing=1 class=tableborder>
<tr>
<th width='5%' nowrap>选择</th>
<th width='20%' nowrap>用户名</th>
<th width='10%' nowrap>用户身份证</th>
<th width='10%' nowrap>会员类型</th>
<th width='5%' nowrap>邮箱</th>
<th width='5%' nowrap>性别</th>
<th width='20%' nowrap>操作选项</th>
<th width='15%' nowrap>最后登陆时间</th>
<th width='5%' nowrap>登陆次数</th>
<th width='5%' nowrap>状态</th>
</tr>
<%
If Trim(Request("UserGrade")) <> "" Then
SQL = "select GroupName,Grades from [NC_UserGroup] where Grades=" & Request("UserGrade")
Set Rs = Newasp.Execute(SQL)
If Rs.bof And Rs.EOF Then
Response.Write "Sorry!没有找到任何会员。或者您选择了错误的系统参数!"
Response.End
Else
sUserGroup = Rs("GroupName")
UserGrade = Rs("Grades")
End If
Rs.Close
Else
sUserGroup = "全部会员"
UserGrade = 0
End If
maxperpage = 20 '###每页显示数
If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
Response.Write ("错误的系统参数!请输入整数")
Response.End
End If
If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
CurrentPage = CInt(Request("page"))
Else
CurrentPage = 1
End If
userlock =0
If CInt(CurrentPage) = 0 Then CurrentPage = 1
If Not IsNull(Request("keyword")) And Request("keyword") <> "" Then
keyword = Newasp.ChkQueryStr(Request("keyword"))
If CInt(Request("queryopt")) = 1 Then
findword = "where username like '%" & keyword & "%'"
ElseIf CInt(Request("queryopt")) = 2 Then
findword = "where TrueName like '%" & keyword & "%'"
Else
findword = "where nickname like '%" & keyword & "%'"
End If
foundsql = findword
sUserGroup = "查询会员"
Else
If Trim(Request("UserGrade")) <> "" Then
foundsql = "where UserGrade = " & Request("UserGrade")
UserGrade = Request("UserGrade")
Else
If Trim(Request("lock")) <> "" Then
foundsql = "where userlock =1"
userlock =1
Else
foundsql = ""
End If
End If
End If
TotalNumber = Newasp.Execute("Select Count(userid) from NC_User "& foundsql &"")(0)
TotalPageNum = CInt(TotalNumber / maxperpage) '得到总页数
If TotalPageNum < TotalNumber / maxperpage Then TotalPageNum = TotalPageNum + 1
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "select userid,username,nickname,UserGrade,UserGroup,UserClass,UserLock,userpoint,usermoney,TrueName,UserSex,usermail,HomePage,oicq,JoinTime,ExpireTime,LastTime,userlogin from [NC_User] "& foundsql &" order by JoinTime desc ,userid desc"
Rs.Open SQL, Conn, 1, 1
Newasp.SqlQueryNum = Newasp.SqlQueryNum + 1
If Rs.BOF And Rs.EOF Then
Response.Write "<tr><td align=center colspan=10 class=TableRow1>还没有找到任何会员信息!</td></tr>"
Else
If TotalPageNum > 1 then Rs.Move (CurrentPage - 1) * maxperpage
i = 0
Response.Write "<tr>"
Response.Write " <td colspan=10 class=tablerow2>"
Call showpage()
Response.Write "</td>"
Response.Write " <form name=selform method=post action="""">"
Response.Write "</tr>"
Do While Not Rs.EOF And i < CInt(maxperpage)
If Not Response.IsClientConnected Then Response.End
If (i mod 2) = 0 Then
strClass = "class=TableRow1"
Else
strClass = "class=TableRow2"
End If
Response.Write "<tr align=center>"
Response.Write " <td " & strClass & "><input type=checkbox name=seluserid value='" & Rs("userid") & "'></td>"
Response.Write " <td " & strClass & ">"
Response.Write "<a href='?action=edit&userid=" & Rs("userid") & "' title='用户昵称:" & Rs("nickname") & "'>"
If Rs("UserGrade") = 999 Then
Response.Write "<span class=style2>"
Else
Response.Write "<span>"
End If
Response.Write Rs("username")
Response.Write "</span></a>"
Response.Write " </td>"
Response.Write " <td " & strClass & ">"
Response.Write Rs("UserGroup")
Response.Write " </td>"
Response.Write " <td " & strClass & ">"
If Rs("UserGrade") = 999 Then
Response.Write "管理员"
Else
If Rs("UserClass") = 0 Then
Response.Write "计点会员"
ElseIf Rs("UserClass") = 1 Then
Response.Write "计时会员"
Else
Response.Write "计时到期"
End If
End If
Response.Write " </td>"
Response.Write " <td " & strClass & ">"
Response.Write "<a href='admin_mailist.asp?action=mail&useremail="
Response.Write Rs("usermail")
Response.Write "'><img src='images/email.gif' border=0 alt='给用户发邮件'></a>"
Response.Write " </td>"
Response.Write " <td " & strClass & ">"
Response.Write Rs("UserSex")
Response.Write " </td>"
Response.Write " <td nowrap " & strClass & ">"
Response.Write "<a href='?action=edit&userid=" & Rs("userid") & "'>编辑</a> | "
Response.Write "<a href='?action=del&userid=" & Rs("userid") & "'>删除</a>"
Response.Write " </td>"
Response.Write " <td nowrap " & strClass & ">"
If Rs("LastTime") >= Date Then
Response.Write "<font color=red>"
Response.Write Rs("LastTime")
Response.Write "</font>"
Else
Response.Write Rs("LastTime")
End If
Response.Write " </td>"
Response.Write " <td " & strClass & ">"
Response.Write Rs("userlogin")
Response.Write " </td>"
Response.Write " <td " & strClass & ">"
If Rs("UserLock") = 0 Then
Response.Write "<font color=blue>√</font>"
Else
Response.Write "<font color=red>×</font>"
End If
Response.Write " </td>"
Response.Write "</tr>"
Rs.movenext
i = i + 1
If i >= maxperpage Then Exit Do
Loop
End If
Rs.Close:Set Rs = Nothing
%>
<tr>
<td colspan=10 class=tablerow1>
<input class=Button type=button name=chkall value='全选' onClick=CheckAll(this.form)><input class=Button type=button name=chksel value='反选' onClick=ContraSel(this.form)> 管理选项:
<input class=button onClick="{if(confirm('确定删除选定的用户吗?')){this.document.form.submit();return true;}return false;}" type=submit value='删除用户' name=act>
<input class=button onClick="{if(confirm('确定激活选定的用户吗?')){this.document.form.submit();return true;}return false;}" type=submit value='激活用户' name=act>
<input class=button onClick="{if(confirm('确定锁定选定的用户吗?')){this.document.form.submit();return true;}return false;}" type=submit value='锁定用户' name=act>
<input class=button onClick="{if(confirm('确定转移选定的用户吗?')){this.document.form.submit();return true;}return false;}" type=submit value='转移用户' name=act> →
<select name='sUserGrade'>
<option value=''>↓请选择用户组↓</option>
<%
Set RsObj = Newasp.Execute("Select GroupName,Grades From NC_UserGroup where Grades <> 0 order by Groupid")
Do While Not RsObj.EOF
Response.Write Chr(9) & Chr(9) & "<option value=""" & RsObj("Grades") & "," & RsObj("GroupName") & """>"
Response.Write RsObj("GroupName")
Response.Write "</option>" & vbCrLf
RsObj.movenext
Loop
Set RsObj = Nothing
%>
</select>
</td>
</tr></form>
<tr>
<td colspan=10 class=tablerow1><%Call showpage()%></td>
</tr>
</table>
<%
End Sub
Private Sub AddUser()
Call PageTop
%>
<table border=0 align=center cellpadding=3 cellspacing=1 class=tableborder>
<tr>
<th colspan=2>添加会员</th>
</tr>
<form name=myform method=post action=?action=save>
<tr>
<td width='30%' align=right class=tablerow1><strong>登陆名称:</strong></td>
<td width='70%' class=tablerow1><input type=text name=username size=20 value=''></td>
</tr>
<tr>
<td align=right class=tablerow2><strong>用户密码:</strong></td>
<td class=tablerow2><input type=password name=password1 size=20></td>
</tr>
<tr>
<td align=right class=tablerow1><strong>确认密码:</strong></td>
<td class=tablerow1><input type=password name=password2 size=20></td>
</tr>
<tr>
<td align=right class=tablerow2><strong>用户昵称:</strong></td>
<td class=tablerow2><input type=text name=nickname size=20 value=''></td>
</tr>
<tr>
<td align=right class=tablerow1><strong>用户邮箱:</strong></td>
<td class=tablerow1><input type=text name=usermail size=30 value='<%=Newasp.MasterMail%>'></td>
</tr>
<tr>
<td align=right class=tablerow2><strong>用户姓别:</strong></td>
<td class=tablerow2><select name='UserSex'>
<option value='男'>帅哥</option>
<option value='女'>美女</option>
</select></td>
</tr>
<tr>
<td align=right class=tablerow1><strong>所属用户组:</strong></td>
<td class=tablerow1><select name='UserGrade'>
<%
Set RsObj = Newasp.Execute("Select GroupName,Grades From NC_UserGroup where Grades <> 0 order by Groupid")
Do While Not RsObj.EOF
Response.Write Chr(9) & Chr(9) & "<option value=""" & RsObj("Grades") & "," & RsObj("GroupName") & """"
If RsObj("Grades") = 1 Then Response.Write " selected"
Response.Write ">"
Response.Write RsObj("GroupName")
Response.Write "</option>" & vbCrLf
RsObj.movenext
Loop
Set RsObj = Nothing
%>
</select></td>
</tr>
<tr>
<td align=right class=tablerow2><strong>用户点数:</strong></td>
<td class=tablerow2><input type=text name=userpoint size=10 value='50'></td>
</tr>
<tr align=center>
<td colspan=2 class=tablerow1>
<input type=button name=Submit2 onclick="javascript:history.go(-1)" value='返回上一页' class=Button>
<input type=Submit name=Submit1 value='添加用户' class=Button></td>
</tr>
</form>
</table>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?