<!--#include file="Inc/SysProduct.asp" -->
<!--#include file="Inc/md5.asp"-->
<!-- #include file="Head.asp" -->
<%
dim UserName,Password,PwdConfirm,Question,Answer,Sex,Email,HomePage,CompanyName,Add,Receiver,Postcode,Phone,Fax
UserName=trim(request("UserName"))
Password=trim(request("Password"))
PwdConfirm=trim(request("PwdConfirm"))
Question=trim(request("Question"))
Answer=trim(request("Answer"))
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 UserName="" or strLength(UserName)>14 or strLength(UserName)<4 then
	founderr=true
	errmsg=errmsg & "<br><li>请输入用户名(不能大于14小于4)</li>"
else
  	if Instr(UserName,"=")>0 or Instr(UserName,"%")>0 or Instr(UserName,chr(32))>0 or Instr(UserName,"?")>0 or Instr(UserName,"&")>0 or Instr(UserName,";")>0 or Instr(UserName,",")>0 or Instr(UserName,"'")>0 or Instr(UserName,",")>0 or Instr(UserName,chr(34))>0 or Instr(UserName,chr(9))>0 or Instr(UserName,"")>0 or Instr(UserName,"$")>0 then
		errmsg=errmsg+"<br><li>用户名中含有非法字符</li>"
		founderr=true
	end if
end if
if Password="" or strLength(Password)>12 or strLength(Password)<6 then
	founderr=true
	errmsg=errmsg & "<br><li>请输入密码(不能大于12小于6)</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>密码中含有非法字符</li>"
		founderr=true
	end if
end if
if PwdConfirm="" then
	founderr=true
	errmsg=errmsg & "<br><li>请输入确认密码(不能大于12小于6)</li>"
else
	if Password<>PwdConfirm then
		founderr=true
		errmsg=errmsg & "<br><li>密码和确认密码不一致</li>"
	end if
end if
if Question="" then
	founderr=true
	errmsg=errmsg & "<br><li>密码提示问题不能为空</li>"
end if
if Answer="" then
	founderr=true
	errmsg=errmsg & "<br><li>密码答案不能为空</li>"
end if
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 Add="" then
	founderr=true
	errmsg=errmsg & "<br><li>收货地址不能为空</li>"
end if
if Postcode="" then
	founderr=true
	errmsg=errmsg & "<br><li>邮政编码不能为空</li>"
end if
if Phone="" then
	founderr=true
	errmsg=errmsg & "<br><li>联系电话不能为空</li>"
end if

if founderr=false then
	dim sqlReg,rsReg
	sqlReg="select * from [User] where UserName='" & Username & "'"
	set rsReg=server.createobject("adodb.recordset")
	rsReg.open sqlReg,conn,1,3
	if not(rsReg.bof and rsReg.eof) then
		founderr=true
		errmsg=errmsg & "<br><li>你注册的用户已经存在！请换一个用户名再试试！</li>"
	else
		rsReg.addnew
		rsReg("UserName")=UserName
		rsReg("Password")=md5(Password)
		rsReg("Question")=Question
		rsReg("Answer")=md5(Answer)
		rsReg("Sex")=Sex
		rsReg("Email")=Email
		rsReg("HomePage")=HomePage
		rsReg("CompanyName")=CompanyName
		rsReg("Add")=Add
		rsReg("Receiver")=Receiver
		rsReg("Postcode")=Postcode
		rsReg("Phone")=Phone
		rsReg("Mobile")=Mobile
		rsReg("Fax")=Fax
		rsReg("RegDate")=Now()
		rsReg("LockUser")=false
		rsReg.update
		founderr=false
	end if
	rsReg.close
	set rsReg=nothing
end if		
%> 
<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 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=middle><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>
          <SCRIPT type=text/ecmascript>
function doLogin(fm){
   if(fm.uid.value=='' || fm.uid.value.indexOf("\'")!=-1){
		alert('对不起，用户名不能为空或含有单引号！');
		fm.uid.focus();
		return false;   			
   }
   if(fm.pwd.value==''){
		alert('对不起，密码不能为空！');
		fm.pwd.focus();
		return false;   			
   }

	var postData="Act=doLogin&uid="+escape(fm.uid.value)+"&pwd="+escape(fm.pwd.value);
	var loginAjax=new sc.Ajax("doLogin.asp", "GET", postData);
	loginAjax.addEventListener(loginEvent);
	loginAjax.Exec();

	function loginEvent(){
		var a=loginAjax.ajax;
		if(a.readyState==4){ 
			if(a.status==200){
				var rtn=a.responseText;
				if(rtn==1){
					alert('恭喜，您己经登录成功！');
					document.location.reload();
				}else{
					alert('对不起，登录失败！用户名/密码错。');
				}
			}else{
				alert("抱歉，服务器忙，请稍后再试..."+a.statusText );
			}
		}
	}
	return false;
}

function doLogout(){
  var loginAjax=new sc.Ajax('doLogin.asp', 'GET', 'Act=doLogout');
  loginAjax.addEventListener(logoutEvent);
  loginAjax.Exec();

	function logoutEvent(){
		var a=loginAjax.ajax;
		if(a.readyState==4){ 
			if(a.status==200){
				var rtn=a.responseText;
				if(rtn==1){
					alert('确定要退出吗！');
					document.location.href=".";
				}else{
					alert('对不起，退出失败！');
				}
			}else{
				alert("抱歉，服务器忙，请稍后再试..."+a.statusText );
			}
		}
	}
}

  </SCRIPT>
          <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
            <TBODY>
              <TR>
                <TD><IMG height=38 src="imgbly/tit_mem.gif" width=211></TD>
              </TR>
              <TR>
                <TD align=middle><TABLE 
            style="BORDER-RIGHT: #e3e3e3 1px solid; BORDER-TOP: #e3e3e3 1px solid; BORDER-LEFT: #e3e3e3 1px solid; BORDER-BOTTOM: #e3e3e3 1px solid" 
            cellSpacing=1 cellPadding=0 width=178 align=center border=0>
                    <TBODY>
                      <TR>
                        <TD align="center" 
                style="PADDING-RIGHT: 5px; PADDING-LEFT: 2px; PADDING-BOTTOM: 5px; PADDING-TOP: 6px"><% call ShowUserLogin() %></TD>
                      </TR>
                  </TABLE></TD>
              </TR>
            </TBODY>
        </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/rt20.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; <A 
                        href="about.asp">用户注册</A></TD>
                            </TR>
                          </TBODY>
                      </TABLE></TD>
                      <TD width=17>&nbsp;</TD>
                    </TR>
                  </TBODY>
              </TABLE></TD>
            </TR>
          </TBODY>
        </TABLE>
          <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
            <TBODY>
              <TR>
                <TD width=17 height=15>&nbsp;</TD>
                <TD>&nbsp;</TD>
                <TD width=17>&nbsp;</TD>
              </TR>
              <TR>
                <TD>&nbsp;</TD>
                <TD style="LINE-HEIGHT: 24px"><table width="560" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                      <td height="56"><div align="center">
                        <%
if founderr=false then
	call RegSuccess()
else
	call WriteErrmsg()
end if
%>
                      </div></td>
                    </tr>
                </table></TD>
                <TD>&nbsp;</TD>
              </TR>
              <TR>
                <TD height=10>&nbsp;</TD>
                <TD>&nbsp;</TD>
                <TD>&nbsp;</TD>
              </TR>
            </TBODY>
        </TABLE></TD>
    </TR>
  </TBODY>
</TABLE>

<!-- #include file="Inc/Foot.asp" -->
</BODY></HTML>

<%call CloseConn
sub WriteErrMsg()
    response.write "<table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
    response.write "<tr class='title'><td align='center' height='15'>由于以下的原因不能注册用户！</td></tr>"
    response.write "<tr class='tdbg'><td align='left' height='100'><br>" & errmsg & "<p align='center'>【<a href='javascript:onclick=history.go(-1)'>返 回</a>】<br></p></td></tr>"
	response.write "</table>" 
end sub

sub RegSuccess()
    response.write "<table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
    response.write "<tr class='title'><td align='center' height='15'>成功注册用户！</td></tr>"
    response.write "<tr class='tdbg'><td align='left' height='100'><br>你注册的用户名：" & UserName & "<p align='center'>【<a href='javascript:onclick=window.close()'>关 闭</a>】<br></p></td></tr>"
	response.write "</table>" 
end sub
%>
