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

📄 adminuser_edit.asp.bak

📁 商会 商会 商会 商会 商会 商会 商会 商会 商会 商会 商会 商会 商会
💻 BAK
字号:
<%@ Language=VBScript%>
<%
Response.Buffer = true
Response.Expires = 0

if Session("userqx") = "1" or Session("userqx") = "9" then
else
	Response.Redirect "warn.asp"
end if

username = Request.QueryString("username")
pageno = Request.QueryString("pageno")

htmlname = "adminuser_edit.asp?username=" & username & "&pageno=" & pageno
backhtml = "adminuser_admin.asp?pageno=" & pageno
%>

<!-- #include file="../dsn.asp" -->

<%
bz = 1

set cn = Server.CreateObject("ADODB.Connection")
cn.open mycnstr
set rs = Server.CreateObject("ADODB.Recordset")

if Request.ServerVariables("REQUEST_METHOD") = "POST" then
	'如果提交了表单
	newname = Trim(Request.Form("username"))
	realname = Trim(Request.Form("realname"))
	userpass = Lcase(Request.Form("userpass"))
	authority = Trim(Request.Form("authority"))
	qxflag = ""
	for i = 1 to 20
		if Request.Form("qxflag" & i) = "1" then
			qxflag = qxflag & "1"
		else
			qxflag = qxflag & "0"
		end if
	next

	'如果是新增
	if username = "" then
		sql = "select username from adminuser where username='" & newname & "'"
		rs.Open sql, cn, 0, 1, 1
		if not rs.EOF then
			bz = 2
		else
			sql = "insert into adminuser (username, realname, userpass, createdate, flag, authority, qxflag) values ('"&newname&"', '"&realname&"', '"&userpass&"', '"&now()&"', '1', '"&authority&"', '"&qxflag&"')"
			cn.Execute sql, affeeted, 1
			bz = 3
		end if
		rs.Close
	else
		'如果是修改
		sql = "update adminuser set realname='"&realname&"', userpass='"&userpass&"', authority='"&authority&"', qxflag='"&qxflag&"' where username='"&username&"'"
		cn.Execute sql, affeeted, 1
		bz = 3
	end if
else
	'如果还没有提交表单
	if username = "" then
		xgstate = ""
		authority = "1"
	else
		sql = "select * from adminuser where username='" & username & "'"
		rs.Open sql, cn, 0, 1, 1
		if not rs.EOF then
			xgstate = "disabled"
			realname = rs("realname")
			userpass = rs("userpass")
			authority = rs("authority")
			qxflag = rs("qxflag")
		else
			xgstate = ""
			authority = "1"
		end if
		rs.Close
	end if
end if


set rs = nothing
cn.Close
set cn = nothing


'新增或修改成功,返回列表页面
if bz = 3 then 
	Response.Redirect backhtml
end if
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
body,table,tr
{
	font-size:12px;
	font-family:宋体;
	line-height:20px;
}

A:link {color: #000077}
A:visited {color: #000077}
A:hover {color: #ff0000}

.td1 {font-size:12px;line-height:24px;text-align:right;background-color:#efefef;color:#000000}
.td2 {font-size:12px;line-height:24px;text-align:left;background-color:#ffffff;color:#000000;}
.td3 {font-size:12px;line-height:24px;text-align:left;background-color:#ffffff;color:#000000;}
</style>

<script language="javascript">
	function check()
	{
		var obj = document.form1;

		if (obj.username.value == '')
		{
			alert("请输入用户编号!");
			obj.username.focus();
			return false;
		}

		if (obj.realname.value == '')
		{
			alert("请输入真实名称!");
			obj.realname.focus();
			return false;
		}

		if (obj.userpass.value == '')
		{
			alert("密码不能为空!");
			obj.userpass.focus();
			return false;
		}

		if (obj.userpass2.value != obj.userpass.value)
		{
			alert("两次输入的密码不一致!");
			obj.userpass.value = '';
			obj.userpass2.value = '';
			obj.userpass.focus();
			return false;
		}

		return true;
	}
</script>
</head>
<body bgcolor="#FFFFFF">

<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td width="80" style="font-weight:bold;">用户资料</td>
		<td>← <a href="<%=backhtml%>">返回列表</a></td>
		<%if bz = 2 then%>
			<td style="color:#FF0000;">
				提示:此用户名(<%=newname%>)已经被使用!
			</td>
		<%end if%>
	</tr>
</table>

<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
	<form name="form1" method="post" action="<%=htmlname%>" onsubmit="return check();" autocomplete="off">
	
	<tr height="22" bgcolor="#FFDFBF">
		<td colspan="3">管理人员资料</td>
	</tr>
	<tr>
		<td width="70" class="td1">用户编号</td>
		<td width="200" class="td2"><input type="text" name="username" value="<%=username%>" size="20" maxlength="20" <%=xgstate%>> <font color="#FF0000">*</font></td>
	</tr>
	<tr>
		<td class="td1">真实姓名</td>
		<td class="td2"><input type="text" name="realname" value="<%=realname%>" size="20" maxlength="5"> <font color="#FF0000">*</font></td>
	</tr>
	<tr>
		<td class="td1">密码</td>
		<td class="td2"><input type="password" name="userpass" value="<%=userpass%>" size="20" maxlength="20"> <font color="#FF0000">*</font> 不分大小写</td>
	</tr>
	<tr>
		<td class="td1">确认密码</td>
		<td class="td2"><input type="password" name="userpass2" value="<%=userpass%>" size="20" maxlength="20"> <font color="#FF0000">*</font> 请再次输入密码(两次密码需一致)</td>
	</tr>
	<tr>
		<td class="td1">管理权限</td>
		<td class="td2">
			<input type="radio" name="authority" value="1" <%if authority = "1" then Response.Write "checked"%>>普通管理员
			<input type="radio" name="authority" value="9" <%if authority = "9" then Response.Write "checked"%>>高级管理员
		</td>
	</tr>
	<tr>
		<td class="td1">权限分配</td>
		<td class="td2">
			<input type="checkbox" name="qxflag5" value="1" <%if mid(qxflag, 5, 1) = "1" then Response.Write "checked"%>>论坛管理
			<input type="checkbox" name="qxflag1" value="1" <%if mid(qxflag, 1, 1) = "1" then Response.Write "checked"%>>网站管理
			<input type="checkbox" name="qxflag2" value="1" <%if mid(qxflag, 2, 1) = "1" then Response.Write "checked"%>>新闻动态
			<input type="checkbox" name="qxflag3" value="1" <%if mid(qxflag, 3, 1) = "1" then Response.Write "checked"%>>政策法规
			<input type="checkbox" name="qxflag4" value="1" <%if mid(qxflag, 4, 1) = "1" then Response.Write "checked"%>>产品管理
		</td>
	</tr>
	<tr>
		<td class="td2"></td>
		<td class="td2" style="color:#FF0000;">注:高级管理员具有完全权限</td>
	</tr>
	<tr height="30">
		<td></td>
		<td><input type="submit" value="确认提交"></td>
	</tr>

	</form>
</table>

</body>
</html>

⌨️ 快捷键说明

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