<!--#include file="conn.asp"-->
<%response.buffer="True"%>
<!--#include file="md5.asp"-->
<script language="JavaScript">

<!--
function get_onsubmit() {
if (document.get.userid.value=="")
	{
	  alert("请设定您的登陆名。")
	  document.get.userid.focus()
	  return false
	 }	 	 
}
// -->
</script>
<meta http-equiv="Content-Language" content="zh-cn">
<link href="css.CSS" rel="stylesheet" type="text/css">
<title>密码找回</title>
<style>
<!--
.style1 {
	font-size: 16px;
	font-family: "黑体";
}
-->
</style>

</head>
<% dim fpass1,fpass,strSql
if request.querystring("action")="edit" then
username=trim(request.querystring("username"))
fpass1=trim(request.form("fpass1"))
fpass=md5(fpass1)
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from [tt_link] where  username='"&username&"'",conn,1,3
if rs.eof or rs.bof then
response.write "<li>参数错误！"
response.end
end if
rs("password")=fpass
rs.update
rs.close
set rs=nothing
response.write "<script>alert('密码修改成功，请记住！');history.back();</Script>"
response.end
end if%>

<%dim sql,rs,username,answer1,answer
if Request.form("submit") <> "" then 
username=request.querystring("username") '页面之间传递参数
answer1= trim(Request.form("answer1"))
set rs=server.createobject("adodb.recordset")
sql="select * from [tt_link] where username='"&UserName&"'"
rs.open sql,conn,1,1
answer =rs("answer")
answer1=md5(answer1)
rs.close
set rs=nothing
if answer<>answer1 then
response.write "<script>alert('你的答案错误，请返回检查！');history.back();</Script>"
response.end
else
end if
end if

%>
<center>
<script language="VBScript">
<!--
function checkaddurl()
fpass1=urlform.fpass1.value
if urlform.fpass1.value="" or len(fpass1)<4 or len(fpass1)>12 then 
msgbox"请输入新密码（限4--12个字符）^_^"
urlform.fpass1.focus
elseif urlform.fpass1.value<>"" and urlform.fpass2.value<>urlform.fpass1.value then 
msgbox"确认密码不相同！^_^"
urlform.fpass2.focus
else
urlform.submit
end if

end function
-->
</script>
<body topmargin="0" leftmargin="0">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="400" id="AutoNumber1" height="147">
    <tr> 
      <td width="500" height="25" bgcolor="#FF9900"> <p align="center">&nbsp; ..:::第三步：请设置你的新密码:::...</td>
    </tr>
  <tr> 
    <td width="500" height="122"> 
      <table border="0" width="100%" id="table1" height="100">
  <form name="urlform" method="post" action="getpwd3.asp?action=edit&UserName=<%=UserName%>" onsubmit="return(search4())" >
    
  
    <tr valign="baseline"> 
      <td nowrap align="right"  class=tdc><span class="style1">输入新密码：</span></td>
      <td  class=tdc> 
        <input type="password" name="fpass1" value="" size="20" maxlength="12">（4-12字符内）
      </td>
    </tr>
     <tr valign="baseline"> 
      <td nowrap align="right"  class=tdc><span class="style1">密码确认：</span></td>
      <td  class=tdc> 
        <input type="password" name="fpass2" value="" size="20" maxlength="12">（4-12字符内） 
      </td>
    </tr>
     
    
    <tr valign="baseline"> 
      <td nowrap align="right"  class=tdc>　</td>
      <td  class=tdc> 
        <input type="button" name="sss" value="提交" onclick=checkaddurl()>
              　 
              <input type="button" name="aaa" value="取消" onClick="javascript:window.close()"> 
      </td>
		</tr></form>
		</table>
	</td>
  </tr>
  </table>
<table border="0" width="400" id="table2" bgcolor="#FF9900">
	<tr>
		<td>　</td>
	</tr>
</table>