getpass.asp

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

ASP
266
字号
<!--#include file="conn.asp" -->
<!--#include file="Include/inc.asp"-->
<!--#include file="Include/md5.asp"-->
<%
'====================================================================
'						----取回密码----
'						2004-3-17 p9
'
'
'====================================================================

Dim Action
Action=SafeRequest("action",0)

Sub SavePwd()
	Dim Question,UserName,Answer,NewPassword
	
		UserName=Request.Form("UName")
		Question=Request.Form("Question")
		Answer=Request.Form("Answer")
		NewPassword=Request.Form("Password")
		
		If not ChkForm(UserName,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)
		NewPassword=MD5(NewPassword)
		Sql="SELECT ID,Answer,Question FROM NB_User WHERE Reg_Name='"&UserName&"'"
		set rs=conn.execute(sql)
		If Not rs.bof and not rs.eof then
			If not Rs("Answer")=Answer Then
				sysErr(3)
			Else
			 Sql="Update NB_User Set Reg_Pass='"&NewPassword&"' Where Reg_Name='"&UserName&"'"
			 conn.execute(sql)
			 sysSus 3,""
			End If
		Else
			sysErr(18)
		End If
End Sub
%>
<html>
<head>
<link type='text/xml' rel='alternate' href='/Default.vsdisco'/>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=Application(sCacheName&"SystemData")(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"> <img src="Images/set.gif" width="29" height="11" align="absmiddle"> <a href="Index.asp"><strong><%=Application(sCacheName&"SystemData")(0)%></strong></a> -&gt; 取回密码</td> 
  </tr> 
</table> 
<%
	  	
	Select Case Action
	Case "SavePwd"
		SavePwd
	Case "Change"
		change
	Case "View"
		ViewQ
	Case ""
		Normal
	End Select	  
	
	'===========Step 1=========
	
	Sub Normal()
	Call NormalJS("document.reg.UName","请输入您的用户名") 
	%> 
<table width="762" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> 
  <tr> 
    <td bgcolor="#FFFFFF"><table border=0 cellpadding=3 cellspacing=2 width="760" align=center> 
        <tr style="color:#000000"> 
          <td bgcolor="#e6f0ff">&nbsp; 取回密码</td> 
        </tr> 
      </table> 
      <table width="760" align=center cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> 
        <form action="?action=View" method="post" name="reg" target="_self" onsubmit="return Noac;"> 
          <tr> 
            <td width="20%" height="30" class="TableBorder2_1">&nbsp;<font color="#FF6600" face="Webdings">4</font>请输入用户名</td> 
            <td class="TableBorder2_1">&nbsp; 
              <input name="UName" type="text" class="LoginInput" onkeydown="readkey()" id="UName" size="20" maxlength="40"> 
              <font color="#FF0000">*</font></td> 
          </tr> 
          <tr> 
            <td height="30">&nbsp;</td> 
            <td> <input type="button" value="提交" class="LoginInput" onclick="checkkey()" name="acc" id="acc"> 
&nbsp; 
              <input type="reset" value="清除重来" class="LoginInput" name="noacc" id="noacc"></td> 
          </tr> 
        </form> 
      </table></td> 
  </tr> 
</table> 
<%
	End Sub
	
	'==========Step 2==============
	
	Sub ViewQ()
	Dim Question,UserName
	UserName=Request.Form("UName")
	If not ChkForm(UserName,1) then sysErr(6)
	Sql="SELECT id,Question FROM NB_User WHERE Reg_Name='"&UserName&"'"
	Set rs=conn.execute(Sql)
	If Not Rs.Eof And Not Rs.Bof Then
	 Question=rs(1)
	Else
	 sysErr(18)
	End If
	set rs=nothing
	
	Call NormalJS("document.reg.Answer","请输入您的答案")
	%> 
<table width="762" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> 
  <tr> 
    <td bgcolor="#FFFFFF"><table border=0 cellpadding=3 cellspacing=2 width="760" align=center> 
        <tr style="color:#000000"> 
          <td bgcolor="#e6f0ff">&nbsp; 取回密码</td> 
        </tr> 
      </table> 
      <table width="760" align=center cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> 
        <form action="?action=Change" method="post" name="reg" target="_self" onsubmit="return Noac;"> 
          <tr> 
            <td width="20%" height="30" class="TableBorder2_1">&nbsp;<font color="#FF6600" 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> 
            <td height="30" class="TableBorder2_1">&nbsp;<font color="#FF6600" face="Webdings">4</font>请输入答案</td> 
            <td class="TableBorder2_1">&nbsp; 
              <input name="Answer" onkeydown="readkey()" 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"> <input name="UName" type="hidden" value="<%=UserName%>"></td> 
            <td> <input type="submit" value="提交" class="LoginInput" onclick="checkkey()" name="acc" id="acc"> 
&nbsp; 
              <input type="reset" value="清除重来" class="LoginInput" name="noacc" id="noacc"></td> 
          </tr> 
        </form> 
      </table></td> 
  </tr> 
</table> 
<%
		End Sub
		
	'=======Step 3=======	
		
		Sub Change()		
		Dim Question,Answer,UserName
		UserName=Request.Form("UName")
		Question=Request.Form("Question")
		Answer=Request.Form("Answer")
		
		If not ChkForm(UserName,1) then sysErr(6)
		If not ChkForm(Question,1) then sysErr(6)
		If not ChkForm(Answer,1) then sysErr(6)
		Answer=MD5(Answer)
		Sql="SELECT ID,Answer,Question FROM NB_User WHERE Reg_Name='"&UserName&"'"
		set rs=conn.execute(sql)
		If Not rs.bof and not rs.eof then
			If not Rs("Answer")=Answer Then
				sysErr(3)
			End If
		Else
			sysErr(18)
		End If
	%> 
<script language="JavaScript" type="text/javascript">
var ie=(document.all)?true:false;
var Noac = false;
function readkey(){
	if(ie){	if(window.event.keyCode==13){checkkey();}
	}
}

function checkkey(){
	if(document.reg.Password.value==''||document.reg.Password.value.length<6||document.reg.Password.value.length>14){
		alert("请填写您的新密码\n6-14个字符以内");
		document.reg.Password.select();
	}
	else{
		if(document.reg.RePassword.value!=document.reg.Password.value||document.reg.RePassword.value==''||document.reg.RePassword.value.length<6||document.reg.RePassword.value.length>14){
			alert("请再一次填写新密码\n必须与上面的密码相同");
			document.reg.RePassword.select();
		}
		else{
			Noac = true;
			document.reg.submit();
		}
	}
}
</script> 
<table width="762" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> 
  <tr> 
    <td bgcolor="#FFFFFF"><table border=0 cellpadding=3 cellspacing=2 width="760" align=center> 
        <tr style="color:#000000"> 
          <td bgcolor="#e6f0ff">&nbsp; 取回密码</td> 
        </tr> 
      </table> 
      <table width="760" align=center cellpadding="3" cellspacing="3" bgcolor="#FFFFFF"> 
        <form action="?action=SavePwd" method="post" name="reg" target="_self" onsubmit="return Noac;"> 
          <tr> 
            <td width="20%" height="30" class="TableBorder2_1">&nbsp;<font color="#FF6600" face="Webdings">4</font>请输入新的密码</td> 
            <td class="TableBorder2_1">&nbsp; 
              <input name="Password" type="password" onkeydown="readkey()" 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" class="TableBorder2_1">&nbsp;<font color="#FF6600" face="Webdings">4</font>请再输入一遍新的密码</td> 
            <td class="TableBorder2_1">&nbsp; 
              <input name="RePassword" type="password" onkeydown="readkey()" class="LoginInput" id="RePassword" size="15" maxlength="20"> 
              <font color="#FF0000">*</font>[<font color="#999999">确认一遍您输入的密码</font>]
              <input name="Question" type="hidden" id="Question" value="<%=Question%>"> 
              <input name="Answer" type="hidden" id="Answer" value="<%=Answer%>"> 
              <input name="UName" type="hidden" value="<%=UserName%>"></td> 
          </tr> 
          <tr> 
            <td height="30" class="TableBorder2_2">&nbsp;</td> 
            <td> <input type="button" value="提交修改" class="LoginInput" onclick="checkkey()" name="acc" id="acc"> 
&nbsp; 
              <input type="reset" value="清除重来" class="LoginInput" name="noacc" id="noacc"></td> 
          </tr> 
        </form> 
      </table></td> 
  </tr> 
</table> 
<%
	End Sub

Sub NormalJS(Control,Msg)
%> 
<script language="JavaScript" type="text/javascript">
var ie=(document.all)?true:false;
var Noac = false;
function readkey(){
	if(ie){	if(window.event.keyCode==13){checkkey();}
	}
}

function checkkey(){
	if(<%=Control%>.value==''){
		alert("<%=Msg%>");
		<%=Control%>.select();
	}
	else{
		Noac = true;
		document.reg.submit();
	}
}
</script> 
<% End Sub %> 
<!--#include file="footer.asp"--> 
</body>
</html>





⌨️ 快捷键说明

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