<% if Session("huiyuan")="" then
   if request("userid")<>"" then
   userid=trim(replace(request("userid"),"'",""))
   else
   userid=1
   end if
   Response.redirect "cart-login.asp?userid="&userid
   Response.end
end if
%>
<!--#include file="top.asp" -->
<table width="760" bgcolor="#ffffff" border="0" align="center" cellpadding="0" cellspacing="0" class="table-zuoyou">
  <tr>
    <td width="170" valign="top" bgcolor="#f3f3f3" class="table-you"> 
    <!--#include file="conn/logininc.asp" -->
	<!--#include file="conn/centerinc.asp" --> 
    </TD>
    <td width="590" height="350" align="center" valign="top">
	 <!--#include file="conn/bannerinc.asp" --> 
	<table width="590" border="0" align="center" cellpadding="0" cellspacing="0" class="table-shang">
	 <tr>
	   <TD height=30 vAlign="middle">&nbsp;&nbsp;您目前的位置：<A href="index.asp?userid=<%=userid%>">网站首页</A> -&gt; <A href="huiyuan-1.asp?userid=<%=userid%>">会员中心</A> -&gt; 修改密码</td>
	 </TR>
	<TR><TD background="/image/1x3.gif" height="1"></TD></TR>
	 <tr><td align="center" height="350" valign="top"><br><br>
<%
'处理请求
  if Request("pass")<>"" then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from huiyuan where huiyuan='"&session("huiyuan")&"' and password='"&trim(replace(request("password"),"'",""))&"'"
rs.open sql,conn,1,3
if rs.eof then
Response.Write "<script>alert("&"'会员密码错误，不能修改。请确认您的会员原密码');location.href='huiyuan-4.asp?userid="&userid&"';</script>"
else
rs("password")=trim(replace(request("pass"),"'",""))
rs.update
rs.close
Response.Write "<script>alert("&"'会员密码修改成功，请以后用您的新密码登陆!');location.href='huiyuan-4.asp?userid="&userid&"';</script>"
end if
end if
set rs = conn.execute("select * from huiyuan where huiyuan='"&session("huiyuan")&"'") %>
<script language="javascript">
	function checksignup() {
		if ( document.ff.password.value == '' ) {
			window.alert('请输入您的原密码!!');
			document.ff.password.focus();
			return false;
		}
		if ( document.ff.pass.value == '' ) {
			window.alert('请输入您的新密码!!');
			document.ff.pass.focus();
			return false;
		}
		if ( document.ff.pass2.value == '' ) {
			window.alert('请确认新密码!!');
			document.ff.pass2.focus();
			return false;
		}
		if ( document.ff.pass.value!=document.ff.pass2.value) {
			window.alert('新密码与确认码不一致!!');
			document.ff.pass.focus();
			return false;
		}
			return true;
			}
</script> 
      <table width="300" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
        <form name="ff" method="post"  onSubmit="return checksignup()" action=?x=yes>
          <tr bgcolor="#f1f1f1"> 
            <td colspan="2" align="center" class="d13"><b>密码修改</b></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="30%" class="d13" align="center">会员帐号</td>
            <td width="70%" class="d13"><font color="#FF3333"><%=rs("huiyuan")%></font></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="30%" class="d13" align="center">原密码</td>
            <td width="70%" class="d13"> <input name="password" type="password" class="wenbenkuang" id="password" maxlength=200> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="30%" class="d13" align="center">新密码</td>
            <td width="70%" class="d13"> <input name="pass" type="password" class="wenbenkuang" id="pass" maxlength="50"> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td width="30%" class="d13" align="center">新密码确认</td>
            <td width="70%" class="d13"> <input name="pass2" type="password" class="wenbenkuang" id="pass2"> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td align="center" class="d13">&nbsp; </td>
            <td class="d13"> <input name="Submit2" type="submit" class="go-wenbenkuang" value="修改" onClick="javascript:return checksignup()"> 
              <input name="Submit2" type="reset" class="go-wenbenkuang" value="重写"> 
            </td>
          </tr>
        </form>
      </table><br>您的用户名和密码在<font color="#ff0000">“商盟”</font>所有购物网站内通用<br>
    </td>
  </tr>
</table></td>
  </tr>
</table>
<%rs.close
set rs=nothing%>
<!--#include file="bd.asp" -->