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

📄 admin_admin.asp

📁 一个用ASP和access做的简单的在线上传小系统
💻 ASP
字号:
<html>
<head>
<STYLE>BODY {
	FONT-SIZE: 9pt; FONT-FAMILY: 宋体
}
TD {
	FONT-SIZE: 9pt; FONT-FAMILY: 宋体
}
DIV {
	FONT-SIZE: 9pt; FONT-FAMILY: 宋体
}
INPUT {
	FONT-SIZE: 9pt; FONT-FAMILY: 宋体
}
BUTTON {
	FONT-SIZE: 9pt; FONT-FAMILY: 宋体
}
.use1 INPUT {
	BORDER-RIGHT: #d0d0d0 1px solid; BORDER-TOP: #d0d0d0 1px solid; BACKGROUND: #ffffff; BORDER-LEFT: #d0d0d0 1px solid; COLOR: #000000; PADDING-TOP: 1px; BORDER-BOTTOM: #d0d0d0 1px solid
}
.use1 TEXTAREA {
	BORDER-RIGHT: #d0d0d0 1px solid; BORDER-TOP: #d0d0d0 1px solid; BACKGROUND: #ffffff; BORDER-LEFT: #d0d0d0 1px solid; COLOR: #000000; PADDING-TOP: 1px; BORDER-BOTTOM: #d0d0d0 1px solid
}
TABLE {
	BORDER-COLLAPSE: collapse
}
</STYLE>
<STYLE>A {
	TEXT-DECORATION: none
}
</STYLE>
<%@language=vbscript%>
<%
  if session("admin")="" then
  response.redirect "index.asp"
  else
	if session("flag")>1 then
		response.write"<SCRIPT language=JavaScript>alert('您没有操作的权限!');"
		response.write"javascript:history.go(-1)</SCRIPT>"
		response.end
	end if
  end if
  
%>
<!--#include file="conn.asp"-->
<%
'//
   if Request("action")="del" then
   uid=Request("uid")
      sql="delete from 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=LCase(Request("username"))
   password=LCase(Request("newpin"))
   right_class=CInt(Request("right_class"))

   Set rs=Server.CreateObject("Adodb.RecordSet")
   rs.Open "Select * from 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
   
   sql="insert into Admin(username,Password,Flag) values('"
   
   sql=sql&(username)&"','"
   sql=sql&(password)&"','"
   sql=sql&(right_class)&"')"
   
   conn.Execute sql
   
   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=trim(Request("Password"))
	PwdConfirm=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 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
%>

<title>在线上传系统 - 管理员管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style.css" rel="stylesheet" type="text/css">
<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>
</head>

<body leftmargin="0" topmargin="0" bgcolor="#D2E4FC">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr background="images/bg.gif"> 
    <td class="topbg" height="22" align="center"><b>管 理 员 管 理</b></td>
  </tr>
</table>

<%if Request("action")="" then
	Set rs=Server.CreateObject("Adodb.RecordSet")
	sql="select * from admin where flag>="&Session("flag")&" order by id"
	rs.Open sql,conn,1,2
%>
<br>
<table width='100%' border="0" cellpadding="0" cellspacing="0">
  <tr>
  <form name="myform" method="Post" action="Admin_Admin.asp" onsubmit="return confirm('确定要删除选中的管理员吗?');">
     <td>
        <table width="100%" border="1" align="center" cellspacing="0" class="border" bordercolordark="#0066FF" bordercolor="blue" bordercolorlight="blue">
          <tr align="center" class="title"> 
            <td width="760">最后登陆IP</td>
            <td width="760">最后登陆时间</td>
            <td  width="760">登陆次数</td>
            <td  width="760">
                            <p>密码修改</p>
</td>
          </tr>
          <%do while not rs.EOF %>
          <tr align="center"> 
            <td width="760" class="tdbg"> 
              <%
	if rs("LastLoginIP")<>"" then
		response.write rs("LastLoginIP")
	else
		response.write "&nbsp;"
	end if
	%>
            </td>
            <td width="760" class="tdbg"> 
              <%
	if rs("LastLoginTime")<>"" then
		response.write rs("LastLoginTime")
	else
		response.write "&nbsp;"
	end if
	%>
            </td>
            <td width="760" class="tdbg"> 
              <%
	if rs("LoginTimes")<>"" then
		response.write rs("LoginTimes")
	else
		response.write "0"
	end if
	%>
            </td>
            <td width="760" class="tdbg"> 
             <a href="Admin_Admin.asp?Action=Modify&id=53"><u>修 
                            &nbsp;改</u></a>
            </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%><p align="center"><%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 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="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" >
    <tr> 
      <td width="357" class="tdbg">
                <p align="center">&nbsp;</td>
      <td class="tdbg" width="635">
                <p align="left"><strong>用 户 名:</strong><%=rs("UserName")%> <input name="ID" type="hidden" value="<%=rs("ID")%>"></td>
    </tr>
    <tr> 
      <td width="357" class="tdbg">
                <p align="center">&nbsp;</td>
      <td class="tdbg" width="635">
                <p align="left"><strong>新 密 码:</strong><input type="password" name="Password" style="border-width:1px; border-color:rgb(0,51,255); border-style:solid;">
      </td>
    </tr>
    <tr> 
      <td width="357" class="tdbg">
                <p align="center">&nbsp;</td>
      <td class="tdbg" width="635">
                <p align="left"><strong>确认密码:</strong><input type="password" name="PwdConfirm" style="border-width:1px; border-color:rgb(0,51,255); border-style:solid;">
      </td>
    </tr>
    <tr> 
      <td width="357" class="tdbg">
                <p align="center"> &nbsp;</td>
      <td class="tdbg" width="635">
                <p align="left"><strong>权利说明:</strong><select name="flag" id="flag" style="border-width:1px; border-color:rgb(0,51,255); border-style:solid;">
          <option value="1" <%if flag=1 then %>selected<% end if %>>系统管理员</option>
        </select>
        </td>
    </tr>
    <tr> 
      <td colspan="2" align="center" class="tdbg" width="997">
                <p align="center"><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>
<p align="center"><%
	end if
	rs.close
	set rs=nothing
end if
%>
<p align="center"><%call CloseConn()%>
</body>
</html>

⌨️ 快捷键说明

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