<!--#include file="include/nowshop.asp" -->
<!--#include file="md5.asp"-->
<%
call aspsql()
call checklogin()
if request("set")="ok" then call setq()
%>
<html>
<head>
<title>取回密码设置-<%=sitename%>-<%=siteurl%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="description" content="<%=sitedescription%>">
<meta name="keywords" content="<%=sitekeywords%>">
<LINK href="images/css.css" type=text/css rel=stylesheet>
<LINK href="list/newhead.css" type=text/css rel=stylesheet>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<!--#include file="top.asp"-->

<table width="768" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td width="186" align="center" valign="top" bgcolor="#f4f5fd"><!--#include file="zuo_member.asp"-->&nbsp;</td>
    <td align="center" valign="top"> <TABLE width=560 border=0 cellPadding=0 cellSpacing=0 bordercolor="#587ad9">
        <TBODY>
          <TR> 
            <TD height=12><table align=left>
                  <tr> 
                    <td align="center" valign="middle"> <TABLE cellSpacing=0 cellPadding=0 width=547 border=0 style="BORDER-RIGHT: #b1bfee 1px solid; BORDER-TOP: #b1bfee 1px solid; BORDER-LEFT: #b1bfee 1px solid; BORDER-BOTTOM: #b1bfee 1px solid" 
>
                        <TBODY>
                          <TR> 
                            <TD bgColor=#f4f5fd height=25><font color="#000000">　<B>设置密码保护问题</B></font></TD>
                          </TR>
                        </TBODY>
                      </TABLE></td>
                  </tr>
                  <tr> 
                    <td align="center" valign="middle"> <%
set rs=conn.execute("select * from buser where UserId='"&request.cookies("buyok")("userid")&"'")
%> <form name="myinfo" action="my_psw_set.asp" method="post">
                        <table width="547" border="0" cellpadding="0" cellspacing="0" style="BORDER-RIGHT: #b1bfee 1px solid; BORDER-TOP: #b1bfee 1px solid; BORDER-LEFT: #b1bfee 1px solid; BORDER-BOTTOM: #b1bfee 1px solid">
                          <TR id=ps1 vAlign=center align=left> 
                            <TD height=35>&nbsp; 会员称谓：<font color="#FF0000"><b><%=rs("UserID")%></b></font> <input type=hidden name="userid2" value="<%=rs("UserID")%>"> 
                              <input type=hidden name="UserAnswer3" value="<%=rs("UserAnswer")%>"></TD>
                          </TR>
                          <TR id=ps1 vAlign=center align=left> 
                            <TD height=35> <FONT color=#ff0000>* </FONT>原密码提示问题： 
                              <input size=35 type="text" name="UserQuestion2" value="<%=rs("UserQuestion")%>" maxlength=50 class=regtxt> 
                            </TD>
                          </TR>
                          <TR id=ps1 vAlign=center align=left> 
                            <TD height=35><FONT color=#ff0000>* </FONT>原提示问题答案： 
                              <input name="UserAnswer22" type="text" class=regtxt id="UserAnswer22" size=35 maxlength=50></TD>
                          </TR>
                          <TR id=ps1 vAlign=center align=left> 
                            <TD height=35><FONT color=#ff0000>* </FONT>新密码提示问题： 
                              <input name="UserQuestion12" type="text" class=regtxt id="UserQuestion12" value="" size=35 maxlength=50> 
                            </TD>
                          </TR>
                          <TR id=ps2 vAlign=center align=left> 
                            <TD height=35><FONT color=#ff0000>* </FONT>新提示问题答案： 
                              <input name="UserAnswer12" type="text" class=regtxt id="UserAnswer12" value="" size=35 maxlength=50> 
                            </TD>
                          </TR>
                          <TR align=middle> 
                            <TD height=35><input type="submit" name="Submit3" class=button value="确认修改"> 
                              &nbsp;&nbsp;&nbsp;&nbsp; <input name="Submit22" type="reset" class=button value="不做修改"> 
                              <input type=hidden name=set2 value="ok"> </TD>
                          </TR>
                        </table>
                      </form></td>
                  </tr>
                </table></TD>
          </TR>
        </TBODY>
      </TABLE>
      <%
rs.close
set rs=nothing
%>
    </td>
  </tr>
</table>
</td>
</TR> </TABLE>
<!--#include file="down.asp"--> 
</center>
</body>
</html>

<%
sub setq()
call buyok_check_path()
UserQuestion=trim(request("UserQuestion"))
UserAnswer=trim(request("UserAnswer"))
UserAnswer2=trim(request("UserAnswer2"))
UserQuestion1=trim(request("UserQuestion1"))
UserAnswer1=trim(request("UserAnswer1"))

if UserQuestion="" or UserAnswer2="" or UserQuestion1="" or UserAnswer1=""  then 
response.write "<script language='javascript'>"
response.write "alert('出错了，填写不完整，请填写取回密码的问题及答案。');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if	

if len(UserAnswer1)<3 then 
response.write "<script language='javascript'>"
response.write "alert('出错了，您输入答案的太短了，要求最低3位。');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if

if md5(UserAnswer2)<>UserAnswer then
response.write "<script language='javascript'>"
response.write "alert('出错了，原密码提示答案错误。');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if	

if ucase(request.cookies("buyok")("userid"))<>ucase(request("userid")) then
response.write "<script language='javascript'>"
response.write "alert('出错了，您无权进行此操作。');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if

sql = "select * from buser where UserId='"&request.cookies("buyok")("userid")&"'"
set rs=Server.Createobject("ADODB.RecordSet")
rs.Open sql,conn,1,3
rs("UserQuestion")=UserQuestion1
rs("UserAnswer")=md5(UserAnswer1)
rs.update
rs.close
set rs=nothing

response.write "<script language='javascript'>"
response.write "alert('操作成功，您设置的问题和答案已保存。\n\n在您忘记密码的时候，可通过回答此问题来找回密码！');"
response.write "location.href='my_psw_set.asp';"
response.write "</script>"
response.end
end sub

conn.close
set conn=nothing
%>
