<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

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

<!--#include file="inc/config.asp"-->
<!--#include file="inc/function.asp"-->
<%
dim Action,UserName,FoundErr,ErrMsg
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 "UserServer.asp"
	else
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>参数不足！</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>找不到指定的用户！</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>性别不能为空</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不能为空</li>"
			else
				if IsValidEmail(Email)=false then
					errmsg=errmsg & "<br><li>您的Email有错误</li>"
			   		founderr=true
				end if
			end if
			if CompanyName="" then
				founderr=true
				errmsg=errmsg & "<br><li>公司名称不能为空</li>"
			end if
			if Add="" then
				founderr=true
				errmsg=errmsg & "<br><li>收货地址不能为空</li>"
			end if
			if Receiver="" then
				founderr=true
				errmsg=errmsg & "<br><li>收货人不能为空</li>"
			end if
			if Phone="" then
				founderr=true
				errmsg=errmsg & "<br><li>联系电话不能为空</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('会员资料修改成功！');"
                response.write"javascript:history.go(-1)</SCRIPT>"				
			else
				call WriteErrMsg()
			end if
		else

%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=SiteTitle%></title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
  <!-- #include file="top.asp" -->
  <div class="content">
  <table border="0" cellpadding="0" cellspacing="0" width="920" style=" margin-left:6px;">
    <!-- fwtable fwsrc="未命名" fwbase="content.jpg" fwstyle="Dreamweaver" fwdocid = "2089954175" fwnested="0" -->
    <tr>
      <td><img src="images/spacer.gif" width="6" height="1" border="0" alt="" /></td>
      <td><img src="images/spacer.gif" width="908" height="1" border="0" alt="" /></td>
      <td><img src="images/spacer.gif" width="6" height="1" border="0" alt="" /></td>
      <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
    </tr>
    <tr>
      <td colspan="3"><img name="content_r1_c1" src="images/content_r1_c1.jpg" width="920" height="6" border="0" id="content_r1_c1" alt="" /></td>
      <td><img src="images/spacer.gif" width="1" height="6" border="0" alt="" /></td>
    </tr>
    <tr>
      <td rowspan="5" background="images/content_r3_c1.jpg">&nbsp;</td>
      <td rowspan="5" bgcolor="fcfaf7" >
	  
	  <div class="mleft1">
	    <div  style="margin-left:5px;border:1px solid #ceb7b7;">
          <!--#include file="memberleft.asp"-->
	      </div>
	  </div>
	  <div class="mright1">
	  <div class="rtitle">会员中心</div>
	  <div class="rcontent">
	    <FORM name="Form1" action="UserEdit.asp" method="post">		  
                    <table width=98% border=0 align="center" cellpadding=2 cellspacing=2>
                      <TR align=center class='title'> 
                        <TD height=20 colSpan=2><font color="#FF6600" class=font14><b>修改注册用户信息</b></font></TD>
                      </TR>
                      <TR> 
                        <TD width="120" align="right">用 户 名：</TD>
                        <TD> <INPUT name=UserName value="<%=rsUser("UserName")%>" size=30   maxLength=14></TD>
                      </TR>
                      <TR> 
                        <TD width="120" align="right">性别：</TD>
                        <TD> <INPUT type=radio value="1" name=sex <%if rsUser("Sex")=1 then response.write "CHECKED"%>>
                          男 &nbsp;&nbsp; <INPUT type=radio value="0" name=sex <%if rsUser("Sex")=0 then response.write "CHECKED"%>>
                          女</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">主页：</TD>
                        <TD> <INPUT   maxLength=100 size=30 name=homepage value="<%=rsUser("HomePage")%>"></TD>
                      </TR>
                      <TR> 
                        <TD width="120" align="right">公司名称：</TD>
                        <TD> <INPUT name=CompanyName value="<%=rsUser("CompanyName")%>" size=30 maxLength=20></TD>
                      </TR>
                      <TR> 
                        <TD width="120" align="right">收货地址：</TD>
                        <TD> <INPUT name=Add value="<%=rsUser("Add")%>" size=30 maxLength=50></TD>
                      </TR>
                      <TR> 
                        <TD align="right">收货人：</TD>
                        <TD><INPUT name=Receiver value="<%=rsUser("Receiver")%>" size=30 maxLength=50></TD>
                      </TR>
                      <TR> 
                        <TD align="right">邮政编码：</TD>
                        <TD><INPUT name=Postcode value="<%=rsUser("Postcode")%>" size=30 maxLength=50></TD>
                      </TR>
                      <TR> 
                        <TD align="right">联系电话：<br></TD>
                        <TD><INPUT name=Phone value="<%=rsUser("Phone")%>" size=30 maxLength=50></TD>
                      </TR>
                      <TR>
                        <TD align="right">手机：</TD>
                        <TD><INPUT name=Mobile value="<%=rsUser("Mobile")%>" size=30 maxLength=50></TD>
                      </TR>
                      <TR> 
                        <TD align="right">传 真：</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="保存修改结果"> 
                      </TR>
                </TABLE> 
			  </form>
	    </div>
	  </div>	  </td>
      <td rowspan="5" background="images/content_r5_c3.jpg">&nbsp;</td>
      <td><img src="images/spacer.gif" width="1" height="" border="0" alt="" /></td>
    </tr>
    <tr>
      <td><img src="images/spacer.gif" width="1" height="10" border="0" alt="" /></td>
    </tr>
    <tr>
      <td><img src="images/spacer.gif" width="1" height="9" border="0" alt="" /></td>
    </tr>
    <tr>
      <td><img src="images/spacer.gif" width="1" height="11" border="0" alt="" /></td>
    </tr>
    <tr>
      <td><img src="images/spacer.gif" width="1" height="197" border="0" alt="" /></td>
    </tr>
    <tr>
      <td colspan="3"><img name="content_r7_c1" src="images/content_r7_c1.jpg" width="920" height="10" border="0" id="content_r7_c1" alt="" /></td>
      <td><img src="images/spacer.gif" width="1" height="10" border="0" alt="" /></td>
    </tr>
  </table>
</div>

<div id="footer"><!-- #include file="foot.asp" --></div>
</div>
</body>
</html>
<%
		end if
	end if
	rsUser.close
	set rsUser=nothing
end if
call CloseConn()
%>