<!--#include file="conn.asp"-->
<!--#include file="buy2buysys.asp"-->
<!--#INCLUDE file="b2b_includefile/b2b_mail.asp"-->
<%dim action
action=FormatSQL(SafeRequest("action",0))
%>
<html>
<head>
<title><%=webname%>--新用户注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #ffffff;
}
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style1 {color: #FF0000}
.style4 {font-weight: bold}
-->
</style></head>
<script language=JavaScript>
<%dim sql,i,j
	set rs_s=server.createobject("adodb.recordset")
	sql="select * from welcomeshengbuy order by shengorder"
	rs_s.open sql,conn,1,1
%>
	var selects=[];
	selects['xxx']=new Array(new Option('请选择城市……','xxx'));
<%
	for i=1 to rs_s.recordcount
%>
	selects['<%=rs_s("ShengNo")%>']=new Array(
<%
	set rs_s1=server.createobject("adodb.recordset")
	sql="select * from welcomeshibuy where shengid="&rs_s("id")&" order by shiorder"
	rs_s1.open sql,conn,1,1
	if rs_s1.recordcount>0 then 
		for j=1 to rs_s1.recordcount
		if j=rs_s1.recordcount then 
%>
		new Option('<%=trim(rs_s1("shiname"))%>','<%=trim(rs_s1("shiNo"))%>'));
<%		else
%>
		new Option('<%=trim(rs_s1("shiname"))%>','<%=trim(rs_s1("shiNo"))%>'),
<%
		end if
		rs_s1.movenext
		next
	else 
%>
		new Option('','0'));
<%
	end if
	rs_s1.close
	set rs_s1=nothing
	rs_s.movenext
	next
rs_s.close
set rs_s=nothing
%>
	function chsel(){
		with (document.userinfo){
			if(welcomeshengbuy.value) {
				welcomeshibuy.options.length=0;
				for(var i=0;i<selects[welcomeshengbuy.value].length;i++){
					welcomeshibuy.add(selects[welcomeshengbuy.value][i]);
				}
			}
		}
	}

function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
</script><body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="center" background="images/bg.jpg"><object 
      codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 
      height=451 width=960 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>
          <param name="movie" value="flash/main_3.swf">
          <param name="quality" value="high">
          <param name="wmode" value="transparent">
          <embed src="flash/main_3.swf" quality="high" 
      pluginspage="http://www.macromedia.com/go/getflashplayer" 
      type="application/x-shockwave-flash" width="960" 
      height="451"></embed>
      </object></td></tr>
  </table>
<!--#include file="b2b_includefile/b2b_top.asp" -->
<table width="918" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="181" align="right" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="182">
      <!-- fwtable fwsrc="未命名" fwbase="productleft.gif" fwstyle="Dreamweaver" fwdocid = "287395630" fwnested="1" -->
      <tr>
        <td><TABLE cellSpacing=0 cellPadding=0 width=180 
      background=images/left_best02.gif border=0>
            <TBODY>
              <TR>
                <TD bgcolor="#FFFFFF">&nbsp;</TD>
              </TR>
              <TR>
                <TD><IMG src="images/hydl.gif" width="181" height="57" border=0></TD>
              </TR>
              <TR>
                <TD align=middle><!-- #include file="login.asp"--></TD>
              </TR>
              <TR>
                <TD><IMG src="images/left_ranking02.gif" width="181" height="16" 
      border=0></TD>
              </TR>
            </TBODY>
        </TABLE></td>
      </tr>
    </table></td>
    <td width="724" align="center" valign="top"><table width="665" border="0" align="center" cellpadding="0" cellspacing="0">
      <!-- fwtable fwsrc="内页商品列表.png" fwbase="cplist.gif" fwstyle="Dreamweaver" fwdocid = "1831702457" fwnested="1" -->
      <tr>
        <td height="10">&nbsp;</td>
      </tr>
      <tr>
        <td width="665" height="120" background="images/hyzc.gif">&nbsp;</td>
      </tr>
      <tr>
        <td width="665" align="center" background="image/cplist_03.gif"><table width="99%" border="0" align="right" cellpadding="0" cellspacing="0">

          <tr>
            <td width="100%"><table width="100%"  border="0" align="center" cellpadding="5" cellspacing="5">
                <tr>
                  <td width="100%"><%
select case action
case ""%>
                      <TABLE WIDTH="100%" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0" bgcolor="#FFFFFF">
                        <TR>
                          <TD HEIGHT="18" ALIGN="center"><B>欢迎您阅读<%=webname%>服务条款！</B><br>
                              <br>
                            请仔细阅读本下述文本，<%=webname%>将依据以下服务条款提供您所享有的服务。<br>
                            如果您接受，请点按<span class="style1"><strong>“我同意”</strong></span>进入注册页面。<br></TD>
                        </TR>
                        <TR>
                          <TD align=center valign="top"><table width="100%"  border="0" cellspacing="5" cellpadding="5">
                              <tr>
                                <td bgcolor="#F7F7F7">欢迎阅读<%=webname%>服务条款协议(下称“本协议”)。<br>
                                  本协议阐述之条款和条件适用于您使用<%=webname%>所提供的服务(下称“服务”)。</td>
                              </tr>
                            </table>
                              <table width="100%"  border="0" cellspacing="5" cellpadding="5">
                                <tr>
                                  <td><%call tiaoyue()%></td>
                                </tr>
                                <tr>
                                  <td bgcolor="#f7f7f7"><FONT style="FONT-SIZE: 9pt" 
color=#333333>·如果你同意以上所列的条款，请按本页最下方的【我同意】按钮<BR>
                                    ·如果不同意，请直接关闭页面</FONT></td>
                                </tr>
                            </table></TD>
                        </TR>
                        <TR>
                          <FORM NAME="form1" METHOD="post" ACTION="reg.asp?action=yes">
                            <TD ALIGN="center"><input NAME="Submit4" type="image" src="image/tongyi.gif" width="37" height="47" border="0">
                              &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; <img src="image/butongyi.gif" width="37" height="47"></TD>
                          </FORM>
                        </TR>
                      </TABLE>
                    <%case "yes"%>
                      <TABLE WIDTH="100%" BORDER="0" ALIGN="center" CELLPADDING="4" CELLSPACING="1" bgcolor="#ffffff">
                        <TR align="center">
                          <TD colspan="2"><table width="100%"  border="0" cellspacing="5" cellpadding="10">
                              <tr>
                                <td><p><span class="style4">关于注册本商城会员的特别提示：</span></p>
                                    <UL>
                                      <LI>本商城并不刻意要求您必须先注册成为本商店用户才能购买商品，您完全可以不用注册也可用普通会员价购买本商城所有商品。
                                      <LI>本商城仅仅需要能送货的必要信息：收货人姓名、地址、邮政编码和联系电话。对于像性别、身份证号码等对于送货没有任何帮助的信息，我们都不会要求您填写。 
                                      <LI>本商城将最大限度保护您的隐私，这一点请您放心。 
                                      <LI>当然您不购买商品也可以成为本站用户，请填写下面的信息注册。 
                                      <LI>如果您要将订购的商品寄给朋友，也请填写您自己的资料，您仅需在收银台处填写您朋友资料。</LI>
                                    </UL></td>
                              </tr>
                          </table></TD>
                        </TR>
                        <FORM NAME="userinfo" METHOD="post" ACTION="reg.asp?action=save" >
                          <TR>
                            <TD width="20%" height="25" align="right" bgcolor="#f7f7f7">用 户 名：</TD>
                            <TD width="80%" height="25"><INPUT NAME="username" TYPE="text" class="input_sr" id="username" size="15" maxlength="15">
                                <span class="style1">*</span> 用户名长度不能小于2。</TD>
                          </TR>
                          <TR>
                            <TD height="25" bgcolor="#f7f7f7"><div align="right">密　　码：</div></TD>
                            <TD height="25"><INPUT NAME="UserPassword2" type="Password" class="input_sr" size="15" maxlength="15">
                                <span class="style1">*</span> 长度必须大于6个字符。</TD>
                          </TR>
                          <TR>
                            <TD height="25" bgcolor="#f7f7f7"><div align="right">确认密码： </div></TD>
                            <TD height="25"><INPUT NAME="UserPassword1" type="Password" class="input_sr" size="15" maxlength="15">
                                <span class="style1">*</span> </TD>
                          </TR>
                          <TR>
                            <TD height="25" bgcolor="#f7f7f7"><div align="right">电子信箱： </div></TD>
                            <TD height="25"><INPUT NAME="useremail" TYPE="text" class="input_sr" size="15">
                                <span class="style1">*</span> 请您务必填写正确的E-mail地址，便于我们与您联系。</TD>
                          </TR>
                          <TR>
                            <TD height="25" bgcolor="#f7f7f7"><div align="right">密码提示： </div></TD>
                            <TD height="25"><INPUT NAME="UserQuestion" TYPE="text" class="input_sr" size="15" maxlength="15">
                                <span class="style1">*</span> 在您忘记密码需要取回的时候，您需要自行填写此信息。 </TD>
                          </TR>
                          <TR>
                            <TD height="25" bgcolor="#f7f7f7"><div align="right">密码答案： </div></TD>
                            <TD height="25"><INPUT NAME="UserAnswer" TYPE="text" class="input_sr" size="15" maxlength="15">
                                <span class="style1">*</span> 在您忘记密码需要取回的时候，您需要自行回答上面的问题。 </TD>
                          </TR>
                          <TR>
                            <TD height="25" align="right" bgcolor="#f7f7f7">真实姓名： </TD>
                            <TD height="25"><INPUT NAME="realname" TYPE="text" class="input_sr" size="15" maxlength="10">
                                <span class="style1">*</span> </TD>
                          </TR>
                          <TR>
                            <TD height="25" align="right" bgcolor="#f7f7f7">省/市信息： </TD>
                            <TD height="25"><select name="welcomeshengbuy" size="1" onChange=chsel()>
                                <option value="xxx" selected>请选择省份……</option>
                                <%dim tmpShengid


tmpShengid=0
set rs_s=server.createobject("adodb.recordset")
sql="select * from welcomeshengbuy  order by shengorder"
rs_s.open sql,conn,1,1
while not rs_s.eof
if rs("szSheng")=rs_s("ShengNo") then
tmpShengid=rs_s("id")
%>
                                <option value="<%=rs_s("ShengNo")%>" ><%=trim(rs_s("ShengName"))%></option>
                                <%
     else
%>
                                <option value="<%=rs_s("ShengNo")%>" ><%=trim(rs_s("ShengName"))%></option>
                                <%
end if
rs_s.movenext
wend
rs_s.close
set rs_s=nothing
%>
                              </select>
                                <select size="1" name="welcomeshibuy">
                                  <%
set rs_s=server.createobject("adodb.recordset")
sql="select * from welcomeshibuy where shengid="&tmpShengid&" order by shiorder"
rs_s.open sql,conn,1,1
while not rs_s.eof
%>
                                  <option value="<%=rs_s("ShiName")%>" <%if rs("szShi")=rs_s("ShiNo") then%>selected<%end if%>><%=trim(rs_s("ShiName"))%></option>
                                  <%
rs_s.movenext
wend
rs_s.close
set rs_s=nothing
%>
                                </select>
                                <span class="style1">*</span></TD>
                          </TR>
                          <TR>
                            <TD height="25" align="right" bgcolor="#f7f7f7">电话号码： </FONT></TD>
                            <TD height="25"><INPUT NAME="UserMobile" TYPE="text" class="input_sr" size="15" maxlength="15">
                                <span class="style1">*</span>请填写正确的号码，以便通知您订单信息或其它问题确认。</TD>
                          </TR>
                          <TR>
                            <TD height="25" align="right" bgcolor="#f7f7f7">Oicq或其它：</TD>
                            <TD height="25"><INPUT NAME="userqq" TYPE="text" class="input_sr" size="15" maxlength="10">
                              网上联系</TD>
                          </TR>
                          <TR>
                            <TD></TD>
                            <TD height="30" valign="bottom"><INPUT NAME="Submit3" TYPE="submit" class="input_bot" STYLE="height:20; font:9pt; BORDER-BOTTOM: #cccccc 1px groove; BORDER-RIGHT: #cccccc 1px groove; BACKGROUND-COLOR: #eeeeee" ONCLICK="return check();"VALUE="提  交" >
                              &nbsp;&nbsp;&nbsp;&nbsp;
                              <input name="Submit5" type="reset" class="input_bot" STYLE="height:20; font:9pt; BORDER-BOTTOM: #cccccc 1px groove; BORDER-RIGHT: #cccccc 1px groove; BACKGROUND-COLOR: #eeeeee" value="清  除">                            </TD>
                          </TR>
                        </FORM>
                      </TABLE>
                  <%case "save"%>
                    <!--#include file="b2b_sys.asp"-->
                    <%call saveuser()%>
                    <%
end select%>
                    <%sub tiaoyue()
set rs=server.CreateObject("adodb.recordset")
rs.Open "select rule from b2b_systemdata",conn,1,1
response.Write trim(rs("rule"))
rs.Close
set rs=nothing
end sub

sub saveuser()
dim rsrec,strgift,stradd,strresult
if session("regtimes")=1 then
	response.Write "<div align=center><br><br>对不起，您刚注册过用户。<br>请稍后再进行注册！</font></div><br>"
	response.End
end if
set rs=server.CreateObject("adodb.recordset")

rs.open "select username,useremail from [user] where username='"&trim(request("username"))&"' or useremail='"&trim(request("useremail"))&"'",conn,1,1
if not (rs.eof and rs.bof) then
	call usererr()
	rs.close
	set rs = nothing
else
	rs.close

	rs.open "select webimg13,webimg7 from [b2b_systemdata]",conn,1,1
	if not (rs.eof and rs.bof) then
		'strgift=Clng(rs("webimg13"))
		webimg7=Clng(rs("webimg7"))
	end if
	rs.close

	rs.open "select * from [user]",conn,1,3
	rs.addnew
	rs("username")=trim(request.form("username"))
	rs("UserPassword")=md5(trim(request.form("UserPassword2")))
	rs("useremail")=trim(request.form("useremail"))
	rs("UserQuestion")=trim(request.form("UserQuestion"))
	rs("UserAnswer")=md5(trim(request.form("UserAnswer")))
	rs("recommender")=stradd
	rs("realname")=trim(request.form("realname"))
	rs("identify")=trim(request.form("identify"))
	rs("UserMobile")=trim(request.form("UserMobile"))
	rs("userqq")=trim(request.form("userqq"))
	'rs("MSN")=trim(request.form("MSN"))
	rs("sheng")=trim(request.Form("welcomeshengbuy"))
	rs("shi")=trim(request.Form("welcomeshibuy"))
	rs("adddate")=now()
	rs("Img") = Request.ServerVariables("REMOTE_ADDR")
	rs("LastLogin")=now()
	rs("grpid")=4
	rs("score")=webimg7
	rs.update
	rs.close
	set rs=nothing
	mSql="select * from [User] where UserName='"&trim(request.form("username"))&"'"
	set mRs=conn.execute(mSql)
	'if not (mRs.eof and mRs.bof) then
		session("chklogin1")=1
		session("uid")=mRs("userid")
		session("username1")=mRs("username")
		session("dengji")=mRs("grpid")
	'end if
	mRs.close
	set mRs=nothing
	response.Cookies("Buy2Buy")("username")=trim(request.form("username"))



	Dim smtpserver,SendFrom,sendusername,sendpassword,subject,message,SendName,SendTO,MailType
	MailType = webbj4
	smtpserver = webbj7
	sendusername = webbj8
	sendpassword = webbj9
	SendName = webbj3
	SendTO = trim(request.form("useremail"))
	SendFrom = webbj8
	subject="您在"&webname&"的注册信息！"
	message="<html>"
	message=message & "<title>您的注册信息</title>"
	message=message & "<body>"
	message=message & "<TABLE border=0 width='95%' align=center><TR>"
	message=message & "<TD valign=middle align=top>"
	message=message &  trim(request.form("username"))& " 您好：<br>"
	message=message & "您在"&webname&"的注册信息：<br>"
	message=message & "用户名："&trim(request.form("username"))&"<br>"
	message=message & "密　码："&trim(request.form("UserPassword"))&"<br>"
	message=message & "<center><font color=red>祝您购物愉快，我们将竭诚为您服务！</font>"
	message=message & "</TD></TR></TABLE>"
	message=message & "</body>"
	message=message & "</html>"

	Select Case MailType
	Case "Nothing"
	
	Case "CDONTS"
	call sendemail(SendFrom,SendTO,smtpserver,sendusername,sendpassword,subject,message)
	Case "Jmail"
	call SendJmail(SendFrom,SendTO,smtpserver,sendusername,sendpassword,subject,message,SendName)
	End Select
%>
                      <table width=100% border=0 align=center cellpadding=0 cellspacing=0>
                        <tr>
                          <td width="100%" height=100 bgcolor=<% = bgclr4 %>><table width=100% border=0 align=center cellpadding=0 cellspacing=0>
                              <tr>
                                <td width="100%" height=80 bgcolor=<% = bgclr4 %>><font color=#FF6600>用户注册成功<br>
                                  </font> 恭喜
                                  <% = request.form("username") %>
                                  ，您已注册成为[
                                  <% = webname %>
                                  ]正式用户，请进行下一步操作：<br>
                                  <br>
                                  ·<a href=profile.asp?action=receiveaddr>为了方便您的购物，建议您填写详细的收货人资料</a><br>
                                  <br>
                                  ·<a href=index.asp>返回首页</a></td>
                              </tr>
                          </table></td>
                        </tr>
                      </table>
                    <%
end if
end sub

sub usererr() %>
                      <table width=100% height=80 border=0 align=center cellpadding=0 cellspacing=1>
                        <tr>
                          <td width="100%" bgcolor=#FFFFFF><table width=100% border=0 align=center cellpadding=2 cellspacing=0>
                              <tr>
                                <td width="100%"><font color=#FF6600>用户注册失败</font></td>
                              </tr>
                              <tr>
                                <td> ·您输入的用户名或Email地址已经被注册，请选用其他的用户名或者E-mail！<br>
                                  ·<a href=javascript:history.go(-1)><font color=red>点击返回上一页</font></a> </td>
                              </tr>
                          </table></td>
                        </tr>
                      </table>
                    <%
end sub
%>
                    <SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
   if(checkspace(document.userinfo.username.value)) {
	document.userinfo.username.focus();
    alert("用户名不能为空，请重新输入！");
	return false;
  }
    if(checkspace(document.userinfo.username.value) || document.userinfo.username.value.length < 2) {
	document.userinfo.username.focus();
    alert("用户名长度不能小于2，请重新输入！");
	return false;
  }
    if(checkspace(document.userinfo.UserPassword2.value) || document.userinfo.UserPassword2.value.length < 6) {
	document.userinfo.UserPassword2.focus();
    alert("密码长度不能小于6，请重新输入！");
	return false;
  }
    if(document.userinfo.UserPassword2.value != document.userinfo.UserPassword1.value) {
	document.userinfo.UserPassword2.focus();
	document.userinfo.UserPassword2.value = '';
	document.userinfo.UserPassword1.value = '';
    alert("两次输入的密码不同，请重新输入！");
	return false;
  }

 if(document.userinfo.useremail.value.length!=0)
  {
    if (document.userinfo.useremail.value.charAt(0)=="." ||        
         document.userinfo.useremail.value.charAt(0)=="@"||       
         document.userinfo.useremail.value.indexOf('@', 0) == -1 || 
         document.userinfo.useremail.value.indexOf('.', 0) == -1 || 
         document.userinfo.useremail.value.lastIndexOf("@")==document.userinfo.useremail.value.length-1 || 
         document.userinfo.useremail.value.lastIndexOf(".")==document.userinfo.useremail.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.userinfo.useremail.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.userinfo.useremail.focus();
   return false;
   }
   
   if (checkspace(document.userinfo.UserQuestion.value))
   {
	document.userinfo.UserQuestion.focus();
    alert("密码提示问题为空！");
	return false;
   }

   if (checkspace(document.userinfo.UserAnswer.value))
   {
	document.userinfo.UserAnswer.focus();
    alert("密码提示答案为空！");
	return false;
   }
   
   if (checkspace(document.userinfo.realname.value))
   {
	document.userinfo.realname.focus();
    alert("真实名字为空！");
	return false;
   }
   
   if (document.userinfo.welcomeshengbuy.value=="xxx")
   {
	document.userinfo.welcomeshengbuy.focus();
    alert("省份信息为空！");
	return false;
   }

   if (checkspace(document.userinfo.welcomeshibuy.value))
   {
	document.userinfo.welcomeshibuy.focus();
    alert("城市信息为空！");
	return false;
   }
   
   if (checkspace(document.userinfo.UserMobile.value))
   {
	document.userinfo.UserMobile.focus();
    alert("电话为空！");
	return false;
   }
   
}

function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}


function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
              </script></td>
                </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><img name="cplist_04" src="image/cplist_04.gif" width="665" height="4" border="0" alt=""></td>
      </tr>
    </table>
        <br></td>
  </tr>
</table>

<!--#include file="b2b_includefile/b2b_ver.asp" -->
</body>
</html>