📄 admin_add.asp
字号:
<!--#include file="config.asp"-->
<!--#include file="Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<!--#include file="Conn.asp"-->
<!--#include file="inc/Md5.asp"-->
<%
'添加管理员
dim username,password,userqx
If Request.QueryString("action")="Admin_Add" then
username=request.form("username")
password=request.form("password")
userqx=request.form("userqx")
If username="" or password="" then
Response.Write "<script>alert('管理员用户名或者密码不能为空!');this.location.href='admin_add.asp?action=Admin_add';</SCRIPT>"
Response.End
End If
If len(password)<6 then
Response.Write "<script>alert('密码不要小于6个字符!;');this.location.href='admin_add.asp?action=Admin_add';</SCRIPT>"
Response.End
End If
If request("password")<>request("password1") then
Response.Write "<script>alert('两次密码不一致!');this.location.href='admin_add.asp?action=Admin_add';</SCRIPT>"
Response.End
End If
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from A_admin"
mRs.open Sql,conn,1,3
mRs.addnew
mRs("username")=trim(request("username"))
mRs("password")=md5(request("password"))
mRs("userqx")=trim(request("userqx"))
mRs.update
mRs.close
Set mRs=nothing
Response.Write "<script>alert('管理员添加成功!');this.location.href='admin_add.asp?action=Admin_list';</SCRIPT>"
End If
%>
<%
'修改管理员
If Request.QueryString("action")="Admin_Modify" then
username=request.form("username")
password=request.form("password")
userqx=request.form("userqx")
If username="" or password="" then
Response.Write "<script>alert('管理员用户名或者密码不能为空!');this.location.href='admin_add.asp?action=Admin_list';</SCRIPT>"
Response.End
End If
If len(password)<6 then
Response.Write "<script>alert('密码不要小于6个字符!;');this.location.href='admin_add.asp?action=Admin_list';</SCRIPT>"
Response.End
End If
If request("password")<>request("password1") then
Response.Write "<script>alert('两次密码不一致!');this.location.href='admin_add.asp?action=Admin_list';</SCRIPT>"
Response.End
End If
Id=request("Id")
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from A_admin where Id="&Id
mRs.open Sql,conn,1,3
mRs("username")=request("username")
mRs("password")=md5(request("password"))
mRs("userqx")=trim(request("userqx"))
mRs.update
mRs.close
Set mRs=nothing
session("edip")=""
Response.Write "<script>alert('修改成功,请重新登陆!');this.location.href=window.open('check_userlogin.asp?action=Quit','_parent');</SCRIPT>"
End If
%>
<%
'删除管理员
If Request.QueryString("action")="Admin_del" then
Id=cint(trim(request("Id")))
Sql="delete * from A_admin where Id="&Id
conn.execute(Sql)
Set mRs=nothing
Response.Write "<script>alert('管理员删除成功!');this.location.href='?action=Admin_list';</SCRIPT>"
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; chamRset=gb2312">
<title></title>
<!-- #include file="Inc/Head.asp" -->
</head>
<body>
<table width="700" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<% If Request.QueryString("action")="Admin_add" then %>
<form action="admin_add.asp?action=Admin_Add" method="post" style="margin:0" onSubmit="return doCheck();">
<table border="0" align="center" cellpadding="2" cellspacing="1" width="700" bgcolor="#CCCCCC">
<tr>
<td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="a2">
<tr>
<td height="18" colspan="8" bgcolor="#0650D2" class="a1"><div align="center" class="a1">添加管理员</div></td>
</tr>
<tr>
<td width="4%" height="33">名称 </td>
<td width="26%"><input name="username" type="text" class="input"></td>
<td width="4%">权限</td>
<td width="12%"><select name="userqx" id="userqx">
<option value="0">管理员</option>
<option value="1">普通用户</option>
</select></td>
<td width="4%">密码</td>
<td width="22%"><input name="password" type="password" class="input"></td>
<td width="7%">确认密码</td>
<td width="21%"><input name="password1" type="password" class="input"></td>
</tr>
<tr><td height="33" colspan="8"><div align="center"><input name="Submit3" type="submit" value=" 添 加 " class="center"> </div></td>
</tr>
</table></td>
</tr>
</table>
</form>
<% End If %>
<%
If Request.QueryString("action")="Admin_modify" then
id=cint(trim(request("id")))
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from A_admin where Id="&Id
mRs.open Sql,conn,1,1
%>
<form action="admin_add.asp?id=<% =request.QueryString("id") %>&action=Admin_Modify" method="post" class="a2" style="margin:0">
<table border="0" align="center" cellpadding="2" cellspacing="1" width="700" bgcolor="#CCCCCC">
<tr>
<td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="a2">
<tr>
<td height="18" colspan="8" bgcolor="#0650D2" class="a1"><div align="center" class="a1">修改管理员</div></td>
</tr>
<tr>
<td width="4%" height="33">名称 </td>
<td width="26%"><input name="username" type="text" class="input" value="<% =mRs("username") %>">
<input name="id" type="hidden" value="<% =request("id") %>"></td>
<td width="4%">权限</td>
<td width="12%"><select name="userqx" id="userqx">
<option value="0">管理员</option>
<option value="1">普通用户</option>
</select></td>
<td width="4%">密码</td>
<td width="22%"><input name="password" type="password" class="input" id="password"></td>
<td width="7%">确认密码</td>
<td width="21%"><input name="password1" type="password" class="input" id="password1"></td>
</tr>
<tr><td height="33" colspan="8"><div align="center"> <input name="Submit" type="submit" value=" 修 改 " class="button">
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
<% End If %>
<%
If Request.QueryString("action")="Admin_list" then
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from A_admin"
mRs.open Sql,conn,1,1
%>
<table border="0" align="center" cellpadding="2" cellspacing="1" width="700" bgcolor="#CCCCCC">
<tr>
<td valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="a2">
<tr align="center">
<td width="13%" height="18" bgcolor="#449AE8" class="a1">ID</td>
<td width="40%" class="a1">管理员名称</td>
<td colspan="2" class="a1">操作</td>
</tr>
<% do while not mRs.eof %>
<tr onMouseOver="javascript:this.bgColor='#F7F7F7';" onMouseOut="javascript:this.bgColor='#F3F3F3';" align="center">
<td height="25"><% =mRs("Id") %></td>
<td><% =mRs("username") %></td>
<td width="10%"><a href="admin_add.asp?action=Admin_modify&id=<% =mRs("Id") %>">修改密码</a></td>
<td width="10%"><a href="admin_add.asp?id=<% =mRs("Id") %>&action=Admin_del">删除管理</a></td>
</tr>
<%
mRs.movenext
loop
%>
</table>
<% End If %> </td>
</tr>
</table> </td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -