<!--#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

%>
<!-- #include file="Head.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=1002 align=center border=0>
  <TBODY>
    <TR>
      <TD vAlign=top width=210><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
          <TBODY>
            <TR>
              <TD><IMG height=40 src="imgbly/lt29.gif" width=210></TD>
            </TR>
            <TR>
              <TD align=middle><TABLE 
            style="BORDER-RIGHT: #e9e9e9 1px solid; BORDER-TOP: #e9e9e9 1px solid; BORDER-LEFT: #e9e9e9 1px solid; BORDER-BOTTOM: #e9e9e9 1px solid" 
            cellSpacing=0 cellPadding=0 width=178 border=0>
                <TBODY>
                  <TR>
                    <TD height=15>&nbsp;</TD>
                  </TR>
                  <TR>
                    <TD><TABLE cellSpacing=0 cellPadding=0 width=162 align=center 
                  border=0>
                        <TBODY>
                          <TR>
                            <TD class=lNav1><a href="UserEdit.asp">修改会员资料</a></TD>
                          </TR>
                          <TR>
                            <TD class=lNav><a href="UserEditPwd.asp">修改会员密码</a></TD>
                          </TR>
                          <TR>
                            <TD class=lNav><a href="UserOrder.asp">购物订单查询</a></TD>
                          </TR>
                          <TR>
                            <TD class=lNav><a href="FeedbackMember.asp">站内留言中心</a></TD>
                          </TR>
                          <TR>
                            <TD class=lNav><a href="UserLogout.asp?Action=Ch">退出会员中心</a></TD>
                          </TR>
                        </TBODY>
                    </TABLE></TD>
                  </TR>
                  <TR>
                    <TD height=15>&nbsp;</TD>
                  </TR>
                </TBODY>
              </TABLE></TD>
            </TR>
          </TBODY>
        </TABLE>
          <TABLE style="MARGIN-TOP: 10px; MARGIN-BOTTOM: 9px" cellSpacing=0 
      cellPadding=0 width=178 align=center border=0>
            <TBODY>
              <TR>
                <TD><SELECT 
            style="BORDER-RIGHT: #d4d0c8 1px solid; BORDER-TOP: #d4d0c8 1px solid; BORDER-LEFT: #d4d0c8 1px solid; WIDTH: 178px; BORDER-BOTTOM: #d4d0c8 1px solid" 
            onchange="if(this.value!='')document.location.href=this.value;" 
            name=select>
                    <OPTION selected>　- - -产品导航 - - -</OPTION>
                    <OPTION 
              value=Product.asp>产品系列1</OPTION>
                    <OPTION 
              value=Product.asp>产品系列2</OPTION>
                    <OPTION 
              value=Product.asp>产品系列3</OPTION>
                    <OPTION 
              value=Product.asp>产品系列4</OPTION>
                    <OPTION 
              value=Product.asp>产品系列5</OPTION>
                </SELECT></TD>
              </TR>
            </TBODY>
          </TABLE>
          <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
            <TBODY>
              <TR>
                <TD><IMG height=38 src="imgbly/tit_sel.gif" width=210></TD>
              </TR>
              <TR>
                <TD align=center><table width="180" border=0 align="center" cellpadding=0 
                        cellspacing=1 
                        style="BORDER-RIGHT: #e3e3e3 1px solid; BORDER-TOP: #e3e3e3 1px solid; BORDER-LEFT: #e3e3e3 1px solid; BORDER-BOTTOM: #e3e3e3 1px solid">
                    <tbody>
                      <tr>
                        <td style="PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><table border="0" cellpadding="2" cellspacing="0" align="center">
                            <form method="Get" name="myform" action="search.asp">
                              <tr>
                                <td height="28"><input type="text" name="keyword"  style="BORDER-RIGHT: #b7b7b7 1px solid; BORDER-TOP: #b7b7b7 1px solid; BORDER-LEFT: #b7b7b7 1px solid; WIDTH: 120px; BORDER-BOTTOM: #b7b7b7 1px solid" size=12 value="关键字" maxlength="50" onFocus="this.select();">
                                    <input type="submit" name="Submit"  value="搜索">
                                </td>
                              </tr>
                            </form>
                        </table></td>
                      </tr>
                  </table></TD>
              </TR>
          </TABLE></TD>
      <TD style="BACKGROUND: url(imgbly/bg_body.gif) repeat-y 50% top" vAlign=top><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
          <TBODY>
            <TR>
              <TD><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                  <TBODY>
                    <TR>
                      <TD background=imgbly/bg_rt.gif><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                          <TBODY>
                            <TR>
                              <TD><IMG src="imgbly/rt16.gif" width="209" height=41></TD>
                              <TD>&nbsp;</TD>
                              <TD class=loc 
                      style="BACKGROUND: url(img/bg_rtjiao.gif) no-repeat right 50%; COLOR: #9f9f9f" 
                      align=right>你现在的位置：<A href="index.asp">首页</A> &gt; 服务中心 &gt;修改资料</TD>
                            </TR>
                          </TBODY>
                      </TABLE></TD>
                      <TD width=17>&nbsp;</TD>
                    </TR>
                  </TBODY>
              </TABLE></TD>
            </TR>
          </TBODY>
        </TABLE>
          <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="3%" height="34" rowspan="3">&nbsp;</td>
              <td width="94%">&nbsp;</td>
              <td width="3%" rowspan="3">&nbsp;</td>
            </tr>
            <tr>
              <td><form name="Form1" action="UserEdit.asp" method="post">
                <table width=90% border=0 align="center" cellpadding=3 cellspacing=1 bgcolor="#E3E3E3" class='border'>
                  <tr align=center bgcolor="#FFFFFF" >
                    <td height=40 colspan=2><font color="#FF6600"><b>修改注册用户信息</b></font><font color="#ffffff" class=font14>&nbsp;</font></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td width="120" height="30" align="right">用 户 名：</td>
                    <td height="30"><input name=UserName value="<%=rsUser("UserName")%>" size=30   maxlength=14></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td width="120" height="30" align="right">性别：</td>
                    <td height="30"><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 bgcolor="#FFFFFF">
                    <td width="120" height="30" align="right">Email地址：</td>
                    <td height="30"><input name=Email value="<%=rsUser("Email")%>" size=30   maxlength=50>
                    </td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td width="120" height="30" align="right">主页：</td>
                    <td height="30"><input   maxlength=100 size=30 name=homepage value="<%=rsUser("HomePage")%>"></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td width="120" height="30" align="right">公司名称：</td>
                    <td height="30"><input name=CompanyName value="<%=rsUser("CompanyName")%>" size=30 maxlength=20></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td width="120" height="30" align="right">收货地址：</td>
                    <td height="30"><input name=Add value="<%=rsUser("Add")%>" size=30 maxlength=50></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td height="30" align="right">收货人：</td>
                    <td height="30"><input name=Receiver value="<%=rsUser("Receiver")%>" size=30 maxlength=50></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td height="30" align="right">邮政编码：</td>
                    <td height="30"><input name=Postcode value="<%=rsUser("Postcode")%>" size=30 maxlength=50></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td height="30" align="right">联系电话：<br></td>
                    <td height="30"><input name=Phone value="<%=rsUser("Phone")%>" size=30 maxlength=50></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td height="30" align="right">手机：</td>
                    <td height="30"><input name=Mobile value="<%=rsUser("Mobile")%>" size=30 maxlength=50></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td height="30" align="right">传 真：</td>
                    <td height="30"><input name=Fax value="<%=rsUser("Fax")%>" size=30 maxlength=50></td>
                  </tr>
                  <tr align="center" bgcolor="#FFFFFF" >
                    <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></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
        </table></TD>
    </TR>
  </TBODY>
</TABLE>
<!-- #include file="Inc/Foot.asp" -->
</BODY></HTML>
<%
		end if
	end if
	rsUser.close
	set rsUser=nothing
end if
call CloseConn()
%>