<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/NoHackSql.Asp" -->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方网站http://www.ip126.com
'技术支持论坛 http://bbs.ip126.com/
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<%call SiteInfo
headid=7
Seotitle=" Find Password "
%>
<!--#include file="Head.Asp" -->
<TABLE width="960" border=0 align="center" cellPadding=0 cellSpacing=0 bgcolor="#FFFFFF">
  <TR>
    <TD height="5"></TD>
  </TR>
  <TR> 
    <TD height="172" ><table width="960" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td class="tdbg_left"  width="190" height="179" valign="top" > <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="34" class="title_left">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;&nbsp;User Login
                </td>
              </tr>
              <tr> 
                <td height="5"></td>
              </tr>
              <tr> 
                <td height="10"><table width="88%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td> 
                       
	<iframe src="login.asp"  frameborder="0" border="0px" scrolling="no" class="frame" height="120px" width="160px"></iframe>
                      </td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td height="5"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="34" colspan="2" class="title_left">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;&nbsp;Member Center</td>
              </tr>
     
 	<%=WebMenu()%>

            </table></td>
          <td width="6"></td>
          <td valign="top"><table Class=border width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="206" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td class="
title_right" height="32">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;Member Center</td>
                    </tr>
					            <TR> 
              <TD    
                  height=1> 
				  
 
 
 <table width="100%" height="19" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr> 
                            <td width="80%" height="18" bgcolor="#eeeeee"><%=WebLocation()%>Find Password</td>
                        <td width="79%" bgcolor="#eeeeee">&nbsp; </td>
                  </tr>
                  <tr> 
                    <td height="1" colspan="2" bgcolor="#999999"></td>
                  </tr>
                </table>
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="3" bgcolor="#FBFEFF">
                  <tr> 
                    <td height="8"></td>
                  </tr>
                 
                  <tr> 
                        <td>
						<%=WebContent()%>	

						 </td>
                  </tr>             
                  <tr> 
                    <td height="8"><div align="right"></div></td>
                  </tr>
                </table> 
                      </TD>
            </TR>
                  </table>
                  
                </td>
              </tr>
			  
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<!--#include file="Foot.Asp"-->
<%
function WebContent()
  dim rs,sql,NewPassword
  if request.QueryString("Step")="" then
%>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="5">
<form action="MemberGetPass.asp?Step=EnterNameMail" method="post" name="form" id="form">
  <tr>
    <td width="100" align="right">Member Name：</td>
    <td><input name="MemName" type="text" id="MemName" size="30" maxlength="16" /></td>
  </tr>
  <tr>
    <td align="right">Email：</td>
    <td><input name="Email" type="text" id="Email" size="30" maxlength="50" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input name="Next2" type="submit" value="Next" /></td>
  </tr>
  </form>
</table>
<%
  elseif request.QueryString("Step")="EnterNameMail" then
    set rs = server.createobject("adodb.recordset")
    sql="select * from TianTianCMS_Members where MemName='"&request.form("MemName")&"' and Email='"&request.form("Email")&"'"
	rs.open sql,conn,1,1
	if rs.eof then
	  WriteMsg("Member name or e-mail address error！")
      exit function
	end if
%>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="5">
<form action="MemberGetPass.asp?Step=EnterAnswer&ID=<%=rs("ID")%>" method="post" name="form" id="form">
  <tr>
    <td width="200" align="right">Member Name：</td>
    <td><%=rs("MemName")%></td>
  </tr>
  <tr>
    <td align="right">Email：</td>
    <td><%=rs("Email")%></td>
  </tr>
  <tr>
    <td align="right">Question：</td>
    <td><%=rs("Question")%></td>
  </tr>
  <tr>
    <td align="right">Answer：</td>
    <td><input name="Answer" type="text" size="30" maxlength="100" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input name="Next" type="submit" value="Next" /></td>
  </tr>
  </form>
</table>
<%
  elseif request.QueryString("Step")="EnterAnswer" Then
    If trim(request("Answer"))="" Then
	WriteMsg("Please fill in password-protected answer！")
	exit function
	End If
    set rs = server.createobject("adodb.recordset")
    sql="select * from TianTianCMS_Members where ID="&request.QueryString("ID")
    rs.open sql,conn,1,3
	if rs.eof then
	  WriteMsg("Parameter error！")
      exit function
	end if
    if rs("Answer")<>MD5(trim(request("Answer"))) then
      WriteMsg("Password-protected answer wrong！")
      exit function
    end if
    randomize timer
    NewPassword=Int(899999*Rnd() +100000)
    rs("Password")=MD5(NewPassword)
    rs.update
    rs.close
    set rs=nothing
	Response.Write "<script language=javascript>alert('Congratulations! Successfully retrieve your password! \ n new password is: "& NewPassword &" \ n Please log in to amend the new password！');window.location.href='Index.asp';</script>"
    exit function
  end if
end function
%>