<!--#include file="conn/conn.asp"-->
<!--#include file="conn/md5.asp"-->
<!--#include file="conn/nosql.asp"-->
<html>
<head>
<title>取回密码-<%=webname%></title>
<link rel="SHORTCUT ICON" href="/shortcut.ico">
<meta name="generator" content="snsn-shop">
<meta name=keywords content="<%=webgjz%>">
<meta name="description" content="<%=webmx%>">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta http-equiv="MSThemeCompatible" content="Yes">
<link href="/css.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
<!--
function form1_onsubmit() {
if (document.form1.username.value=="")
	{
	  alert("用户名都不填，怎么能找回您的密码呢？")
	  document.form1.username.focus()
	  return false
	 }
}
// --></script>
<script language="javascript">
<!--
function form2_onsubmit() {
if (document.form2.answer.value=="")
	{
	  alert("请输入您的问题答案。")
	  document.form2.answer.focus()
	  return false
	 }
}
// --></script>
<script LANGUAGE="javascript">
<!--
function FrmAddLink_onsubmit() {
 if (document.FrmAddLink.passwd.value=="")
	{
	  alert("对不起，请您输入密码！")
	  document.FrmAddLink.passwd.focus()
	  return false
	 }
else if (document.FrmAddLink.passwd.value.length < 6)
	{
	  alert("为了安全，您的密码应该长一点！")
	  document.FrmAddLink.passwd.focus()
	  return false
	 }
else if (document.FrmAddLink.passwd.value.length > 16)
	{
	  alert("您的密码太长了吧！")
	  document.FrmAddLink.passwd.focus()
	  return false
	 }
else if (document.FrmAddLink.passwd2.value=="")
	{
	  alert("对不起，请您输入验证密码！")
	  document.FrmAddLink.passwd2.focus()
	  return false
	 }
else if (document.FrmAddLink.passwd2.value !== document.FrmAddLink.passwd.value)
	{
	  alert("对不起，您两次输入的密码不一致！")
	  document.FrmAddLink.passwd2.focus()
	  return false
	 }
}

//-->
</script>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
}
.style2 {color: #FFFFFF}
-->
</style>
</head>
<body topmargin="11" leftmargin="0" oncontextmenu="self.event.returnValue=false">
<div align="center">
<%if request("action")="" then%><br>
<form method="POST" name="form1" language="javascript" onsubmit="return form1_onsubmit()" action="?action=1">
    <table width="280" height="89" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
      <tr>
        <td width="100%" height="25" bgcolor="efefef"> 忘记密码了？回答几个问题后就可以重设密码啦！ </td>
      </tr>
      <tr>
        <td width="100%" height="25" bgcolor="#FFFFFF">
          <p>第一步：填写您的用户名。 </td>
      </tr>
      <tr>
        <td width="100%" height="25" bgcolor="#FFFFFF">
          <p>
            <input type="text" name="username" size="22"  class="wenbenkuang"  >
        </td>
      </tr>
      <tr>
        <td height="25" bgcolor="#FFFFFF"><input name="Submit3" type="submit" class="go-wenbenkuang" value="下一步"></td>
      </tr>
    </table>
</form><%elseif request("action")="1" then%>
  <%if Not ChkPosturl then response.redirect ("login.asp")
username=nosql(request.form("username"))
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from snsn_user where username='"&username&"'"
rs.open sql,conn,1,1
If rs.eof Then
%>
<script language="javascript">
alert("这个用户还没有注册呢，请到首页注册吧！")
location.href="javascript:history.back()"
</script>
<%
End If
%><br>
 <form method="POST" name="form2" language="javascript" onsubmit="return form2_onsubmit()" action="?action=2&username=<%=username%>">
    <table width="280" height="1" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC" style="border-collapse: collapse">
      <%if rs("question")<>"" then%>
      <tr>
        <td width="100%" height="22" bgcolor="efefef">
          <p>第二步：请回答下列问题。 </td>
      </tr>
      <tr>
        <td width="100%" height="22" bgcolor="#FFFFFF">
          <p>问题：<%=rs("question")%>
              <%     
conn.close     
set conn=nothing     
%>
        </td>
      </tr>
      <tr>
        <td width="100%" height="1" bgcolor="#FFFFFF">
          <p>答案：
              <input type="text" name="answer" size="22" class="wenbenkuang"  >
              <input name="Submit" type="submit" class="go-wenbenkuang" value="下一步">
<br>您在个人资料中设置的提示问题为空，所以不能找回密码！如果您真的忘记了密码，请与<a href="mailto:<%=webemail%>">管理员</a>联系！ 
        </td>
      </tr>
      <%end if%>
    </table>
 </form>
  <%elseif request("action")="2" then%>
  <%if Not ChkPosturl then response.redirect ("login.asp")
username=nosql(request("username"))
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from [snsn_user] where username='"&username&"'"
rs.open sql,conn,1,1
If rs.eof Then
%>
<script language="javascript">
alert("这个用户还没有注册呢，请到首页注册吧！")
location.href="javascript:history.back()"
</script>
<%
End If
If rs("answer")<>trim(request("answer")) Then
%>
<script language="javascript">
alert("答案错误！")
location.href="javascript:history.back()"
</script>
<%
End If
%><br>
<form method="POST" name="FrmAddLink" language="javascript" onsubmit="return FrmAddLink_onsubmit()" action="?action=3&username=<%=username%>&depid=<%=depid%>"> 
  <table width="280" height="49" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td width="100%" height="25" bgcolor="efefef">
        <p>第三步：重新设置密码。 </td>
    </tr>
    <tr>
      <td width="100%" height="25" bgcolor="#FFFFFF"> 新&nbsp;密&nbsp;码：
      <input type="password" name="passwd" size="22" maxlenght=16 class="wenbenkuang"  >      </td>
    </tr>
    <tr>
      <td height="25" bgcolor="#FFFFFF">验证密码：
      <input type="password" name="passwd2" size="22" maxlenght=16 class="wenbenkuang"  ></td>
    </tr>
    <tr>
      <td height="25" bgcolor="#FFFFFF"><input name="Submit2" type="submit" class="go-wenbenkuang" value="下一步设置新密码"></td>
    </tr>
  </table>
</form>


<%elseif request("action")="3" then%>
<%if Not ChkPosturl then response.redirect ("login.asp")
username=nosql(request("username"))
passwd=md5(nosql(trim(request.form("passwd"))))
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from [snsn_user] where username='"&username&"'"
rs.open sql,conn,1,3
If rs.eof Then
%>
<script language="javascript">
alert("这个用户还没有注册呢，请到首页注册吧！")
location.href="javascript:history.back()"
</script>
<%
else
rs("pass")=passwd
rs.update
end if
rs.close
set rs=nothing
conn.close   
set conn=nothing 
%>
<TBODY><TR>
  <TD align=left vAlign=top bgcolor="#FFFFFF">  
<tr><td align="center"><table border="0" cellpadding="0" width="99%" cellspacing="0" height="49">
  <tr>
    <td width="100%" height="1">
      <br><br>
      <p align="center">密码设置成功,请返回首页重新登录！                   <p align="center"><a href="javascript:window.close()" class="1 style2">关闭窗口</a>          </td>
  </tr>
</table>
    <%end if%>
</body>
</html>