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

📄 admin_admin.asp

📁 完整的网址站
💻 ASP
字号:
<!--#include file="config.asp"-->
<!--#include file="md5.asp"-->
<%
dim founderr,errmsg
founderr=false
errmsg=""
if session("adminlogin")<>sessionvar then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你尚未登录,或者超时了!请<a href='index.asp'>重新登录</a>!"
  call diserror()
  response.end
end if
'//进行管理员删除操作
   if Request("action")="del" then
   uid=Request("uid")
      sql="delete from happywz_ADMIN where id="&uid
      conn.Execute sql
      conn.Close
      set conn=Nothing  
   response.redirect "Admin_Admin.asp"
   end if
   
'//进行管理员添加操作
if Request("action")="Addsave" then 
   username=Request("username")
   password=md5(Request("newpin"))
   right_class=CInt(Request("right_class"))

   Set rs=Server.CreateObject("Adodb.RecordSet")
   rs.Open "Select * from happywz_ADMIN where username='"&username&"'",conn
   if not rs.EOF then
  		response.write"<SCRIPT language=JavaScript>alert('该用户名已经存在!');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
   rs.Close
   Set rs=Nothing

   conn.Close
   Set conn=Nothing
   Response.End   
   end if
        set rs=server.createobject("adodb.recordset")
		rs.open "select * from happywz_ADMIN",conn,1,3
		rs.addnew
		rs("username")=username
		rs("password")=password
		rs("flag")=right_class
		rs.update
      rs.Close
   set rs=Nothing
   
   conn.Close
   set conn=Nothing

   Response.Redirect "Admin_Admin.asp"
end if

'//进行修改操作
   
if Request("action")="SaveModify" then
   
    UserID=trim(Request("ID"))
	if UserID="" then
		response.write"<SCRIPT language=JavaScript>alert('请指定要修改的管理员ID!!');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
	else
		UserID=Clng(UserID)
	end if
	password=md5(trim(Request("Password")))
	PwdConfirm=md5(trim(Request("PwdConfirm")))
	flag=trim(Request("flag"))
	if PwdConfirm<>Password then
		response.write"<SCRIPT language=JavaScript>alert('确认密码必须与新密码相同!!');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
	end if
	if flag="" then
		response.write"<SCRIPT language=JavaScript>alert('用户权限不能为空!');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
	else
		flag=CInt(flag)
	end if
	
	
	sql="Select * from happywz_ADMIN where ID=" & UserID
	Set rs=Server.CreateObject("Adodb.RecordSet")
	rs.Open sql,conn,1,3
	if rs.Bof and rs.EOF then
		response.write"<SCRIPT language=JavaScript>alert('不存在此用户!');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
		rs.close
		set rs=nothing
	end if
	
	rs("password")=password
   	rs("flag")=flag
 	rs.update
	rs.Close
   	set rs=Nothing
	
   Response.Redirect "Admin_Admin.asp" 
end if
%>

<html>
<head>
<title>管 理 员 管 理</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<script language=javascript>

function check()

{
  if(document.form1.username.value=="")
    {
      alert("用户名为空");
      return false;
    }
    
  if(document.form1.newpin.value=="")
    {
      alert("密码不能为空");
      return false;
    }
    
  if((document.form1.newpin.value)!=(document.form1.re_newpin.value))
    {
      alert("密码不匹配");
      return false;
    }

}

</script> <LINK REL="stylesheet" HREF="css.css" TYPE="text/css">
</head>

<body leftmargin="0" topmargin="0"><script>if(top==self)top.location="index.asp" </script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="HeaderTdStyle"> 
<tr VALIGN="MIDDLE" > <td height="26" colspan="2" align="center"><b>管 理 员 管 理</b></td></tr> 
<tr> <td class="tdbg" width="70" height="30" BGCOLOR="#ffffff"><b>管理导航:</b></td><td class="tdbg" height="30" BGCOLOR="#ffffff"><a href="Admin_Admin.asp">管理员管理首页</a>&nbsp;|&nbsp;<a href="Admin_Admin.asp?Action=Add">新增管理员</a></td></tr> 
</table>
<%if Request("action")="" then
	Set rs=Server.CreateObject("Adodb.RecordSet")
	sql="select * from happywz_ADMIN where flag>="&Session("flag")&" order by id"
	rs.Open sql,conn,1,2
%> <br> <table width='99%' border="0" cellpadding="0" cellspacing="0" ALIGN="CENTER"> 
<tr> <form name="myform" method="Post" action="Admin_Admin.asp" onSubmit="return confirm('确定要删除选中的管理员吗?');"> 
<td> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border" BGCOLOR="#0099CF"> 
<tr align="center" class="title" BGCOLOR="#0099CF"> <td  width="40" height="22" BGCOLOR="#0099CF"><strong> 
序号</strong></td><td height="22" width="270"><strong> 用 户 名</strong></td><td  width="128" height="22"><strong> 
权 限</strong></td><td width="149"><strong>最后登录IP</strong></td><td width="148"><strong>最后登录时间</strong></td><td  width="79"><strong>登录次数</strong></td><td height="22" colspan="2"><strong> 
操 作</strong></td></tr> <%do while not rs.EOF %> <tr align="center"> <td width="40" class="tdbg" BGCOLOR=""#0099CF""><%=rs("ID")%></td><td class="tdbg" width="270" BGCOLOR="#ffffff"> 
<%
	if rs("username")=session("admin_name") then
		response.write "<font color=red><b>" & rs("UserName") & "</b></font>"
	else
		response.write rs("UserName")
	end if
	%></td><td width="128" class="tdbg" BGCOLOR="#ffffff"> <%
		  select case rs("flag")
		    case 1
              flag="超级管理员"
            case 2
              flag="高级管理员"
            case 3
		flag="数据录入员"
		  end select
		  response.write(flag)
         %> </td><td width="149" class="tdbg" BGCOLOR="#ffffff"> <%
	if rs("LastLoginIP")<>"" then
		response.write rs("LastLoginIP")
	else
		response.write "&nbsp;"
	end if
	%> </td><td width="148" class="tdbg" BGCOLOR="#ffffff"> <%
	if rs("LastLoginTime")<>"" then
		response.write rs("LastLoginTime")
	else
		response.write "&nbsp;"
	end if
	%> </td><td width="79" class="tdbg" BGCOLOR="#ffffff"> <%
	if rs("LoginTimes")<>"" then
		response.write rs("LoginTimes")
	else
		response.write "0"
	end if
	%> </td><td width="81" class="tdbg" BGCOLOR=""#0099CF""> <a href="Admin_Admin.asp?Action=Modify&id=<%=rs("id")%>">修改</a></td><td width="67" class="tdbg" BGCOLOR="#ffffff"><%if session("flag")=1 then%><a href="Admin_Admin.asp?Action=del&uid=<%=rs("id")%>" onClick="return confirm('确定要删除此管理员吗?');">删除</a><%else response.write"删除"%><%end if%></td></tr> 
<%
				rs.MoveNext
				loop
  			%> </table><table width="100%" border="0" cellpadding="0" cellspacing="0"> 
<tr> <td width="200" height="30">&nbsp;</td><td>&nbsp;</td></tr> </table></td></form></tr></table><%
	rs.Close
	set rs=Nothing
end if
%> <br> <br> <br> <%if Request("action")="Add" then%> <table width="80%" border="0" cellspacing="1" cellpadding="2"  class="border" BGCOLOR="#0099CF" ALIGN="CENTER"> 
<form method="post" action="Admin_Admin.asp" name="form1" onSubmit="javascript:return check();"> 
<tr BGCOLOR="#0099CF" > <td height="25" align="center" class="title" colspan="2"> 
<b>新 增 管 理 员</b> </td></tr> <tr> <td height="30" class="tdbg" width="30%" align="right" BGCOLOR=""#0099CF""> 
用 户 名<font size="2">:</font></td><td height="30" class="tdbg" width="70%" BGCOLOR="#ffffff"><font size="2"> 
<input type="text" name="username" size="20"> </font></td></tr> <tr> <td height="30" class="tdbg" width="30%" align="right" BGCOLOR=""#0099CF"">初始密码:</td><td height="30" class="tdbg" width="70%" BGCOLOR="#ffffff"><font size="2"> 
<input type="password" name="newpin" size="20"> </font></td></tr> <tr> <td height="30" class="tdbg" width="30%" align="right" BGCOLOR=""#0099CF""> 
确认密码:</td><td height="30" class="tdbg" width="70%" BGCOLOR="#ffffff"><font size="2"> 
<input type="password" name="re_newpin" size="20"> </font></td></tr> <tr> <td class="tdbg" width="30%" align="right" BGCOLOR=""#0099CF""> 
权限设置:</td><td height="30" class="tdbg" width="70%" BGCOLOR="#ffffff"> <select name="right_class" id="right_class"> 
<%if session("flag")=1 then
  response.write"<option value=1 selected>系统管理员</option><option value=2 selected>高级管理员</option><option value=3 selected>数据录入员</option>"
 elseif session("flag")>1 then
   response.write"<option value=2 selected>高级管理员</option><option value=3 selected>数据录入员</option>"
   elseif session("flag")>2 then
   response.write"<option value=3 selected>数据录入员</option>"
   end if %> 
</select> </td></tr> <tr BGCOLOR="#ffffffe"> <td height="30" align="center" class="tdbg" colspan="2"> 
<input type="submit" name="Submit" value="确 定"> <input name="Cancel" type="button"  value="取 消" onClick="window.location.href='Admin_Admin.asp'" > 
<input name="Action" type="hidden" value="Addsave"> </td></tr> </form></table><%end if%> 
<br> <%if Request("action")="Modify" then
	dim UserID,flag
	UserID=trim(Request("ID"))
	if UserID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>请指定要修改的管理员ID</li>"
	else
		UserID=Clng(UserID)
	end if
	sql="Select * from happywz_ADMIN where ID=" & UserID
	Set rs=Server.CreateObject("Adodb.RecordSet")
	rs.Open sql,conn,1,3
	if rs.Bof and rs.EOF then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>不存在此用户!</li>"
	else
		flag=rs("flag")
%> <form method="post" action="Admin_Admin.asp" name="form1" onSubmit="javascript:return CheckModify();"> 
<table width="80%" border="0" align="CENTER" cellpadding="2" cellspacing="1" class="border" BGCOLOR="#0099CF" > 
<tr class="title"> <td height="22" colspan="2" BGCOLOR="#0099CF"> <div align="center"><font size="2"><strong>修 
改 管 理 员 信 息</strong></font></div></td></tr> <tr> <td width="300" class="tdbg" BGCOLOR=""#0099CF""><strong>用 
户 名:</strong></td><td class="tdbg" BGCOLOR="#ffffff"><%=rs("UserName")%> <input name="ID" type="hidden" value="<%=rs("ID")%>"></td></tr> 
<tr> <td width="300" class="tdbg" BGCOLOR=""#0099CF""><strong>新 密 码:</strong><br><font color="#0000FF">如果不想修改,请保持为空</font></td><td class="tdbg" BGCOLOR="#ffffff"> 
<input type="password" name="Password" value="<%=rs("password")%>"> </td></tr> 
<tr> <td width="300" class="tdbg" BGCOLOR=""#0099CF""><strong>确认密码:</strong><br><font color="#0000FF">如果不想修改,请保持为空</font></td><td class="tdbg" BGCOLOR="#ffffffe"><input type="password" name="PwdConfirm" value="<%=rs("password")%>"> 
</td></tr> <tr> <td width="300" class="tdbg" BGCOLOR=""#0099CF""><strong>权限设置: </strong></td><td class="tdbg" BGCOLOR="#ffffff"><select name="flag" id="flag"> 
<%if session("flag")=1 then
  response.write"<option value=1 selected>系统管理员</option><option value=2 selected>高级管理员</option><option value=3 selected>数据录入员</option>"
 elseif session("flag")>1 then
   response.write"<option value=2 selected>高级管理员</option><option value=3 selected>数据录入员</option>"
   elseif session("flag")>2 then
   response.write"<option value=3 selected>数据录入员</option>"
   end if %> </select> 
</td></tr> <tr BGCOLOR="#ffffff"> <td colspan="2" align="center" class="tdbg"><input name="Action" type="hidden" id="Action" value="SaveModify"> 
<input  type="submit" name="Submit" value=" 确 定 " style="cursor:hand;"> &nbsp; 
<input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='Admin_Admin.asp'" style="cursor:hand;"></td></tr> 
</table></form><%
	end if
	rs.close
	set rs=nothing
end if
%> <br> <br><br> <table width="99%" border="0" cellspacing="1" cellpadding="2" class="border" BGCOLOR="#0099CF" ALIGN="CENTER"> 
<tr class="title" BGCOLOR="#0099CF"> <td height="22" colspan="2"><strong>管理员权限说明</strong></td></tr> 
<tr valign="top" class="tdbg" BGCOLOR="#DFDFDF"> <td width="120" align="right" BGCOLOR=""#0099CF""><strong>数据录入员:</strong></td>
<td BGCOLOR="#ffffff">只有添加站点数据及增加数据录入员的权限。</td>
</tr> 
<tr valign="top" class="tdbg" BGCOLOR="#DFDFDF"> <td width="120" align="right" BGCOLOR=""#0099CF""><strong>高级管理员:</strong></td>
<td BGCOLOR="#ffffff">除上述权限之外,拥有修改、删除站点,添加、修改、删除分类,添加高级管理员等管理权限。</td>
</tr> 
<tr valign="top" class="tdbg" BGCOLOR="#DFDFDF"> <td width="120" align="right" BGCOLOR=""#0099CF""><strong>超级管理员:</strong></td><td BGCOLOR="#ffffff">拥有所有管理权限。</td></tr> 
</table><%call CloseConn()%> 
</body>
</html>

⌨️ 快捷键说明

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