📄 manageuser.asp
字号:
<!--#INCLUDE FILE="checklogin1.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<head>
<title><%=version%>--用户管理</title>
<link rel="stylesheet" type="text/css" href="include/site.css">
</head>
<BR>
<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 bgcolor=<%=bodycolor%>>
<table width=95% border=0 align="center" cellpadding=3 cellspacing=1>
<tr bgcolor='<%=Tabletitlecolor%>'>
<td><font color="<%=TablefontColor%>">欢迎<b><%=session("name")%></b>进入管理页面</font>
</td>
</tr>
<tr bgcolor=<%=tablebodycolor2%>>
<td width="100%" valign=top><font color="<%=TableContentColor%>"> </font>
</td>
</tr>
</table>
<%
call main()
set rs=nothing
conn.close
set conn=nothing
sub main()
if request("action")="save" then
call update()
else
call userinfo()
end if
end sub
sub userinfo()
set rs=server.createobject("adodb.recordset")
sql="Select * from [user] where userid='"&trim(request("name"))&"'"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
call error(errmsg)
exit sub
else
%>
<BR>
<form method="POST" action=ManageUser.asp?action=save>
<table width="95%" border="0" cellspacing="1" cellpadding="3" align=center bgcolor=<%=Tablebordercolor%>>
<tr bgcolor=<%=Tabletitlecolor%>>
<td height="11" colspan="2" ><font color="<%=TableContentColor%>"><b><%=htmlencode(rs("userid"))%>的个人资料</b></font></td>
</tr>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="18"><font color="<%=TableContentColor%>">用户名</font></td>
<td width="59%" height="18">
<%=htmlencode(rs("userid"))%>
<input type="hidden" name="Name" size="35" value="<%=request("name")%>">
</td>
</tr>
<tr bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">用户密码</font></td>
<td width="59%" height="18">
<input type="password" name="userpwd" size="35" value="<%=htmlencode(rs("userpwd"))%>" Class=InputStyle Disabled>
</td>
</tr>
<tr bgcolor=<%=Tablebodycolor2%>>
<td height="11" ><font color="<%=TableContentColor%>">真实姓名</font></td>
<td height="11" >
<%=rs("realname")%>
</td>
</tr>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="18"><font color="<%=TableContentColor%>">邮件地址</font></td>
<td width="59%" height="18">
<input type="text" name="Email" size="35" value="<%=rs("Email")%>">
</td>
</tr>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="18"><font color="<%=TableContentColor%>">联系电话</font></td>
<td width="59%" height="18">
<%if rs("telephone")<>"" then response.write rs("telephone") else response.Write("未注册")%>
</td>
</tr>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="18"><font color="<%=TableContentColor%>">工作单位</font></td>
<td width="59%" height="18">
<%if rs("workshop")<>"" then response.write rs("workshop") else response.Write("未注册")%>
</td>
</tr>
<%if rs("isadmin")=0 then%>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="8"><font color="<%=TableContentColor%>">用户等级</font></td>
<td width="59%" height="-2"> <select name="select" size="1">
<option selected value="普通用户">普通用户</option>
<option value="高级用户">高级用户</option>
<option value="超级用户">超级用户</option>
</select></td>
</tr>
<%elseif rs("isadmin")=1 then%>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="8"><font color="<%=TableContentColor%>">用户等级</font></td>
<td width="59%" height="-2"> <select name="select" size="1">
<option value="普通用户">普通用户</option>
<option selected value="高级用户">高级用户</option>
<option value="超级用户">超级用户</option>
</select></td>
</tr>
<%elseif rs("isadmin")=2 then%>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="8"><font color="<%=TableContentColor%>">用户等级</font></td>
<td width="59%" height="-2"> <select name="select" size="1">
<option value="普通用户">普通用户</option>
<option value="高级用户">高级用户</option>
<option selected value="超级用户">超级用户</option>
</select></td>
</tr>
<%else
response.write"你无权修改该用户的等级,请与系统管理员直接联系。"
end if%>
<%if rs("locked")=flase then %>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="18"><font color="<%=TableContentColor%>">锁定用户</font></td>
<td width="59%" height="18">
<select name="locked" size="1">
<option value="false" selected>否 </option>
<option value="true">是 </option>
</select>
</td>
</tr>
<%else%>
<tr bgcolor=<%=Tablebodycolor2%>>
<td width="41%" height="18"><font color="<%=TableContentColor%>">锁定用户</font></td>
<td width="59%" height="18">
<select name="locked" size="1">
<option value="false">否 </option>
<option value="true" selected>是 </option>
</select>
</td>
</tr>
<%end if%>
<tr bgcolor=<%=Tabletitlecolor%>>
<td height="23" colspan="2" align="center" >
<input type="submit" name="Submit" value="更 新">
<input type="button" name="Submit2" value="返 回" onclick="javascript:history.back()">
</td>
</tr>
</table>
</form>
<%
end if
rs.close
set rs=nothing
end sub
sub update()
on error resume next
set rs=server.createobject("adodb.recordset")
sql="Select * from [user] where userid='"&trim(request("name"))&"'"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
errmsg=errmsg+"<br>"+"<li>该用户名不存在。"
call error()
exit sub
else
dim locked,level
if request.form("locked")="false" then
locked=false
else request.form("locked")="true"
locked=true
end if
select case request.form("select")
case "普通用户"
level=0
case "高级用户"
level=1
case "超级用户"
level=2
end select
rs("email")=request.form("email")
rs("locked")=locked
rs("isadmin")=level
rs.update
rs.close
end if
set rs=nothing
%><center><p><b>更新用户数据成功</b>
<br><br>
<a href="listuser.asp">返回到用户管理页面</a>
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -