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

📄 adminuser_myedit.asp

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

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

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

<%
set cn = Server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs = Server.CreateObject("ADODB.Recordset")
sql = "select realname,userpass from adminuser where username='" & username & "'"

if Request.ServerVariables("REQUEST_METHOD") = "POST" then
	
	'检查输入的密码是否符合规范
	password = Lcase(Request.Form("password"))
	if password = "" then
%>
		<script language="javascript">
			alert("密码不能为空!");
			history.back();
		</script>
<%
		Response.end
	end if

	'存入数据库
	rs.Open sql, cn, 0, 2, 1
	if not rs.EOF then
		realname = rs("realname")

		rs("userpass") = password
		rs.Update
	end if

	'检查数据库操作是否正确
	if err > 0 then
		infotext = "修改密码发生故障,请稍后重试!"
	else
		infotext = "修改密码成功!"
	end if

else

	'查找当前用户的真实名称和密码
	rs.Open sql, cn, 0, 1, 1
	if not rs.EOF then
		realname = rs("realname")
		password = rs("userpass")
	end if

end if

rs.Close
set rs = nothing
cn.Close
set cn = nothing
%>

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

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

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

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

		return true;
	}


	function checkStr(str)
	{
		tmp = str.search(/\s/);
		if (tmp == 0 || tmp == str.length - 1)
		{
			alert("请不要在密码首尾使用空格!");
			return false;
		}

		return true;
	}
</script>
</head>
<body topmargin="0" leftmargin="0">

<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr height="50">
		<td style="color:#FF6600;font-weight:bold;padding-left:10px;">修 改 密 码</td>
	</tr>
</table>

<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
	<form name="form1" action="adminuser_myedit.asp" method="post" onsubmit="return check();">
	
	<tr>
		<td></td>
		<td style="color:#FF0000;"><%=infotext%></td>
	</tr>
	<tr height="30">
		<td width="70" align="right">您的名称:</td>
		<td><%=realname%></td>
	</tr>
	<tr height="30">
		<td align="right">新密码:</td>
		<td><input type="password" name="password" value="<%=password%>" size="20" maxlength="20"> <font color="#FF0000">*</font></td>
	</tr>
	<tr height="30">
		<td align="right">确认密码:</td>
		<td><input type="password" name="password2" value="<%=password%>" size="20" maxlength="20"> <font color="#FF0000">*</font></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 + -