📄 admin_admin.asp
字号:
dim UserID,Purview
UserID=trim(Request("ID"))
if UserID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定要修改的管理员ID</li>"
exit sub
else
UserID=Clng(UserID)
end if
sql="Select * from Admin where ID=" & UserID
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
if rs.Bof and rs.EOF then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>不存在此用户!</li>"
else
Purview=rs("Purview")
%>
<form method="post" action="Admin_Admin.asp" name="form1" onsubmit="javascript:return CheckModify();">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" >
<tr class="title">
<td height="22" colspan="2"> <div align="center"><font size="2"><strong>修
改 管 理 员 信 息</strong></font></div></td>
</tr>
<tr>
<td width="300" class="tdbg"><strong>用 户 名:</strong></td>
<td class="tdbg"><%=rs("UserName")%> <input name="ID" type="hidden" value="<%=rs("ID")%>"></td>
</tr>
<tr>
<td width="300" class="tdbg"><strong>新 密 码:</strong><br><font color="#0000FF">如果不想修改,请保持为空</font></td>
<td class="tdbg"><input type="password" name="Password">
</td>
</tr>
<tr>
<td width="300" class="tdbg"><strong>确认密码:</strong><br><font color="#0000FF">如果不想修改,请保持为空</font></td>
<td class="tdbg"><input type="password" name="PwdConfirm">
</td>
</tr>
<tr>
<td width="300" class="tdbg"><strong>权限设置: </strong></td>
<td class="tdbg"><select name="purview" id="purview">
<option value="1" <%if purview=1 then %>selected<% end if %>>超级用户</option>
<option value="2" <%if purview=2 then %>selected<% end if %>>高级管理员</option>
<option value="3" <%if purview=3 then %>selected<% end if %>>文章总编</option>
<option value="4" <%if purview=4 then %>selected<% end if %>>栏目编辑</option>
<option value="5" <%if purview=5 then %>selected<% end if %>>文章录入员</option>
</select>
<input name="OldPurview" type="hidden" id="OldPurview" value="<%=purview%>"></td>
</tr>
<tr>
<td colspan="2" align="center" class="tdbg"><input name="Action" type="hidden" id="Action" value="SaveModify">
<input type="submit" name="Submit" value=" 确 定 " style="cursor:hand;">
<input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='Admin_Admin.asp'" style="cursor:hand;"></td>
</tr>
</table>
</form>
<%
end if
rs.close
set rs=nothing
end sub
%>
<%
sub ShowHelp()
%>
<br>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="border">
<tr class="title">
<td height="22" colspan="2"><strong>管理员权限说明</strong></td>
</tr>
<tr valign="top" class="tdbg">
<td width="120" align="right"><strong>文章录入员:</strong></td>
<td>只有添加文章的权限。文章发表后不能更改所属栏目及专题,但可以修改和删除自己发表的文章。</td>
</tr>
<tr valign="top" class="tdbg">
<td width="120" align="right"><strong>栏目编辑:</strong></td>
<td>相当于论坛的版主,在自己所管理的栏目(含下属子栏目)里拥有“文章审核”、“固顶”、“推荐”等各种管理权限。</td>
</tr>
<tr valign="top" class="tdbg">
<td width="120" align="right"><strong>文章总编:</strong></td>
<td>拥有所有文章栏目的管理权限。</td>
</tr>
<tr valign="top" class="tdbg">
<td width="120" align="right"><strong>高级管理员:</strong></td>
<td>除上述权限之外,拥有栏目管理、专题管理、评论管理、公告管理、广告管理、友情链接管理、网站调查管理、注册用户管理权限。</td>
</tr>
<tr valign="top" class="tdbg">
<td width="120" align="right"><strong>超级用户:</strong></td>
<td>拥有所有管理权限。</td>
</tr>
</table>
<%
end sub
%>
</body>
</html>
<%
sub SaveAdd()
dim username, password,PwdConfirm, purview
dim ClassID
username=trim(Request("username"))
password=trim(Request("Password"))
PwdConfirm=trim(request("PwdConfirm"))
purview=trim(Request("purview"))
ClassID=trim(request("ClassID"))
if username="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>用户名不能为空!</li>"
end if
if password="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>初始密码不能为空!</li>"
end if
if PwdConfirm<>Password then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>确认密码必须与初始密码相同!</li>"
end if
if purview="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>用户权限不能为空!</li>"
else
purview=CInt(purview)
end if
if FoundErr=True then
exit sub
end if
sql="Select * from Admin where username='"&username&"'"
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
if not (rs.bof and rs.EOF) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>数据库中已经存在此管理员!</li>"
rs.close
set rs=nothing
exit sub
end if
password=md5(password)
rs.addnew
rs("username")=username
rs("password")=password
rs("purview")=purview
rs.update
rs.Close
if purview=4 and ClassID<>"" then
sql="select ClassMaster from ArticleClass where ClassID in (" & ClassID & ")"
rs.open sql,conn,1,3
do while not rs.eof
if rs(0)="" then
rs(0)=UserName
else
rs(0)=rs(0) & "|" & UserName
end if
rs.update
rs.movenext
loop
rs.close
end if
set rs=Nothing
Call main()
end sub
sub SaveModify()
dim UserID, UserName,password,PwdConfirm,Purview,OldPurview
UserID=trim(Request("ID"))
if UserID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定要修改的管理员ID</li>"
else
UserID=Clng(UserID)
end if
password=trim(Request("Password"))
PwdConfirm=trim(request("PwdConfirm"))
purview=trim(Request("purview"))
if PwdConfirm<>Password then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>确认密码必须与新密码相同!</li>"
end if
if purview="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>用户权限不能为空!</li>"
else
purview=CInt(purview)
end if
if FoundErr=True then
exit sub
end if
sql="Select * from Admin where ID=" & UserID
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
if rs.Bof and rs.EOF then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>不存在此用户!</li>"
rs.close
set rs=nothing
exit sub
end if
if Password<>"" then
rs("password")=md5(password)
end if
rs("purview")=purview
rs.update
if OldPurview=4 and Purview<>4 then
call RemoveClassMaster(rs("UserName"))
end if
rs.Close
set rs=Nothing
call main()
end sub
sub DelAdmin()
dim UserID
UserID=trim(Request("ID"))
if UserID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定要删除的管理员ID</li>"
exit sub
end if
if instr(UserID,",")>0 then
UserID=replace(UserID," ","")
sql="Select * from Admin where ID in (" & UserID & ")"
else
UserID=clng(UserID)
sql="select * from Admin where ID=" & UserID
end if
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
do while not rs.eof
if rs("Purview")=4 then
call RemoveClassMaster(rs("UserName"))
end if
rs.delete
rs.update
rs.movenext
loop
rs.close
set rs=nothing
call main()
end sub
sub RemoveClassMaster(UserName)
dim sqlMaster,rsMaster,ClassMaster
sqlMaster="select ClassMaster from ArticleClass"
Set rsMaster=Server.CreateObject("Adodb.RecordSet")
rsMaster.open sqlMaster,conn,1,3
do while not rsMaster.eof
if rsMaster(0)<>"" then
ClassMaster=rsMaster(0)
ClassMaster=replace(ClassMaster,"|" & UserName,"")
ClassMaster=replace(ClassMaster,UserName & "|","")
ClassMaster=replace(ClassMaster,Username,"")
rsMaster(0)=ClassMaster
rsMaster.update
end if
rsMaster.movenext
loop
rsMaster.close
set rsMaster=nothing
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -