📄 adminadmin.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="sub/config.asp"-->
<!--#include file="sub/conn.asp"-->
<!--#include file="sub/inc.asp"-->
<!--#include file="sub/md5.asp"-->
<%
call hacker()
if session("admin")<>"axsj" then
response.Write "<script>alert('您还没有登陆!');this.location.href='index.asp';</script>"
Response.End
end if
if session("adminsuper")<>"admin" then
response.Write "<script>alert('对不起!您不是高层管理员!请返回');this.location.href='javascript:history.go(-1)';</script>"
end if
adminname=session("adminname")
adminsuper=session("adminsuper")
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=Sitename%>-后台管理系统</title>
<link href="img/index.css" rel="stylesheet" type="text/css" />
<link href="img/dex.css" rel="stylesheet" type="text/css" />
<link href="img/dex2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--#include file="top.asp"-->
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height="4" colspan="2" background="images/index_11.gif"></td>
</tr>
<tr>
<td width="200" align="center" valign="top">
<% '调用左边框架
call adminleft()%>
<p> </p> </td>
<td width="580" align="center" valign="top" bgcolor="#EDFFFF">
<%
if request("type")<>"edit" then
action=request("action")
select case action
case "add"
call add()
case "del":
call del()
case "cng"
call cng()
end select
sub add()
if request.Form("name")<>"" and request.Form("pwd")<>"" then
pass=request.Form("pwd")
adminname=request.Form("name")
super=request.form("super")
set rs1=server.createobject("adodb.recordset")
sql1="select * from ax_admin where admin_name='"&adminname&"'"
rs1.open sql1,cn,3,3
if not (rs1.eof and rs1.eof) then
Response.Write "添加失败,用户名重复"
else
rs1.addnew
rs1("admin_name")=adminname
rs1("admin_pass")=md5(pass)
rs1("admin_super")=super
rs1.update
response.Write"上一步操作:添加"&rs1("admin_name")&"成功!"
rs1.close
set rs1=nothing
end if
else response.Write"上一步操作:用户名称或密码不能为空"
end if
end sub
sub del()
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from ax_admin where id="&request("id")
rs1.open sql1,cn,1,3
rs1.delete
response.Write"上一步操作:删除成功!"
rs1.close
set rs1=nothing
end sub
sub cng()
if request.Form("pwd")<>"" and request.Form("pwd2")<>"" then
if request.form("pwd")=request.form("pwd2") then
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from ax_admin where id="&request("id")
rs1.open sql1,cn,1,3
pass=request.Form("pwd")
rs1("admin_pass")=md5(pass)
rs1.update
response.Write"上一步操作:修改成功!"
rs1.close
set rs1=nothing
else
response.Write"上一步操作:修改失败,两次密码不一致!"
end if
else
response.Write"上一步操作:修改失败,密码不能为空!"
end if
end sub
%>
<table width="500" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="200" align="center" bgcolor="#3A82C4">管理员名称</td>
<td width="200" align="center" bgcolor="#3A82C4">权限</td>
<td width="100" align="center" bgcolor="#3A82C4">操作</td>
</tr>
<% sqlstr ="select * from ax_admin order by id desc" '查表
set rs =cn.execute(sqlstr) '利用connection的execute方法运行SQL命令
Do While (Not RS.Eof)
%><tr>
<td align="center"><%=rs("admin_name")%></td>
<td align="center"><%if rs("admin_super")="admin" then response.Write "高层管理员" else response.write "基层管理员" end if%></td>
<td align="center"><a href="?type=edit&id=<%=rs("id")%>">修改密码 </a> <a href="?action=del&id=<%=rs("id")%>">删除</a></td>
</tr>
<%
rs.movenext
loop
set rs =nothing%>
</table>
<br />
<form id="form1" name="form1" method="post" action="?action=add">
<table width="500" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="left" bgcolor="#3C82C4"> ※ 添加管理员</td>
</tr>
<tr>
<td> 名称:
<label>
<input name="name" type="text" class="wubian" id="name" size="16" maxlength="20" />
</label>
密码:
<input name="pwd" type="password" class="wubian" id="pwd" size="16" maxlength="20" />
权限:
<label>
<select name="super" class="wubian" id="super">
<option value="1">基层管理员</option>
<option value="admin">高层管理员</option>
</select>
<input name="Submit" type="submit" class="wubian" value="添 加" />
</label></td>
</tr>
</table></form><%else%>
<%set rs1=server.CreateObject("adodb.recordset")
sql1="select * from ax_admin where id="&request("id")
rs1.open sql1,cn,1,2%>
<form id="form2" name="form2" method="post" action="?action=cng&id=<%=request("id")%>">
<table width="200" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="20" align="left" bgcolor="#3C82C4"> ※ 修改密码</td>
</tr>
<tr>
<td height="20" align="left">名称: <%=rs1("admin_name")%></td>
</tr>
<tr>
<td height="20" align="left">密码:
<input name="pwd" type="password" class="wubian" id="pwd" size="16" maxlength="20" /></td>
</tr>
<tr>
<td height="20" align="left">确认:
<input name="pwd2" type="password" class="wubian" id="pwd2" size="16" maxlength="20" /></td>
</tr>
<tr>
<td height="20" align="center"><label>
<input name="Submit2" type="submit" class="wubian" value="确认修改" />
</label></td>
</tr>
</table></form>
<%
rs1.close
set rs1=nothing
end if%>
</td>
</tr>
</table>
<!--#include file="bottom.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -