⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin.asp

📁 亿众购物系统 一套设计完善、高效的web商城解决方案
💻 ASP
字号:
<!--#include file="../Session.asp"-->
<!--#include file="../../Config/Md5.asp"-->
<%
Set rs = conn.execute("select * from admin order by AdminId")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/site.css" rel="stylesheet" type="text/css">
<script language="javascript">
	<!--//
	function check() {
		if ( document.form.AdminName.value == '' ) {
			window.alert('请输入名称!!');
			document.form.AdminName.focus();
			return false;
		}
		if ( document.form.AdminPass.value == '' ) {
			window.alert('请输入密码!!');
			document.form.AdminPass.focus();
			return false;
		}
		if ( document.form.AdminPass2.value == '' ) {
			window.alert('请再次输入密码!!');
			document.form.AdminPass2.focus();
			return false;
		}
		if ( document.form.AdminPass2.value != document.form.AdminPass.value) {
			window.alert('密码与确认密码不一致!!');
			document.form.AdminPass2.focus();
			return false;
		}
			return true;
			}
	//-->
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
  <tr> 
    <td height="50" colspan="5" align="center" class="tdstyle"><strong><font color="#000000" size="3">系统用户</font></strong></td>
  </tr>
  <tr> 
    <td width="10%" height="25" align="center" class="tdstyle">自动编号</td>
    <td width="35%" align="center" class="tdstyle">管理员名称</td>
    <td align="center" class="tdstyle">管理员密码</td>
    <td width="10%" align="center" class="tdstyle">修改</td>
    <td width="10%" align="center" class="tdstyle">删除</td>
  </tr>
  <%do while not rs.eof
  id=rs("AdminId")
  %>
  <form action="?atcion=amend" method="post" name="form1">
    <tr> 
      <td height="20" align="center" class="tdstyle"><% =id%> <input name="id" type="hidden" id="id" value="<%=id%>"></td>
      <td align="center" class="tdstyle"><input name="AdminName" type="text" class="input1" id="AdminName" value="<%=rs("AdminName")%>" size="15" maxlength="25"></td>
      <td align="center" class="tdstyle"><input name="AdminPass" type="password" class="input1" id="AdminPass" size="15" maxlength="50"></td>
      <td align="center" class="tdstyle"> <input name="Submit" type="submit" class="button" value="修改"></td>
      <td align="center" class="tdstyle"><input name="submit2" type="button" class="button2" value="删 除" onClick="if(confirm('您确定要删除吗?')) location.href='?action=del&id=<% =id%>'"></td>
    </tr>
  </form>
  <%rs.movenext
	loop
	rs.close
	set rs=nothing
	%>
  <tr align="center"> 
    <td height="25" colspan="5" class="tdstyle">注:如果修改管理员密码请输入新密码,否则请留空。</td>
  </tr>
</table>
<form action="?action=add" method="post" name="form">
  <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
    <tr> 
      <td height="50" colspan="2" align="center" valign="middle" class="tdstyle"><strong><font color="#000000" size="3">添加管理员</font></strong></td>
    </tr>
    <tr> 
      <td width="40%" height="25" align="right" class="tdstyle">管理名称:</td>
      <td width="60%" valign="middle" class="tdstyle"> <input name="AdminName" type="text" class="input1" id="AdminPass3" size="25" maxlength="50"> 
      </td>
    </tr>
    <tr> 
      <td height="25" align="right" class="tdstyle">管理密码:</td>
      <td valign="middle" class="tdstyle"> <input name="AdminPass" type="password" class="input1" id="AdminPass" size="27" maxlength="50"></td>
    </tr>
    <tr> 
      <td height="25" align="right" class="tdstyle">确认密码:</td>
      <td valign="middle" class="tdstyle"><input name="AdminPass2" type="password" class="input1" id="AdminPass2" size="27" maxlength="50"></td>
    </tr>
    <tr> 
      <td height="30" colspan="2" align="center" class="tdstyle"> 
        <input type="submit" name="Submit" value="添加" class="button"  ONCLICK="javascript:return check()"> 
        <input type="button" name="Submit2" value="返回" class="button" onClick="history.go(-1)"> 
      </td>
    </tr>
  </table>
</form>
</body>
</html>
<%
if request("atcion")="amend" then
	If Trim(request("AdminPass"))<>"" then
		conn.execute("Update Admin set AdminName='"&Trim(Request("AdminName"))&"' , AdminPass='"&md5(Trim(Request("AdminPass")))&"' where  AdminId="&request("Id")&"")
	else
		conn.execute("Update Admin set AdminName='"&Trim(Request("AdminName"))&"' where AdminId="&request("Id")&"")
	end if 
	response.write "<script>alert(""修改成功!"");location.href=""?"";</script>"
end if


dim AdminName,AdminPass
if request("action")="add" then
	AdminName = Trim(Request("AdminName"))
	AdminPass = md5(Trim(Request("AdminPass")))
	
	set rs = conn.Execute("Select * From admin Where AdminName = '"&AdminName&"'")
	if not rs.eof then
		response.write "<script>alert(""您填写的用户名已经存在!\n\n请重新选择!"");history.back();</script>"
	else
		conn.execute("Insert into Admin(AdminName,AdminPass)values('"&AdminName&"','"&AdminPass&"')")
	end if
	rs.close
	set rs=nothing
	response.write "<script>alert(""添加成功!"");location.href=""?"";</script>"
end if

if request("action")="del" then
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql = "Select * From admin"
	rs.open sql,conn,1,1
	if rs.recordcount<2 then
		response.write "<script>alert(""目前只有一个管理员!\n\n不能删除!"");history.back();</script>"
	else
		conn.execute("Delete From admin where adminid="&request("id"))
		response.redirect"?"
	end if
	rs.close
	set rs = nothing
end if

conn.close
set conn = nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -