<!--#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 UserName="" then
	UserName=session("UserName")
end if
if  UserName="" then
	if Action="" then
		response.redirect "enUserServer.asp"
	else
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>Parameter lack!</li>"
	end if
end if
if FoundErr=true then
	call WriteErrMsg()
else
	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>User can't find and specified!</li>"
		call writeErrMsg()
	else
		if Action="Modify" then
			dim Sex,Email,Homepage
			Sex=trim(Request("Sex"))
			Email=trim(request("Email"))
			Homepage=trim(request("Homepage"))
			CompanyName=trim(request("CompanyName"))
			Add=trim(request("Add"))
			Receiver=trim(request("Receiver"))
			Postcode=trim(request("Postcode"))
			Phone=trim(request("Phone"))
			Mobile=trim(request("Mobile"))
			Fax=trim(request("Fax"))
			if Sex="" then
				founderr=true
				errmsg=errmsg & "<br><li>Sex can't be blank</li>"
			else
				sex=cint(sex)
				if Sex<>0 and Sex<>1 then
					Sex=1
				end if
			end if
			if Email="" then
				founderr=true
				errmsg=errmsg & "<br><li>Email can't be blank</li>"
			else
				if IsValidEmail(Email)=false then
					errmsg=errmsg & "<br><li>Your Email has the mistake</li>"
			   		founderr=true
				end if
			end if
			if CompanyName="" then
				founderr=true
				errmsg=errmsg & "<br><li>Company name can't be blank</li>"
			end if
			if Add="" then
				founderr=true
				errmsg=errmsg & "<br><li>Receiver address can't be blank</li>"
			end if
			if Receiver="" then
				founderr=true
				errmsg=errmsg & "<br><li>Receiver can't be blank</li>"
			end if
			if Phone="" then
				founderr=true
				errmsg=errmsg & "<br><li>Tel can't be blank</li>"
			end if
			if FoundErr<>true then
				rsUser("Sex")=Sex
				rsUser("Email")=Email
				rsUser("HomePage")=HomePage
				rsUser("CompanyName")=CompanyName
				rsUser("Add")=Add
				rsUser("Receiver")=Receiver
				rsUser("Postcode")=Postcode
				rsUser("Phone")=Phone
				rsUser("Mobile")=Mobile
				rsUser("Fax")=Fax				
				rsUser("LastLoginTime")=Now()
				rsUser.update
				response.write"<SCRIPT language=JavaScript>alert('Member data modifies and succeeds! ');"
                response.write"javascript:history.go(-1)</SCRIPT>"				
			else
				call WriteErrMsg()
			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" cellpadding="0" cellspacing="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</font></TD>
                    <TD width="537" 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 Class=border width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="206" valign="top"><FORM name="Form1" action="EnUserEdit.asp" method="post">
            <table width=500 border=0 align="center" cellpadding=2 cellspacing=2 class='border'>
              <TR align=center class='tdbg'>
                <TD height=20 colSpan=2><font color="#FF6600" size="3" class=en><b>Modify 
                  User Information</b></font><font color="#FF6600" class=font14>&nbsp;</font><font color="#FF6600" class=font14>&nbsp;</font></TD>
              </TR>
              <TR>
                <TD width="120" align="right">User Name:</TD>
                <TD><INPUT name=UserName value="<%=rsUser("UserName")%>" size=30   maxLength=14></TD>
              </TR>
              <TR>
                <TD width="120" align="right">Sex:</TD>
                <TD><INPUT type=radio value="1" name=sex <%if rsUser("Sex")=1 then response.write "CHECKED"%>>
                  Male&nbsp;&nbsp;
                  <INPUT type=radio value="0" name=sex <%if rsUser("Sex")=0 then response.write "CHECKED"%>>
                  Female</TD>
              </TR>
              <TR>
                <TD width="120" align="right">Email:</TD>
                <TD><INPUT name=Email value="<%=rsUser("Email")%>" size=30   maxLength=50>
                </TD>
              </TR>
              <TR>
                <TD width="120" align="right">Home Page:</TD>
                <TD><INPUT   maxLength=100 size=30 name=homepage value="<%=rsUser("HomePage")%>"></TD>
              </TR>
              <TR>
                <TD width="120" align="right">Company Name:</TD>
                <TD><INPUT name=CompanyName value="<%=rsUser("CompanyName")%>" size=30 maxLength=20></TD>
              </TR>
              <TR>
                <TD width="120" align="right">Address:</TD>
                <TD><INPUT name=Add value="<%=rsUser("Add")%>" size=30 maxLength=50></TD>
              </TR>
              <TR>
                <TD align="right">Receiver:</TD>
                <TD><INPUT name=Receiver value="<%=rsUser("Receiver")%>" size=30 maxLength=50></TD>
              </TR>
              <TR>
                <TD align="right">Postcode:</TD>
                <TD><INPUT name=Postcode value="<%=rsUser("Postcode")%>" size=30 maxLength=50></TD>
              </TR>
              <TR>
                <TD align="right">Phone:<br></TD>
                <TD><INPUT name=Phone value="<%=rsUser("Phone")%>" size=30 maxLength=50></TD>
              </TR>
              <TR>
                <TD align="right">Mobile:</TD>
                <TD><INPUT name=Mobile value="<%=rsUser("Mobile")%>" size=30 maxLength=50></TD>
              </TR>
              <TR>
                <TD align="right">Fax:</TD>
                <TD><INPUT name=Fax value="<%=rsUser("Fax")%>" size=30 maxLength=50></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">
                </TR>
            </TABLE>
        </form></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
	end if
	rsUser.close
	set rsUser=nothing
end if
call CloseConn()
%>