<!--#include file="../Include/Conno.asp" -->
<!--#include file="../Include/const.asp" -->
<!--#include file="../Include/md5.asp"-->
<!--#include file="IsLogin.asp" -->
<%
  Dim mOldPassword,mOldPassword2,mNewPassword
  Dim mUserName,mUserID
  Dim rs,mSql
  mUserID = Session("CurUserID")
  mUserName = Session("CurUserName")

  if Request.ServerVariables("REQUEST_METHOD")="POST" then
    mOldPassword = md5(Trim(Request.Form("txtOldPassword")),16)
    mNewPassword = Trim(Request.Form("txtNewPassword"))
    mNewPassword2 = Trim(Request.Form("txtNewPassword2"))
	mSql="Select F_Password,F_UserName From T_Member Where F_ID="&mUserID&" and F_PassWord='"&mOldPassword&"'"
    Set rs=conn.Execute(mSql)
    If rs.Eof Then
      response.write "<script>alert('对不起，旧密码输入错误！');history.back();</Script>"
	  response.end
	Else
	mUserNames=trim(rs("F_UserName"))
	    '密码修改成功
	  mSql="Update T_Member Set F_PassWord='"&md5(mNewPassword,16)&"' Where F_ID=" & mUserID
	  conn.Execute(mSql)
	  
 response.write "<script>alert('祝贺您,密码修改成功！');history.back();</Script>"
 End if
End if
%>
<HTML><HEAD><TITLE>会员俱乐部修改密码</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link href="../css/member.css" rel="stylesheet" type="text/css">
<script language="javascript">
function IsValidString(checkStr)
{
	var checkOK ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_ ";
	var allValid = true;
	if (checkStr.length<3)
	allValid=false
	for (i=0;i<checkStr.length;i++)
	{
	ch=checkStr.charAt(i);
	for(j=0;j<checkOK.length;j++)
	if(ch==checkOK.charAt(j))
	break;
	if(j==checkOK.length)
	{
	allValid = false;
	break;
	}
	}
	return allValid;
}

function CheckValidForm()
{
	if (!IsValidString(document.thisForm.txtOldPassword.value))
	{
		msg="对不起，密码必须为3个以上的数字或字母！";
		alert(msg);
	 	document.thisForm.txtOldPassword.focus();
	return false;
	}

	if (!IsValidString(document.thisForm.txtNewPassword.value))
	{
		msg="对不起，密码必须为3个以上的数字或字母！\n并且不能使用汉字当作密码！";
		alert(msg);
	 	document.thisForm.txtNewPassword.focus();
	return false;
	}

	if (document.thisForm.txtNewPassword.value!=document.thisForm.txtNewPassword2.value)
	{
		msg="对不起，密码与确认密码不一致！";
		alert(msg);
		document.thisForm.txtNewPassword.focus();
	return false;
	}
}
</script>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<!--#include file="../include/top.asp" -->
<!--#include file="../include/member_top.asp" --><!--#include file="club_top.asp" -->
<!--#include file="Top.asp" -->
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="183" height="400" align="center" valign="top"> 
      <!--#include file="left.asp" -->
    </td>
    <td width="597" align="center" valign="top"><table width="96%"  border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="100%" height="40" align="right"><img src="../Images/member/hy_c_3.gif" width="180" height="80"></td>
        </tr>
        <tr> 
          <td height="1" bgcolor="#c7c7c7"></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <form name="form1" method="post" action="?">
        <TABLE border=1 cellPadding=6 cellSpacing=0 id=AutoNumber58 
            style="BORDER-COLLAPSE: collapse" width="377">
          <TBODY>
            <TR> 
              <TD height=30 colspan="2"><B><SPAN 
                  style="FONT-SIZE: 14px">个人帐号( 
                <% = mUserName %>
                )</SPAN></B></TD>
            </TR>
            <TR> 
              <TD width="23%" align="center">旧 密 码:</TD>
              <TD width="77%" vAlign=top><input name="txtOldPassword" type="password" size="33" maxlength="16">
                *</TD>
            </TR>
            <TR> 
              <TD align="center" bgcolor="fcfcfc">新 密 码:</TD>
              <TD vAlign=top><input name="txtNewPassword" type="password" size="33" maxlength="16">
                *</TD>
            </TR>
            <TR> 
              <TD align="center" bgcolor="fcfcfc">确认密码:</TD>
              <TD vAlign=top><input name="txtNewPassword2" type="password" size="33" maxlength="16">
                *</TD>
            </TR>
            <TR> 
              <TD vAlign=top>&nbsp;</TD>
              <TD vAlign=top><input type="submit" name="Submit" value=" 确 定 "> 
                <input type="reset" name="Submit2" value=" 取 消 "> </TD>
            </TR>
          </TBODY>
        </TABLE>
      </form> </td>
  </tr>
</table>
<!--#include file="../include/bottom.asp" -->
</BODY></HTML>
