📄 user.asp
字号:
<!--#include file=check.asp-->
<!--#include file=conn.asp-->
<title>用户管理</title>
<link href=../style.css rel=stylesheet type=text/css>
<body topmargin="0" leftmargin="0" style="cursor:url(../images/2.gif)">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form method=post action=user.asp>
<tr>
<td height="22"bgcolor="#9AFF9A">当前管理:<font color="#FF0000">管理用户</font>
<input name="add" type="submit" id="add" value="增加"class="button">
<input name="del" type="submit" id="del" value="删除"class="button">
<input name="edit" type="submit" id="edit" value="修改"class="button"></td>
</tr>
</form>
<%if request("add")="增加" then%>
<tr><td height=20></td></tr>
<tr>
<td>
<%if request("add2")="添加" then
name=trim(request("name"))
pwd=trim(request("pwd"))
if name="" then
response.write"<script>alert('管理员帐号不能为空!');history.back();</script>"
elseif pwd="" then
response.write"<script>alert('管理员密码不能为空!');history.back();</script>"
else
rs.open"select * from admin where name='"&name&"'",conn,1,3
if not rs.eof then
response.write"<script>alert('管理员帐号已经存在!');history.back();</script>"
else
rs.addnew
rs("name")=name
rs("pwd")=pwd
rs.update
response.write"<script>alert('管理员添加成功!');window.navigate('user.asp?add=增加');</script>"
end if
rs.close
end if
end if%>
<form method=post action=user.asp?add=增加><table width="40%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#99CC99">
<tr align="center" bgcolor="eeeeee">
<td height="25" colspan="2"><span class="style1">添加管理员</span></td>
</tr>
<tr>
<td width="21%" height="22" align="center">帐号</td>
<td width="79%"><input name="name" type="text" id="name" size="12" class="style2"></td>
</tr>
<tr>
<td height="22" align="center">密码</td>
<td><input name="pwd" type="password" id="pwd" size="12"class="style2"></td>
</tr>
<tr align="center" bgcolor="eeeeee">
<td height="25" colspan="2"><input name="add2" type="submit" id="add2" value="添加"class="button">
<input name="clear" type="reset" id="clear" value="清除"class="button"></td>
</tr>
</table></form></td>
</tr>
<%elseif request("del")="删除" then%>
<tr><td height=20></td></tr>
<tr>
<td>
<%if request("del2")="删除" then
id=cint(request("id"))
rs.open"select * from admin where id="&id,conn,1,3
rs.delete
rs.close
response.write"<script>alert('删除管理员成功!');window.navigate('user.asp?del=删除');</script>"
end if%>
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
<tr align="center" bgcolor="99cc99">
<td height="22">帐号</td>
<td>密码</td>
<td>操作</td>
</tr>
<%rs.open"select * from admin",conn,1,1
while not rs.eof%>
<form method=post action=user.asp?del=删除&id=<%=rs("id")%>>
<tr>
<td align="center"><%=rs("name")%></td>
<td align="center"><%for i=1 to len(rs("pwd"))%>*<%next%></td>
<td align="center"><input type=submit name="del2" value="删除"></td>
</tr></form>
<%rs.movenext
wend
rs.close%>
</table></td>
</tr>
<%elseif request("edit")="修改" then%>
<tr><td height=20></td></tr>
<tr>
<td>
<%if request("edit3")="修改" then
response.write request("name")
id=cint(request("id"))
name=trim(request("name"))
oldpwd=trim(request("oldpwd"))
newpwd=trim(request("newpwd"))
if name="" then
response.write"<script>alert('帐号不能为空!');window.navigate('user.asp?edit=修改&id="&id&"&edit2=修改');</script>"
elseif oldpwd="" then
response.write"<script>alert('原密码不能为空!');window.navigate('user.asp?edit=修改&id="&id&"&edit2=修改');</script>"
elseif newpwd="" then
response.write"<script>alert('新密码不能为空!');window.navigate('user.asp?edit=修改&id="&id&"&edit2=修改');</script>"
else
rs.open"select * from admin where id="&id,conn,1,3
rs2.open"select * from admin where id<>"&id,conn,1,1
while not rs2.eof
if name=rs2("name") then
response.write"<script>alert('帐号已经存在!');window.navigate('user.asp?edit=修改&id="&id&"&edit2=修改');</script>"
end if
rs2.movenext
wend
rs2.close
if oldpwd<>rs("pwd") then
response.write"<script>alert('原密码错误!');window.navigate('user.asp?edit=修改&id="&id&"&edit2=修改');</script>"
else
rs("name")=name
rs("pwd")=newpwd
rs.update
response.write"<script>alert('修改管理员成功!');window.navigate('user.asp?edit=修改');</script>"
end if
rs.close
end if
end if %>
<%if request("edit2")="修改" then
id=cint(request("id"))
rs.open"select * from admin where id="&id,conn,1,3
%><form method=post action=user.asp?edit=修改&id=<%=id%>>
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
<tr align="center" bgcolor="99cc99"><td colspan="2" height="22">修改管理员资料</td></tr>
<tr><td>帐号</td><td><input type=text name="name" value=<%=rs("name")%> class="style2"></td></tr>
<tr><td>原密码</td><td><input type=password name="oldpwd" class="style2"></td></tr>
<tr><td>新密码</td><td><input type=password name="newpwd" class="style2"></td></tr>
<tr align="center" bgcolor="99cc99"><td colspan="2">
<input type=submit name="edit3" value="修改"class="button">
<input type=reset name="clear" value="清除"class="button"></td></tr>
</form><%
response.end
end if%>
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
<tr align="center" bgcolor="99cc99">
<td height="22">帐号</td>
<td>密码</td>
<td>操作</td>
</tr>
<%rs.open"select * from admin",conn,1,1
while not rs.eof%>
<form method=post action=user.asp?edit=修改&id=<%=rs("id")%>>
<tr>
<td align="center"><%=rs("name")%></td>
<td align="center"><%for i=1 to len(rs("pwd"))%>·<%next%></td>
<td align="center"><input type=submit name="edit2" value="修改"class="button"></td>
</tr></form>
<%rs.movenext
wend
rs.close%>
</table></td>
</tr>
<%end if%>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -