<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../conn/nosql.asp"-->
<!--#include file="../../conn/config.asp"-->
<!--#include file="../../conn/md5.asp"-->
 <%
if session("user")="" then
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
if session("id")="" then 
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
if request("action")="save" then
ypass=md5(nosql(request.form("ypass")))
pass=md5(nosql(request.form("pass")))
question=nosql(request.form("question"))
answer=nosql(request.form("answer"))

set rs=server.CreateObject("adodb.recordset")
sql="select * from snsn_user where username='"&session("user")&"' and email='"&session("Email")&"'"
rs.open sql,conn,1,3
if not (rs.Bof and rs.eof) then
if rs("pass")=ypass then
rs("pass")=pass
rs("question")=question  '问题
rs("answer")=answer  '答案
rs.update
response.write"<SCRIPT language=JavaScript>alert('资料修改成功，正在返回！');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
else
response.write"<SCRIPT language=JavaScript>alert('原密码输入错误，正在返回！');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
else
response.write"<SCRIPT language=JavaScript>alert('您填写的会员登陆名E-mail不存在，请返回！');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
rs.close
set rs=nothing

else
sql="select * from snsn_user where id="&session("id")&""
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>交易助手管理操作平台_<%=webname%></title>
<link rel="stylesheet" href="/css.css" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>
<script Language="JavaScript"> 
function FormCheck() 
{ 
if (trim(document.Form1.ypass.value) =="") 
{
alert("请填写您的原密码！");
document.Form1.ypass.focus();
return false; 
}

if (trim(document.Form1.pass.value) =="") 
{
alert("请填写您的密码！");
document.Form1.pass.focus();
return false; 
}
var filter=/^\s*[A-Za-z0-9]{6,20}\s*$/;
if (!filter.test(document.Form1.pass.value)) { 
alert("密码填写不正确,请重新填写！可使用的字符为（A-Z a-z 0-9 ）长度不小于6个字符，不超过20个字符，注意不要使用空格。"); 
document.Form1.pass.focus();
document.Form1.pass.select();
return false; 
} 
if(trim(document.Form1.confirmpassword.value) ==""){
alert("请输入您的确认密码！");
document.Form1.confirmpassword.focus();
return false;
}
if (document.Form1.pass.value!=document.Form1.confirmpassword.value ){
alert("两次填写的密码不一致，请重新填写！"); 
document.Form1.pass.focus();
document.Form1.pass.select();
return false; 
} 
if (trim(document.Form1.question.value) =="") 
{ 
alert("请选择密码提示问题！"); 
document.Form1.question.focus(); 
return (false); 
} 
if (trim(document.Form1.answer.value) =="") 
{ 
alert("请输入密码提示答案！"); 
document.Form1.answer.focus(); 
return (false); 
} 
 
document.Form1.submit()
}
//-->
//-->
function trim(inputString) {
	   
              if (typeof inputString != "string") { return inputString; }
              var retValue = inputString;
              var ch = retValue.substring(0, 1);
              while (ch == " ") { 
	          //检查字符串开始部分的空格
                  retValue = retValue.substring(1, retValue.length);
                  ch = retValue.substring(0, 1);
              }
              ch = retValue.substring(retValue.length-1, retValue.length);
              while (ch == " ") {
                 //检查字符串结束部分的空格
                 retValue = retValue.substring(0, retValue.length-1);
                 ch = retValue.substring(retValue.length-1, retValue.length);
              }
              while (retValue.indexOf("  ") != -1) { 
	         //将文字中间多个相连的空格变为一个空格
                 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
              }
              return retValue;
           } 

//--> 
</script>
<body><!--#include file="../../top.asp"-->
<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
    <td width="970"><table width="970"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="10"><img src="/img/m_left.gif" width="10" height="20"></td>
          <td width="950" bgcolor="#FFFFFF"></td>
          <td width="10"><img src="/img/m_right.gif" width="10" height="20"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="188" colspan="3"><table width="950"  border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="1" bgcolor="efefef"></td>
                <td width="200" height="77" valign="top"><!--#include file="../left.asp"--></td>
                <td width="1" bgcolor="efefef"></td>
                <td valign="top"><p>&nbsp;</p>
                    <BR>
                    <table width="95%" border="0" align="center" cellPadding="0" cellSpacing="0" bgColor="#BBD7FF">
                      <FORM name="Form1" action="?action=save" method="post">
                        <tr>
                          <td height="31" colSpan="2" bgcolor="#e8f4ff">&nbsp;&nbsp;<font color="#000000">请认真填写以下表单，带*号的为必填项。</font></td>
                        </tr>
                        <tr>
                          <td>
                            <TABLE cellSpacing=1 cellPadding=2 width="100%" 
            border=0>
                              <TBODY>
                                <TR bgcolor="#FFFFFF">
                                  <TD width="100" height="22" align=right><B><span class="font_11"><IMG src="/images/regent2.gif" width="5" height="4" hspace="3" align="absMiddle"></span>原来密码：</B></TD>
                                  <TD width="512">&nbsp;&nbsp;
                                      <INPUT 
                  name="ypass" 
                  type="password" class="wenbenkuang" id="ypass" size=22 maxLength=20>
                6-20位，请使用英文(a-z)、数字(0-9)</TD>
                                </TR>
                                <TR bgcolor="#FFFFFF">
                                  <TD width="100" height="22" align=right><B><span class="font_11"><IMG src="/images/regent2.gif" width="5" height="4" hspace="3" align="absMiddle"></span>设置密码：</B></TD>
                                  <TD width="512">&nbsp;&nbsp;
                                      <INPUT 
                  name="pass" 
                  type="password" class="wenbenkuang" size=22 maxLength=20>
                6-20位，请使用英文(a-z)、数字(0-9)</TD>
                                </TR>
                                <TR bgcolor="#FFFFFF">
                                  <TD height="22" align=center noWrap><B><span class="font_11"><IMG src="/images/regent2.gif" width="5" height="4" hspace="3" align="absMiddle"></span>确认密码：</B></TD>
                                  <TD>&nbsp;&nbsp;
                                      <INPUT 
                  name="confirmpassword" 
                  type="password" class="wenbenkuang" size=22 maxLength=20>
                注意区分大小写</TD>
                                </TR>
                                <TR bgcolor="#FFFFFF">
                                  <TD height="22" align=center><B><span class="font_11"><IMG src="/images/regent2.gif" width="5" height="4" hspace="3" align="absMiddle"></span>密码提示：</B></TD>
                                  <TD>&nbsp;&nbsp;
                                      <SELECT name="question" 
                  size=1 class="wenbenkuang">
                                        <OPTION value="" 
                    selected>请选择任一问题</OPTION>
                                        <OPTION 
                    value="你在哪所中学读初中？" <%if rs("question")="你在哪所中学读初中？" then%>selected<%end if%>>你在哪所中学读初中？</OPTION>
                                        <OPTION 
                    value="你的宠物叫什么名字？" <%if rs("question")="你的宠物叫什么名字？" then%>selected<%end if%>>你的宠物叫什么名字？</OPTION>
                                        <OPTION 
                    value="你最喜欢的音乐是？" <%if rs("question")="你最喜欢的音乐是？" then%>selected<%end if%>>你最喜欢的音乐是？</OPTION>
                                        <OPTION 
                    value="你最喜欢的球队是？" <%if rs("question")="你最喜欢的球队是？" then%>selected<%end if%>>你最喜欢的球队是？</OPTION>
                                        <OPTION 
                    value="你最喜欢的书是？" <%if rs("question")="你最喜欢的书是？" then%>selected<%end if%>>你最喜欢的书是？</OPTION>
                                        <OPTION 
                    value="你最好的朋友是？" <%if rs("question")="你最好的朋友是？" then%>selected<%end if%>>你最好的朋友是？</OPTION>
                                        <OPTION 
                    value="你的出生年月是？" <%if rs("question")="你的出生年月是？" then%>selected<%end if%>>你的出生年月是？</OPTION>
                                        <OPTION 
                    value="你爱人的名字是？" <%if rs("question")="你爱人的名字是？" then%>selected<%end if%>>你爱人的名字是？</OPTION>
                                        <OPTION 
                    value="你父亲的名字是？" <%if rs("question")="你父亲的名字是？" then%>selected<%end if%>>你父亲的名字是？</OPTION>
                                        <OPTION 
                    value="你母亲的名字是？" <%if rs("question")="你母亲的名字是？" then%>selected<%end if%>>你母亲的名字是？</OPTION>
                                    </SELECT></TD>
                                </TR>
                                <TR bgcolor="#FFFFFF">
                                  <TD height="22" align=center><B><span class="font_11"><IMG src="/images/regent2.gif" width="5" height="4" hspace="3" align="absMiddle"></span>提示答案：</B></TD>
                                  <TD>&nbsp;&nbsp;
                                      <INPUT name="answer" class="wenbenkuang" value="<%=rs("answer")%>" size=22 
                  maxLength=100>
                万一您忘记了密码，可以通过问题和答案找回。</TD>
                                </TR>
                              </TBODY>
                          </TABLE></TD>
                        </TR>
                        <tr bgColor="#ffffff">
                          <td height="46" colSpan="2">
                            <p> <span class="font_11">&nbsp;&nbsp; </span>
                                <INPUT name=Next type="button" class="go-wenbenkuang" onclick="FormCheck()" value=确认提交>
                          </p></td>
                        </tr>
                      </form>
                    </table>
                </td>
              </tr>
          </table></td>
        </tr>
    </table></td>
    <td valign="top"><img src="/img/index_img.jpg" width="10"></td>
  </tr>
</table>
<!--#include file="../../end.asp"-->
<%end if%>
</body>
</html>
