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

📄 admin.asp

📁 信息管理系统!很简单的课程设计!类似于城市信息交换的网站!
💻 ASP
字号:
<%'注意:防止多次发送,以及防止非法登录
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if not mid(server_v1,8,len(server_v2))=server_v2 then
Response.Write "<script language=JavaScript>{window.alert('系统错误,拒绝从非本服务器登陆!');window.history.go(-1);}</script>"
response.end
end if

if session("admin_login")<>true then
	response.Write("<html><link href=../style.css rel=stylesheet type=text/css><body><table height=100% width=100% align=center valign=middle><tr><td align=center valign=center><p align=center>您没有登录或者已经超时!!请点击下面的链接,进入登录界面!!</p><p align=center>--&gt;&gt; <a href=../login/login.asp>登录</a> &lt;&lt;--</p></td></tr></table></body></html>")
	response.end
end if

if not session("login_qx") then
	response.Write("<script>window.alert(""错误:您的权限不够,不能使用该功能!!"");history.back();</script>")
	response.End()
end if
%>

<!--#include file="../../conn/conn.asp"-->
<%
action = request.QueryString("action")
abc = request.QueryString("abc")

select case action
	case "add"
		admin_name = trim(request.Form("name"))
		admin_pwd = trim(request.Form("pwd")) 'MD5
		admin_qx = trim(request.Form("qx"))
		if admin_qx = "0" then
			admin_qx = 0
		elseif admin_qx = "1" then
			admin_qx = 1
		end if
		SQL = "select * from gly_1a where admin_name='" & admin_name & "'"
		set rs = server.CreateObject("adodb.recordset")
		rs.open SQL,conn,1,3
		if rs.eof and rs.bof then
			rs.addnew
				rs("admin_name") = admin_name
				rs("admin_pwd") = admin_pwd
				rs("admin_qx") = admin_qx
			rs.update
			response.Write("<script>window.alert(""管理员已经成功添加!!\n\n即将转入管理员列表页"");window.location.href='glylb.asp'</script>")
			rs.close
			set rs = nothing
			conn.close
			set conn = nothing
			response.End()
		else
			response.Write("<script>window.alert(""该管理员名已经被使用\n\n请重新选择!!"");history.back()</script>")
			rs.close
			set rs = nothing
			conn.close
			set conn = nothing
			response.End()
		end if
	case "del"
		id = clng(trim(request.QueryString("id")))
		conn.execute("delete from gly_1a where id="&id)
end select
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style.css" rel="stylesheet" type="text/css">
<title>管理员管理</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
.style4 {color: #FF0000; font-weight: bold; }
.style6 {color: #666666}
-->
</style>
</head>

<body>
<%
select case abc
	case "add"
%>
<script language="javascript">
function check()
{
	if(document.form1.name.value=='')
	{
		alert("请输入用户名!!");
		return false;
		document.form1.name.focus();
	}
	
	if(document.form1.name.value.length<6)
	{
		alert("用户名不能小于6位!!");
		return false;
		document.form1.name.focus();
	}
	
	if(document.form1.pwd.value=='')
	{
		alert("请输入密码!!");
		return false;
		document.form1.pwd.focus();
	}
	
	if(document.form1.pwd.value.length<6)
	{
		alert("密码不能小于6位!!");
		return false;
		document.form1.pwd.focus();
	}
	
	if(document.form1.pwd.value!=document.form1.qpwd.value)
	{
		alert("密码与确认密码不相同!!");
		return false;
		document.form1.qpwd.focus();
	}
	
}
</script>
<form name="form1" method="post" action="?action=add" onSubmit="return check()">
     <table width="70%"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#336633">
                        		<tr bgcolor="#FFFFFF">
                        				<td height="25" colspan="2" background="../Images/topbg.gif">管理员管理 &gt;&gt; 添加管理员</td>
   				</tr>
                        		<tr bgcolor="#FFFFFF">
                        				<td width="15%" height="35" align="center">用户名:</td>
                        				<td width="85%"><input name="name" id="name" type="text" class="txttable" size="20" maxlength="16" onkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeydown="if(event.keyCode==13)event.keyCode=9"> 
                        						<span class="style1">* <span class="style6">长度6到16,只能用数字和字母</span></span></td>
   				</tr>
                        		<tr bgcolor="#FFFFFF">
                        				<td height="35" align="center">密 码:</td>
                        				<td><input name="pwd" id="pwd" type="password"  class="txttable" size="20" maxlength="16" onkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeydown="if(event.keyCode==13)event.keyCode=9"> 
                                						<span class="style1">* <span class="style6">长度6到16,只能用数字和字母</span></span></td>
   				</tr>
                        		<tr bgcolor="#FFFFFF">
                        				<td height="35" align="center">确 认:</td>
   				                        <td><input name="qpwd" type="password" size="20" maxlength="16" class="txttable"></td>
           		</tr>
                        		<tr bgcolor="#FFFFFF">
                        				<td height="35" align="center">类 别:</td>
                        				<td> <span onMouseOver="this.style.cursor='hand'" onClick="document.form1.qx[0].checked=true">一般管理员</span>                        						<input type="radio" name="qx" checked value="0">
&nbsp;&nbsp;&nbsp;
<span onMouseOver="this.style.cursor='hand'"  onClick="document.form1.qx[1].checked=true">管理员</span>
<input type="radio" name="qx"  value="1">
                                						<span class="style4">&nbsp; 注意:</span><span class="style6">'一般管理员'不能增/删管理员</span></td>
   				</tr>
                        		<tr align="center" bgcolor="#FFFFFF">
                        				<td height="35" colspan="2"><input name="Submit" type="submit" class="button01" value=" 添加 "></td>
   				</tr>
   		</table>
   				
</form>
<%
		conn.close
		set conn = nothing
	case "del"
		SQL = "select * from gly_1a order by admin_qx desc,id desc"
		set rs = conn.execute(SQL)
%>
<form name="form2" method="post" action="">
		<table width="70%"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#336633">
        		<tr bgcolor="#FFFFFF">
        				<td height="25" colspan="4" background="../Images/topbg.gif">管理员管理 &gt;&gt; 删除管理员</td>
   				</tr>
        		<tr align="center" bgcolor="#FFFFFF">
        				<td width="10%" height="25">编号</td>
   				        <td width="40%" height="12">管理员名</td>
        		        <td width="40%" height="12">权限</td>
        		        <td width="10%">操作</td>
        		</tr>
        		<%
				while not rs.eof
				%>
				<tr align="center" bgcolor="#FFFFFF">
        				<td height="25"><%=rs("id")%></td>
        				<td height="25"><%=rs("admin_name")%></td>
        				<%
						if rs("admin_qx") then
							qx = "管理员"
						else
							qx = "一般管理员"
						end if
						%>
						<td height="25"><%=qx%></td>
   				        <td height="25"><a href="?action=del&id=<%=rs("id")%>&abc=<%=abc%>">删除</a></td>
        		</tr>
				<%
					rs.movenext
				wend
				%>
        		
        		</table>
</form>
<%
	rs.close
	set rs = nothing
	conn.close
	set conn = nothing
end select
%>
</body>
</html>

⌨️ 快捷键说明

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