<!--#include file="inc/conn.asp"-->
<!--#include file="inc/EnCls_main.asp"-->
<!--#include file="inc/Skin_css.asp"-->

<!--#include file="inc/md5.asp"-->
<!--#include file="inc/function.asp"-->
<%
dim Action,UserName
dim rsUser,sqlUser
Action=trim(request("Action"))
UserName=trim(request("UserName"))
if Action="" and session("UserName")="" then
	response.redirect "EnUserServer.asp"
end if
if Action="Modify" and UserName<>"" then
	Set rsUser=Server.CreateObject("Adodb.RecordSet")
	sqlUser="select * from [User] where UserName='" & UserName & "'"
	rsUser.Open sqlUser,conn,1,3
	if rsUser.bof and rsUser.eof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>Customer can't find and specified!</li>"
	else
		dim OldPassword,Password,PwdConfirm
		OldPassword=trim(request("OldPassword"))
		Password=trim(request("Password"))
		PwdConfirm=trim(request("PwdConfirm"))
		if OldPassword="" then
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>Input old password!</li>"
		else
			if Instr(OldPassword,"=")>0 or Instr(OldPassword,"%")>0 or Instr(OldPassword,chr(32))>0 or Instr(OldPassword,"?")>0 or Instr(OldPassword,"&")>0 or Instr(OldPassword,";")>0 or Instr(OldPassword,",")>0 or Instr(OldPassword,"'")>0 or Instr(OldPassword,",")>0 or Instr(OldPassword,chr(34))>0 or Instr(OldPassword,chr(9))>0 or Instr(OldPassword,"£ ")>0 or Instr(OldPassword,"$")>0 then
				errmsg=errmsg+"<br><li>The illegal words in old password</li>"
				founderr=true
			else
				if md5(OldPassword)<>rsUser("Password") then
					FoundErr=True
					ErrMsg=ErrMsg & "<br><li>Input password that you input is not correct, have no power modification!</li>"
				end if
			end if
		end if
		if strLength(Password)>12 or strLength(Password)<6 then
			founderr=true
			errmsg=errmsg & "<br><li>Input new password (between 6 and 12 characters)</li>"
		else
			if Instr(Password,"=")>0 or Instr(Password,"%")>0 or Instr(Password,chr(32))>0 or Instr(Password,"?")>0 or Instr(Password,"&")>0 or Instr(Password,";")>0 or Instr(Password,",")>0 or Instr(Password,"'")>0 or Instr(Password,",")>0 or Instr(Password,chr(34))>0 or Instr(Password,chr(9))>0 or Instr(Password,"£ ")>0 or Instr(Password,"$")>0 then
				errmsg=errmsg+"<br><li>The illegal words in new password</li>"
				founderr=true
			end if
		end if
		if PwdConfirm="" then
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>Input confirmation password!</li>"
		else
			if PwdConfirm<>Password then
				FoundErr=True
				ErrMsg=ErrMsg & "<br><li>Confirm password and inconformity new password!</li>"
			end if
		end if
		if FoundErr<>true then
			rsUser("Password")=md5(Password)
			rsUser.update
		end if
	end if
	rsUser.close
	set rsUser=nothing
	if FoundErr=True then
		call WriteErrMsg()
	else
	    response.write"<SCRIPT language=JavaScript>alert('Succeed and modify the password!');"
        response.write"javascript:history.go(-1)</SCRIPT>"
	end if
else
%>
<!-- #include file="EnHead.asp" -->
<TABLE class="xmtable" border=0 align="center" cellPadding=0 cellSpacing=12 bgcolor="#FFFFFF">
  
  <tr> 
    <td  height="450" valign="top" Class="tdbg_left"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="10"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><% call ShowUserLogin() %>
              </td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="5"></td>
      </tr>
          </table>
      </td>
<TD width=1 background=images/MainLine.gif></TD>    
    <td width="670" valign="top" bgcolor="#FFFFFF"><table width="670" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><% If IsFlash10="Yes" Then %>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="<%=width10%>" height="<%=High10%>">
              <param name="movie" value="<%=enBannerUrl10%>">
              <param name="quality" value="high">
              <param name="wmode" value="transparent">
              <embed src="<%=enBannerUrl10%>" width="<%=width10%>" height="<%=High10%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>
            </object>
            <% Else %>
            <img src="<%=enBannerUrl10%>" width="<%=width10%>" height="<%=High10%>">
            <% end If%>
        </td>
      </tr>
    </table>
      <br>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" 
                              border=0>
        <TBODY>
          <TR>
            <TD class="title_b"></TD>
            <TD><TABLE cellSpacing=0 cellPadding=0 width="100%" 
                                border=0>
                <TBODY>
                  <TR>
                    <TD width=122 class="title_c">Member Center</TD>
                    <TD  class="title_right">ĦĦ</TD>
                  </TR>
                </TBODY>
            </TABLE></TD>
          </TR>
          <TR>
            <TD vAlign=bottom colSpan=2 height=5><TABLE cellSpacing=0 cellPadding=0 width="100%" 
                                border=0>
                <TBODY>
                  <TR>
                    <TD bgColor=#e3e3e3 
                                height=1></TD>
                  </TR>
                </TBODY>
            </TABLE></TD>
          </TR>
        </TBODY>
      </TABLE>
      <table  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="179"  valign="top"><table Class=border width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td height="206" valign="top"><FORM name="Form1" action="EnUserEditPwd.asp" method="post">
                    <table  border=0 align="center" cellpadding=2 cellspacing=2 >
                      <TR align=center class='tdbg'>
                        <TD height=20 colSpan=2><font color="#FF6600" class=font14><strong>Modify 
                          the user password</strong></font></TD>
                      </TR>
                      <TR>
                        <TD width="120" align="right">Username:</TD>
                        <TD><%=session("UserName")%>
                            <input name="UserName" type="hidden" value="<%=session("UserName")%>"></TD>
                      </TR>
                      <TR>
                        <TD width="120" align="right">Old password:</TD>
                        <TD><INPUT   type=password maxLength=16 size=30 name=OldPassword>
                        </TD>
                      </TR>
                      <TR>
                        <TD width="120" align="right">New password:</TD>
                        <TD><INPUT   type=password maxLength=16 size=30 name=Password>
                        </TD>
                      </TR>
                      <TR>
                        <TD width="120" align="right">Confirm password:</TD>
                        <TD><INPUT name=PwdConfirm   type=password id="PwdConfirm" size=30 maxLength=16>
                        </TD>
                      </TR>
                      <TR align="center">
                        <TD height="40" colspan="2"><input name="Action" type="hidden" id="Action" value="Modify">
                            <input name=Submit   type=submit id="Submit" value="Save" Class="BUTTON">
                        </TD>
                      </TR>
                    </TABLE>
                  </form></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
<TD width=1 background=images/MainLine.gif></TD>    
    <TD width="79" > </TD>
  </tr>
</table>
<!-- #include file="Inc/EnFoot.asp" -->
</BODY></HTML>
<%
end if
call CloseConn()
%>