📄 user_manage.asp
字号:
<%
if request.cookies("flag")="" then
response.write "<script>top.location.href=""login.asp"";</script>"
response.end
end if
%>
<!--#include file="dbconn.asp"-->
<%
dim action
action=request("action")
id=request("id")
username=request.form("username")
password=request.Form("password")
if action="edit" then
cx=request.cookies("cx")
if cx=1 then
response.write "这是测试版,无法更改管理员密码!"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from user where id="&id
rs.open sql,conn,1,3
rs("password")=password
rs.update
rs.close
set rs=nothing
response.Write("修改成功!")
'response.end
end if
if action="add" then
set rs=server.Createobject("adodb.recordset")
sql="select * from user"
rs.open sql,conn,1,3
rs.addnew
rs("username")=username
rs("password")=password
rs("memo")=0
rs.update
rs.close
set rs=nothing
response.write("管理员添加成功!")
end if
if action="del" then
usermemo=request("usermemo")
if usermemo=1 then
response.write "此用户为超级用户,不能删除!"
else
set rs2=conn.execute("delete * from user where id="&id)
set rs2=nothing
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="css/style.css" type=text/css rel=stylesheet>
<title>用户管理</title>
</head>
<body BGCOLOR="#FFFFFF">
<%
cx=request.cookies("cx")
if cx="" or cx<1 then
response.write "<script language=javascript>" & chr(13) & "alert('你无权进行此项操作!');" & "history.back()" & "</script>"
end if
%> <form name="form2" method="post" action="user_manage.asp?action=add"> <div align="center"><P><font color="#808080" style="font-size: 9pt">
<strong><FONT COLOR="#000000">添加新用户:</FONT></strong> </font></P><P><FONT COLOR="#808080" STYLE="font-size: 9pt"><B>用户名:<input name="username" id="classname" style="border: 1 solid #808080" size="10"> 密码:<INPUT NAME="password" ID="classname" STYLE="border: 1 solid #808080" SIZE="10"></B>
<input type="submit" name="Submit2" value="添加"> </FONT> </P></div></form><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#CCCCCC" width="100%" id="AutoNumber1">
<tr bgcolor="#CCCCCC"> <td width="13%" height="20"> <div align="center"><strong>序号</strong></div></td><TD WIDTH="16%">
<DIV ALIGN="center"><STRONG>用户名 </STRONG></DIV></TD><TD WIDTH="19%"> <DIV ALIGN="center"><STRONG>密码 </STRONG></DIV></TD><td width="18%">
<div align="center"><strong>管理员类型 </strong></div></td><td width="34%"><div align="center"><strong>操作</strong></div></td></tr>
<%
set rs=server.CreateObject("ADODB.recordset")
sql="select * from user order by id"
rs.open sql,conn,1,3
do while not rs.eof
%> <form name="form1" method="post" action="user_manage.asp?id=<%=rs("id")%>&action=edit">
<tr> <td width="13%" height="27"> <div align="center"><font color="#808080" style="font-size: 9pt">
<input name="id" id="id" style="border: 1 solid #808080" VALUE="<%=rs("id")%>" size="10">
</font></div></td><TD WIDTH="16%"><DIV ALIGN="CENTER"><FONT COLOR="#808080" STYLE="font-size: 9pt">
<INPUT NAME="username" ID="classname" STYLE="border: 1 solid #808080" VALUE="<%=rs("username")%>" SIZE="10">
</FONT> </DIV><DIV ALIGN="center"></DIV></TD><TD WIDTH="19%"><DIV ALIGN="CENTER"><FONT COLOR="#808080" STYLE="font-size: 9pt">
<INPUT NAME="password" ID="classname" STYLE="border: 1 solid #808080" VALUE="<%=rs("password")%>" SIZE="10">
</FONT> </DIV><DIV ALIGN="center"></DIV></TD><td width="18%"><DIV ALIGN="CENTER"><font color="#808080" style="font-size: 9pt">
<input name="memo" id="classname" style="border: 1 solid #808080" VALUE="<%
memo=rs("memo")
if memo=1 then response.write "超级管理员"
if memo=0 then response.write "普通管理员"
%>" size="10"> </font> </DIV><div align="center"></div></td><td width="34%"><div align="center">
<input type="submit" name="Submit" value="修改"> <input type="button" name="Submit3" onclick="location.href='user_manage.asp?action=del&id=<%=rs("id")%>&usermemo=<%=rs("memo")%>'" value="删除">
</div></td></tr> </form><%
rs.movenext
loop
rs.close
set rs=nothing
%> </table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -