<!--#include file="include/nowshop.asp" -->
<!--#include file="md5.asp"-->
<%
call aspsql()
call checklogin()
if request("edit")="ok" then call edit()
%>
<html>
<head>
<title>用户中心-<%=sitename%>-<%=siteurl%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<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"-->
<%
set rs=conn.execute("select * from buser where UserId='"&request.cookies("buyok")("userid")&"'")
%>
<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>
                  <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"> <form name="myinfo" action="my_psw.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> </TD>
                          </TR>
                          <TR id=ps1 vAlign=center align=left> 
                            <TD height=35><input type=hidden name="userid" value="<%=rs("UserID")%>"> 
                              <FONT color=#ff0000>* </FONT>会员旧登录密码： 
                              <input name="oldpassword"  type="password" class=regtxt id="oldpassword3" size="10" maxlength="16"> 
                            </TD>
                          </TR>
                          <TR id=ps1 vAlign=center align=left> 
                            <TD height=35><FONT color=#ff0000>* </FONT>会员新登录密码： 
                              <input name="pw1" type="password" class=regtxt id="pw13" size="10" maxlength="16"> 
                            </TD>
                          </TR>
                          <TR id=ps2 vAlign=center align=left> 
                            <TD height=35><FONT color=#ff0000>* </FONT>确认新登录密码： 
                              <input name="pw2" type="password" class=regtxt id="pw23" size="10" maxlength="16"> 
                            </TD>
                          </TR>
                          <TR align=middle> 
                            <TD height=35><input name="Submit" type="submit" id="Submit" class=button value="确认修改"> 
                              &nbsp;&nbsp;&nbsp;&nbsp;  
                              <input type=hidden name=edit value="ok"></TD>
                          </TR>
                        </table>
                      </form></td>
                  </tr>
                </table></TD>
          </TR>
        </TBODY>
      </TABLE>
      <%
rs.close
set rs=nothing
%>
      <%
sub edit()
call buyok_check_path()
oldpassword=trim(request("oldpassword"))
Pw1=trim(request("pw1"))
Pw2=trim(request("pw2"))

if oldpassword="" or Pw1="" or pw2=""  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 Pw1<>pw2 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 llen(pw1)<4 then 
response.write "<script language='javascript'>"
response.write "alert('出错了，您输入的新密码的长度不够，要求最低4位。');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if

set rs=conn.execute("select * from buser where UserId='"&request.cookies("buyok")("userid")&"'")
if rs("userpassword")<>md5(oldpassword) 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.form("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("userpassword")=md5(pw1)
rs.update
rs.close
set rs=nothing

response.write "<script language='javascript'>"
response.write "alert('操作成功，您已经成功修改登陆密码。\n\n请牢记新的密码！');"
response.write "location.href='my_psw.asp';"
response.write "</script>"
response.end
end sub

conn.close
set conn=nothing
%>
    </td>
  </tr>
</table>
<!--#include file="down.asp"-->
</center>

</body>
</html>
