📄 admin_user.asp
字号:
<!-- #include file="Setup.asp" -->
<!-- #include file="API_Request.asp" -->
<%
if RequestCookies("UserPassword")="" or RequestCookies("UserPassword")<>session("pass") then response.redirect "Admin_Default.asp"
UserName=HTMLEncode(Request("UserName"))
RoleID=RequestInt("RoleID")
RoleName=HTMLEncode(Request("RoleName"))
Description=HTMLEncode(Request("Description"))
if Request("menu")="ChangePassword" then ChangePassword
AdminTop
Log("")
select case Request("menu")
case "UserEdit"
UserEdit
case "SearchUser"
SearchUser
case "UserDelTopic"
UserDelTopic
case "UserDel"
UserDel
case "Userok"
Userok
case "ChangePassword"
ChangePassword
case "UserRankAdd"
UserRankAdd
case "UserRank"
UserRank
case "UserRankUp"
RankID=RequestInt("RankID")
RoleID=RequestInt("RoleID")
RankName=Request("RankName")
PostingCountMin=RequestInt("PostingCountMin")
if ""&RankName&""="" then Alert("您没有输入等级名称")
Rs.Open "select * from ["&TablePrefix&"Ranks] where RankID="&RankID&"",Conn,1,3
If Rs.eof Then Rs.Addnew()
Rs("RoleID")=RoleID
Rs("RankName")=RankName
Rs("PostingCountMin")=PostingCountMin
Rs.update()
Rs.close
response.write "更新成功"
case "UserRankDel"
Execute("Delete from ["&TablePrefix&"Ranks] where RankID="&Request("RankID")&"")
response.write "删除成功"
case "AllRoles"
AllRoles
case "CreateRole"
if RoleName=empty then Alert("您没有输入角色名称")
Execute("insert into ["&TablePrefix&"Roles] (Name) values ('"&RoleName&"')")
AllRoles
case "ViewRole"
ViewRole
case "UpRole"
if RoleName=empty then Alert("您没有输入角色名称")
RoleMaxFileSize=RequestInt("RoleMaxFileSize")
RoleMaxPostAttachmentsSize=RequestInt("RoleMaxPostAttachmentsSize")
Execute("update ["&TablePrefix&"Roles] Set Name='"&RoleName&"',Description='"&Description&"',RoleMaxFileSize="&RoleMaxFileSize&",RoleMaxPostAttachmentsSize="&RoleMaxPostAttachmentsSize&" where RoleID="&RoleID&"")
Response.Write("编辑成功")
case "RolePermissions"
RolePermissions
case "RolePermissionsUP"
for each ho in Request.Form("ForumID")
Rs.Open "Select * from ["&TablePrefix&"ForumPermissions] where ForumID="&ho&" and RoleID="&RoleID&"",Conn,1,3
if Rs.eof then
Rs.Addnew()
Rs("RoleID")=RoleID
Rs("ForumID")=ho
end if
Rs("PermissionView")=RequestInt("PermissionView"&ho)
Rs("PermissionRead")=RequestInt("PermissionRead"&ho)
Rs("PermissionPost")=RequestInt("PermissionPost"&ho)
Rs("PermissionReply")=RequestInt("PermissionReply"&ho)
Rs("PermissionEdit")=RequestInt("PermissionEdit"&ho)
Rs("PermissionDelete")=RequestInt("PermissionDelete"&ho)
Rs("PermissionCreatePoll")=RequestInt("PermissionCreatePoll"&ho)
Rs("PermissionVote")=RequestInt("PermissionVote"&ho)
Rs("PermissionAttachment")=RequestInt("PermissionAttachment"&ho)
Rs("PermissionManage")=RequestInt("PermissionManage"&ho)
Rs.update
Rs.close
next
Response.Write("批量权限设置成功")
case "DelRole"
if Roleid<4 then Alert("该角色为系统内置角色,无法删除")
if Not Execute("Select UserID From ["&TablePrefix&"Users] where UserRoleID="&RoleID&"" ).eof then Alert("只能删除没有成员的角色组!")
Execute("Delete from ["&TablePrefix&"Roles] where RoleID="&RoleID&"")
Response.Write("删除成功")
case else
SearchUserok
end select
Sub ChangePassword
Response.clear
if Request_Method = "POST" then
NewPassword1=Trim(Request("NewPassword1"))
NewPassword2=Trim(Request("NewPassword2"))
if NewPassword1<>NewPassword2 then Alert("您2次输入的密码不同")
if Len(NewPassword1)<6 then Alert("密码不能小于6位数")
'-------------------- API Start --------------------
Message=""
If SiteConfig("APIEnable")=1 Then APIUpdateUser UserName,NewPassword1,"","",""
if Message<>"" then AlertForModal(""&Message&"")
'-------------------- API End ----------------------
ModifyUserPassword UserName,NewPassword1,"","",""
%>
<script language="JavaScript" type="text/javascript">
alert('密码修改成功');
parent.BBSXP_Modal.Close();
</script>
<%
end if
%>
<title>修改密码</title>
<style>body,table{FONT-SIZE:9pt;}</style>
<form name=form action="Admin_User.asp?menu=ChangePassword" method="POST">
<input type=hidden name="UserName" value="<%=UserName%>">
修改密码 - (<%=UserName%>) <br /><br />
<table border="0" width="100%">
<tr>
<td>新密码: </td>
<td><input name="NewPassword1" type="password" maxlength="15" size="40" /></td>
</tr>
<tr>
<td>再次输入新密码: </td>
<td><input name="NewPassword2" type="password" maxlength="15" size="40" /></td>
</tr>
</table>
<br />
<input type="submit" value=" 修改密码 ">
</form>
<%
Response.End
End Sub
Sub SearchUser
%>
<SCRIPT type="text/javascript" src="Utility/calendar.js"></SCRIPT>
用户资料:<b><font color=red><%=Execute("Select count(UserID) from ["&TablePrefix&"Users]")(0)%></font></b> 条
<table cellspacing="1" cellpadding="5" width="100%" border="0" class=CommonListArea>
<form method="POST" action="?menu=SearchUserok">
<tr class=CommonListTitle>
<td align=center>用户搜索</td>
</tr>
<tr class="CommonListCell">
<td><br />
<div style="text-align:center"><input size="45" name="SearchText"> <input type="submit" value=" 搜 索 "></div>
<br /><br />
<fieldset>
<legend>根据排序</legend>
<select name=MemberSortDropDown>
<option value=UserName>用户名</option>
<option value=UserEmail>电子邮件</option>
<option value=TotalPosts>帖子数</option>
<option value=UserRegisterTime>注册日期</option>
<option value=UserActivityTime>最后活动日期</option>
</select>
<select name=SortOrderDropDown><option value=desc>倒序</option><option value=asc>顺序</option></select>
</fieldset><br />
<fieldset>
<legend>日期过滤</legend>
注册时间:<select name="JoinedDateComparer" onchange="javascript:if(this.options[this.selectedIndex].value != ''){$('UserRegisterTime').style.display='';}else{$('UserRegisterTime').style.display='none';}">
<option value="">----</option>
<option value="<">在此之前</option>
<option value="=">在此之时</option>
<option value=">">在此之后</option>
</select> <span id=UserRegisterTime style="display:none"><input size="24" name="JoinedDate_picker" onclick="showcalendar(event, this)" value="<%=date()%>"></span><br />
最后活动时间:<select name="LastPostDateComparer" onchange="javascript:if(this.options[this.selectedIndex].value != ''){$('UserActivityTime').style.display='';}else{$('UserActivityTime').style.display='none';}">
<option value="">----</option>
<option value="<">在此之前</option>
<option value="=">在此之时</option>
<option value=">">在此之后</option>
</select> <span id="UserActivityTime" style="display:none"><input size="24" name="LastPostDate_picker" onclick="showcalendar(event, this)" value="<%=date()%>"></span>
</fieldset><br />
<fieldset>
<legend>过 滤</legend>
角色:<select name="SearchRole">
<option value="">所有用户</option>
<%
sql="Select * from ["&TablePrefix&"Roles] where RoleID > 0 order by RoleID"
Set Rs=Execute(sql)
Do While Not Rs.EOF
Response.Write("<option value='"&Rs("RoleID")&"'>"&Rs("Name")&"</option>")
Rs.MoveNext
loop
Rs.Close
%>
</select><br />
搜索范围:<select name="SearchType">
<option value="UserName">用户名包含有</option>
<option value="UserEmail">邮箱包含有</option>
<option value="all">用户名或邮箱包含有</option>
</select><br />
状态:<select name="CurrentAccountStatus" size="1">
<option value="">所有状态</option>
<option value="0">正等待审核</option>
<option value="1">已通过审核</option>
<option value="2">已禁用</option>
<option value="3">未通过审核</option>
</select>
</fieldset>
<hr noshade="noshade" size="1" color=#999999 />
<fieldset>
<legend>快捷方式</legend>
<li><a href="?MemberSortDropDown=TotalPosts&SortOrderDropDown=desc">发帖排行</li></a>
<li><a href="?LastPostDateComparer==&LastPostDate_picker=<%=date()%>">过去 24 小时内活动的用户</li></a>
<li><a href="?JoinedDateComparer==&JoinedDate_picker=<%=date()%>">过去 24 小时内注册的用户</li></a>
<li><a href="?CurrentAccountStatus=0">等待审核的用户</a></li>
</fieldset>
</form>
</td>
</tr>
</table><br />
<%
End Sub
Sub SearchUserok
%>
<table cellspacing="1" cellpadding="5" width="100%" border="0" class=CommonListArea>
<TR align=center class=CommonListTitle>
<TD>用户名</TD>
<TD>Email</TD>
<TD>发帖数</TD>
<TD>注册时间</TD>
<TD>最后活动时间</TD>
<TD>动作</TD>
</TR>
<%
SearchType=HTMLEncode(Request("SearchType"))
SearchText=HTMLEncode(Request("SearchText"))
SearchRole=HTMLEncode(Request("SearchRole"))
CurrentAccountStatus=HTMLEncode(Request("CurrentAccountStatus"))
JoinedDateComparer=Left(Request("JoinedDateComparer"),1)
LastPostDateComparer=Left(Request("LastPostDateComparer"),1)
JoinedDate_picker=HTMLEncode(Request("JoinedDate_picker"))
LastPostDate_picker=HTMLEncode(Request("LastPostDate_picker"))
if SearchType="all" then SearchType="UserEmail like '%"&SearchText&"%' or UserName"
if SearchText<>"" then item=item&" and ("&SearchType&" like '%"&SearchText&"%')"
if JoinedDate_picker<>"" and JoinedDateComparer<>"" then item=item&" and DateDiff("&SqlChar&"d"&SqlChar&",'"&JoinedDate_picker&"',UserRegisterTime) "&JoinedDateComparer&" 0"
if LastPostDate_picker<>"" and LastPostDateComparer<>"" then item=item&" and DateDiff("&SqlChar&"d"&SqlChar&",'"&LastPostDate_picker&"',UserActivityTime) "&LastPostDateComparer&" 0"
if SearchRole <> "" then item=item&" and UserRoleID="&SearchRole&""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -