changepwd.asp

来自「关于网络渗透技术的详细讲解」· ASP 代码 · 共 124 行

ASP
124 行
字号
<!--#include file="conn.asp" -->
<!--#include file="Include/inc.asp"-->
<!--#include file="Include/md5.asp"-->
<%
'====================================================================
'						----修用户资料----
'							2004-10-25 p9
'
'
'====================================================================
IF not isArray(session("UserID")) then sysErr(10)

Dim Question
SQL="SELECT Question FROM NB_User WHERE ID="&Session("UserID")(0)
Set Rs=Conn.Execute(SQL)
If Not rs.eof And Not rs.bof Then 
	Question=rs(0)
Else
	SysErr(9)
End If

IF Request.QueryString("action")="SavePwd" Then
Dim Password,NewPassword,Answer

		Password=Request.Form("OldPassword")
		NewPassword=Request.Form("Password")
		Question=Request.Form("Question")
		Answer=Request.Form("Answer")
		
		If not ChkForm(Password,1) then sysErr(6)
		If not ChkForm(Question,1) then sysErr(6)
		If not ChkForm(Answer,1) then sysErr(6)
		If not ChkForm(NewPassword,1) then sysErr(6)
		
		Password=MD5(Password)
		NewPassword=MD5(NewPassword)
		Answer=MD5(Answer)
		
	Sql="SELECT [ID],Reg_Pass,Question,Answer FROM NB_User Where Id="&Session("UserID")(0)
	set rs=conn.execute(Sql)
	If Not Rs.Eof AND Not Rs.Bof Then
		If Rs("Reg_Pass")=Password and Rs("Question")=Question and Rs("Answer")=Answer Then
			Sql="Update NB_User Set Reg_Pass='"&NewPassword&"' Where Id="&Session("UserID")(0)
			conn.Execute (Sql)
		Else
			Response.Write(1)
			sysErr(3)
		End If
		Else
		sysErr(3)
	End If
		
	if rs(0)=0 then
		sysErr(3)
	else
		sysSus 3,""
	end if
End if
%>
<html>
<head>
<link type='text/xml' rel='alternate' href='/Default.vsdisco'/>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=SysInfo(0)%></title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> 
<!--#include file="head.asp"--> 
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0"> 
  <tr> 
    <td height="25">&nbsp;<img src="Images/IconLogin.gif" width="13" height="13" align="absmiddle">&nbsp;<a href="./"><strong><%=SysInfo(0)%></strong></a> -&gt; 修改密码</td> 
  </tr> 
</table> 
<table width="762" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> 
  <tr> 
    <td align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" cellspacing="1" cellpadding="3" class="TableBorder"> 
        <form action="?action=SavePwd" method="post" name="reg" target="_self"> 
          <tr> 
            <td width="20%" height="30" bgcolor="#FFFFFF" class="TableBorder2_1">&nbsp;<font color="#333333" face="Webdings">4</font>请输入您现在的密码</td> 
            <td bgcolor="#FFFFFF" class="TableBorder2_1">&nbsp; 
              <input name="OldPassword" type="password" id="OldPassword2" class="LoginInput" size="15" maxlength="20"> 
              <font color="#FF0000">*</font>[<font color="#999999">为了系统安全要求必须验证您的身份合法性</font>] </td> 
          </tr> 
          <tr> 
            <td height="30" class="TableBorder2_1">&nbsp;<font color="#333333" face="Webdings">4</font>请输入新的密码</td> 
            <td class="TableBorder2_1">&nbsp; 
              <input name="Password" type="password" class="LoginInput" id="Password" size="15" maxlength="20"> 
              <font color="#FF0000">*</font>[<font color="#999999">大于6小于14个字符.</font><font color="#999999">不能使用特殊字符</font>]</td> 
          </tr> 
          <tr> 
            <td height="30" bgcolor="#FFFFFF" class="TableBorder2_1">&nbsp;<font color="#333333" face="Webdings">4</font>请再输入一遍新的密码</td> 
            <td bgcolor="#FFFFFF" class="TableBorder2_1">&nbsp; 
              <input name="RePassword" type="password" class="LoginInput" id="RePassword" size="15" maxlength="20"> 
              <font color="#FF0000">*</font>[<font color="#999999">确认一遍您输入的密码</font>]</td> 
          </tr> 
          <tr> 
            <td height="30" class="TableBorder2_1">&nbsp;<font color="#333333" face="Webdings">4</font>您的密码提示问题</td> 
            <td class="TableBorder2_1">&nbsp; 
              <input name="Question" type="text" class="question" id="Question" size="40" maxlength="40" value="<%=Question%>" readonly></td> 
          </tr> 
          <tr bgcolor="#FFFFFF"> 
            <td height="30" class="TableBorder2_1">&nbsp;<font color="#333333" face="Webdings">4</font>请输入答案</td> 
            <td class="TableBorder2_1">&nbsp; 
              <input name="Answer" type="text" class="LoginInput" id="Answer" size="20" maxlength="40"> 
              <font color="#FF0000">*</font>[<font color="#999999">为了系统安全要求必须验证您的身份合法性</font>]</td> 
          </tr> 
          <tr> 
            <td height="30" class="TableBorder2_2">&nbsp;</td> 
            <td> <input type="submit" value="提交修改" name="acc2" id="acc3" class="LoginInput"> 
&nbsp; 
              <input type="reset" value="清除重来" name="noacc2" id="noacc3" class="LoginInput"></td> 
          </tr> 
        </form> 
      </table></td> 
  </tr> 
</table> 
<!--#include file="footer.asp"--> 
</body>
</html>





⌨️ 快捷键说明

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