<!--#include file="Inc/SysProduct.asp" -->
<!--#include file="inc/Skin_css.asp"-->
<!--#include file="Inc/md5.asp"-->
<!-- #include file="Head.asp" -->

<%
dim JMObjInstalled,FSObjInstalled
JMObjInstalled=IsObjInstalled("JMail.Message")

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"))
VIPUser=trim(request("VIPUser"))
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
		if VIPUser="yes" then
		  rsReg("VIPUser")=True
	    else
		  rsReg("VIPUser")=False
	    end if
		rsReg("RegDate")=Now()
		rsReg("LockUser")=false
		rsReg("LockVIPUser")=True
		rsReg.update
		founderr=false
	end if
	rsReg.close
	set rsReg=nothing
end if		
%> 
<TABLE class="xmtable" border=0 align="center" cellPadding=0 cellSpacing=12 bgcolor="#FFFFFF">
  <tr> 
    <td height="5" colspan="5" valign="top" bgcolor="#FFFFFF"></td>
  </tr>
  <tr> 
    <td  height="450" valign="top" Class="tdbg_left"><table width="100%" border="0" cellspacing="0" cellpadding="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="<%=BannerUrl10%>">
                <param name="quality" value="high">
                <param name="wmode" value="transparent">
                <embed src="<%=BannerUrl10%>" 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="<%=BannerUrl10%>" 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=98 class="title_c">会员中心</TD>
                    <TD width="555" 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>
      <br>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="56"><div align="center">
              <%
if founderr=false then
  
    dim Sendername,Subject,Content,Priority,InceptName,InceptEmail,sMailBody		
	Subject="您在本站成功注册!"
	 if VIPUser="yes" then 
       sMailBody="您在本站注册的用户名:"&UserName& vbCrLf & "密码:"&Password& ",请保管好！" 
	 else
	   sMailBody="您在本站注册的用户名:"&UserName& vbCrLf & "密码:"&Password& ",保管好,请注册VIP会员，可以给你最大的优惠！"
	 end if  
	Sendername=WebmasterName 
	Senderemail=WebmasterEmail	
	 if Sendername="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>发件人不能为空！</li>"
	 end if
	 if Senderemail="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>发件人Email不能为空！</li>"
	 end if
	 if Subject="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>邮件主题不能为空！</li>"
	 end if
	 if trim(sMailBody)="" then
		FoundErr=True
	    ErrMsg=ErrMsg & "<br><li>邮件内容不能为空！</li>"
	 end if
	 if Email="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>收件人Email不能为空！</li>"
	 else
	    Masteremail=Email	
	 end if	
	
	 Priority=1	  
     Set JmailMsg = Server.CreateObject("JMail.Message")
     JmailMsg.silent = true
     JmailMsg.Logging = true
     JmailMsg.Charset = "gb2312"
     JmailMsg.ContentType="text/plain"
     sMailBody=sMailBody & vbCrLf & vbCrLf & "此邮件是网站系统自动进行发送。"

     JmailMsg.MailServerUserName = MailServerUserName
     JmailMsg.MailServerPassword = MailServerPassword
     JmailMsg.From = Senderemail
     JmailMsg.FromName = Sendername
     JmailMsg.AddRecipient Masteremail  '发件人email
     JmailMsg.Subject = Subject
     JmailMsg.Body = sMailBody & vbCrLf
     JmailMsg.Send MailServer

     if JmailMsg.ErrorCode>0 then
        response.write "邮件发送失败：" & JmailMsg.ErrorMessage & "<br><br>可能错误来源：" & JmailMsg.ErrorSource & "<br><br><a href=javascript:history.back()>返回</a>"
     end if
     JmailMsg.close
     set JmailMsg = nothing
  if VIPUser="yes" then  	 
	 response.write "邮件发送成功：<br><br><a href=javascript:history.back()>返回</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='Aboutus.asp?Title=付款方式'>查看付款方式</a> "
  else
     response.write "邮件发送成功：<br><br><a href=javascript:history.back()>返回</a>" 
  end if	 
	call RegSuccess() 
else
	call WriteErrmsg()
end if
%>
          </div></td>
        </tr>
      </table></td>
    <TD width=1 background=images/MainLine.gif></TD>    
    <TD width="79" > </TD>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
</BODY></HTML>

<%call CloseConn
sub WriteErrMsg()
    response.write "<table align='center' width='400' border='0' cellpadding='2' cellspacing='0' class='border'>"
    response.write "<tr class='tdbg'><td align='center' height='15'>由于以下的原因不能注册用户！</td></tr>"
    response.write "<tr><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='400' border='0' cellpadding='2' cellspacing='0' class='border'>"
    response.write "<tr class='tdbg'><td align='center' height='15'>成功注册用户！</td></tr>"
    response.write "<tr><td align='left' height='100'><br>你注册的用户名：" & UserName & "<p align='center'></p></td></tr>"
	response.write "</table>" 
end sub
%>