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

📄 pwdmgr.inc

📁 物业管理和办公自动化系统
💻 INC
字号:
<%
'************************************************************************************************
' 函数名 : Formchangepwd(sAccountid)
' 输 入 : sAccountid:用户名
' 输 出 : 提供修改用户密码的功能
' 功能描述: 提供当前用户的修改密码的功能
' 调用模块: pwdmgr.asp
' 作 者 :weiln
' 日 期 : 2002-11-07
' 版 本 : 
'************************************************************************************************
Function Formpwdmgr(sAccountid)
	'----------------------------------------------------------
	' 根据用户名,显示相关用户的信息,提供修改密码的功能
	'----------------------------------------------------------
	dim sSQL, sTemp, sTempButtons, sAssociate, rs,iEmpid,sQuestion,sAnswer
	sSQL = "select * from T_account where account_id = "& Tosql(sAccountid,"text")

	
	set rs = openrs(conn,sSQL)
	if not rs.eof then 
		iEmpid=GetValue(rs,"emp_id")
		sQuestion=GetValue(rs,"question")
		sAnswer=GetValue(rs,"answer")	
		sTempButtons=_
		"		<img border=0 src=""../images/button/submit.gif"" style=""cursor:hand"" name=btnSubmit>" &_
		"		<img border=0 src=""../images/button/clear.gif"" style=""cursor:hand"" name=btnReset>" &_
		"		<img border=0 src=""../images/button/return.gif"" style=""cursor:hand"" name=btnReturn>" 
	else
		response.write "<script language=""javascript"">alert('对不起,不存在该用户!')</script>"
		response.write "<script language = vbscript>window.navigate(""changepwd.asp"")</script>"
	end if
	
	CloseRs(rs)
	
	if iEmpid="" then
		sTemp="	<td width=400 class=tdlist >非员工用户(包括admin)</td>"
	else
	        sTemp="	<td width=400 class=tdlist >"&DLookUp(conn, "select name from t_employee where emp_id="&Tosql(iEmpid,"number"))&"</td>"
	end if
	
	Formpwdmgr=_
		"<table cellspacing=0 cellpadding=0 width=600 align=center border=1>" & _
		"<tr><td>"&_
		TableTitle("密码管理", 600, "", "#0040a0") & _
		"<table cellspacing=0 cellpadding=0 width=600 align=center border=0 class=tablelist>" & _
		"<form name=""frmpwdmgr"" method=post action=""pwdmgr.asp"">" &_
		"<tr height=30>" & _
		"	<td width=200 class=tdlist align=right>用户名:</td>"&_
		"	<td width=400 class=tdlist >"&sAccountid&"</td>"& _
		"</tr>" & _
		"<tr height=30>" & _
		"	<td width=200 class=tdlist align=right>用户姓名:</td>"&_
	        sTemp &_			
		"</tr>" & _
		"<tr height=30>" & _
		"	<td width=200 class=tdlist align=right>请输入原密码:</td>"&_
		"	<td width=400 class=tdlist ><input type=password name=oldpwd size=30 maxlength=20></td>"& _
		"</tr>" & _
		"<tr height=30>" & _
		"	<td width=200 class=tdlist align=right>请输入新密码:</td>"&_
		"	<td width=400 class=tdlist ><input type=password name=newpwd1 size=30 maxlength=20></td>" & _
		"</tr>" & _
		"<tr height=30>" & _
		"	<td width=200 class=tdlist align=right>请确认新密码:</td>"&_
		"	<td width=400 class=tdlist ><input type=password name=newpwd2 size=30 maxlength=20></td>" & _
		"</tr>" & _
		"<tr height=30>" & _
		"	<td width=200 class=tdlist align=right>密码提示问题:</td>"&_
		"	<td width=400 class=tdlist ><input type=text name=question size=30 maxlength=20 value="""&Tohtml(sQuestion)&"""></td>"& _
		"</tr>" & _
		"<tr height=30>" & _
		"	<td width=200 class=tdlist align=right>提示问题答案:</td>"&_
		"	<td width=400 class=tdlist ><input type=text name=answer size=30 maxlength=20 value="""&Tohtml(sAnswer)&"""></td>" & _
		"</tr>" & _
		"<tr height=30>" & _
		"	<td width=200 class=tdlist align=right>请注意:</td>"&_
		"	<td width=400 class=tdlist >密码由数字和字母组成。</td>" & _
		"</tr>" & _
		"<tr>" &_
		"   <input type=hidden name=accountid value="""&sAccountid&""">" & _
		"</tr>"&_
		"<tr height=50>" & _
		"	<td colspan=2 align=center>" & sTempButtons & _
		"	</td>" & _
		"</tr>" & _
		"</form>"&_
		"</table>"&_
		"</td></tr></table>"
End Function


'************************************************************************************************
' 函数名 : Updatechangepwd()
' 输 入 : 
' 输 出 : 
' 功能描述: 更新用户信息
' 调用模块: changepwd.asp
' 作 者 : 蔡晓燕
' 日 期 : 2002-08-02
' 版 本 : 
'************************************************************************************************
Sub Updatepwdmgr()
'	定义变量
	dim sSQL, sError, crs, rs, sAccountid, sOldpwd, sNewpwd, sPwd,sQuestion,sAnswer
'   获取表单的数据
	sAccountid = GetParam("accountid")
	sOldpwd = GetParam("oldpwd")
	sNewpwd = GetParam("newpwd1")
	sQuestion=GetParam("question")
	sAnswer=GetParam("answer")
	
'	response.write "changepwd of "&sAccountid
'	先判断输入的原密码是否正确
	sSQL = "select * from t_account where account_id=" & Tosql(sAccountid,"text")
	
	set rs = openRS(conn,sSQL)
	if not rs.eof then
		sPwd = GetValue(rs,"password")
	else
		Response.Write "<script language=""javascript"">alert('对不起,不存在该用户!')</script>"
		response.write "<script language=vbscript>window.navigate(""pwdmgr.asp"")</script>"
		response.end
	end if
	CloseRs(rs)
	
	if sPwd = sOldpwd then
	'	如果输入原密码正确,则修改密码为新密码
		sSQL = "update t_account set password = " & Tosql(sNewpwd,"text") & ",question="&Tosql(sQuestion,"text")&",answer="&Tosql(sAnswer,"text")&" where account_id=" & Tosql(sAccountid,"text")		
		conn.Execute(sSQL)
		dim conn1
        set conn1=DBConnectionOA		
		sSQL = "update t_email set password = " & Tosql(sNewpwd,"text") & " where userid=" & Tosql(sAccountid,"text")		
		conn1.Execute(sSQL)
		Disconnect(conn1)
		
		
		sError = ProcessError(conn)
		if sError <> "" then
			Response.Write "<script language=""javascript"">alert('对不起,用户密码信息修改出错:"&sError&"!')</script>"
		else 			
			Response.Write "<script language=""javascript"">alert('用户密码信息修改成功!')</script>"
			response.write "<script language=vbscript>window.navigate(""../include/main.asp"")</script>"
		end if

	else
		Response.Write "<script language=""javascript"">alert('对不起,用户原密码输入有误!')</script>"
		
	end if
'	response.write "<script language=vbscript>window.navigate(""pwdmgr.asp"")</script>"
End Sub


function Formchanged()
	formchanged = "<table cellspacing=0 cellpadding=0 width=600 align=center border=0>" & _
						"<tr height = 30><td><center><b>密码修改成功!</b></center>"&_
						"</td></tr>"&_
		"<tr height=30>" & _
		"	<td colspan=2 align=center><img border=0 src=""../images/button/return.gif"" style=""cursor:hand"" name=btnReturn>"&_ 
		"	</td>" & _
		"</tr></table>"
end function
%>

⌨️ 快捷键说明

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