📄 usermng.asp
字号:
<!--#include file="include/common.inc"-->
<%
public sub removeUser(userId)
checkSession
dim strQuery
if getUserRank() <> 1 then
closeConnection
response.Redirect "err.asp?err=您无权删除用户"
end if
if getUser = userId then
closeConnection
response.Redirect "err.asp?err=您不能删除自己"
end if
strQuery="delete from userinfo where userid='" & userId & "'"
getConnection().Execute strQuery
addlog "remove user" & userId, "userinfo"
end sub
public function checkNameConflict(strName)
checkSession
dim adoRS
dim strQuery
strQuery="select * from userinfo where userid='" & strName & "'"
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
checkNameConflict = 0
else
checkNameConflict = 1
end if
set adoRS = Nothing
end function
public sub addUser(userid, rank)
checkSession
if getUserRank() <> 1 then
closeConnection
response.Redirect "err.asp?err=您无权增加用户"
end if
if checkNameConflict(userid) = 1 then
closeConnection
response.Redirect "err.asp?err=账号名称已存在"
response.End()
end if
Dim strInsert
strInsert = "insert into userinfo(userid,purview) values('"
strInsert = strInsert & userid & "'," & CInt(rank) & ")"
getConnection().Execute strInsert
addlog "add user" & userid, "userinfo"
end sub
%>
<%
dim userid
dim op
userid = "" & Trim(request.QueryString("userid"))
op = "" & Trim(request.QueryString("op"))
if op <> "" then
if op = "del" then
if userid <> "" then
removeUser userid
end if
elseif op = "addAdmin" then
if userid <> "" then
addUser userid,1
end if
elseif op = "addUser" then
if userid <> "" then
addUser userid,0
end if
end if
end if
%>
<%
dim adoRS
dim strQuery
strQuery = "select * from userinfo"
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" src="../include/tools.js"></script>
</head>
<body>
<table width="95%" border="1">
<tr>
<td><div align="center">用户账号</div></td>
<td><div align="center">用户身份</div></td>
<td><div align="center">操作</div></td>
</tr>
<%
while not adoRS.EOF
%>
<tr>
<td><div align="center"><%=adoRS("userid")%></div></td>
<td><div align="center"><%=getRankStr(adoRS("userid"))%></div></td>
<td><div align="center"> <a href="javascript:doWhenConfirm('确定要删除<%=adoRS("userid")%>吗?','usermng.asp?op=del&userid=<%=adoRS("userid")%>')">删除</a></div></td>
</tr>
<%
adoRS.MoveNext
Wend
%>
</table>
<p><a href="javascript:doWhenInput('请输入账号名称','usermng.asp?op=addUser&userid=')">增加用户</a></p>
<p><a href="javascript:doWhenInput('请输入账号名称','usermng.asp?op=addAdmin&userid=')">增加系统管理员</a></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -