<!--#include file="bbstop.asp"-->
<%
	dim username
	dim sex
	dim pass1
	dim pass2
	dim password
	dim useremail
	dim face,width,height
	dim oicq
	dim sign
	dim rs,sql
	dim founderr
	dim errmsg
	dim boardtype
	founderr=false
	call chkinput
sub chkinput()
	if request("name")="" or strLength(request("name"))>20 then
		errmsg=errmsg+"<br>"+"<li>请输入您的用户名(长度不能大于20)。"
		founderr=true
	else
		username=nohack(request("name"))
	end if
	if request("sex")="" then
		errmsg=errmsg+"<br>"+"<li>请选择您的性别。"
		founderr=true
	elseif request("sex")="男" or request("sex")="女" then
		sex=nohack(request("sex"))
	else
		errmsg=errmsg+"<br>"+"<li>您输入的字符非法。"
		founderr=true
	end if
	if request("psw")="" or strLength(request("psw"))>20 then
		errmsg=errmsg+"<br>"+"<li>请输入您的密码(长度不能大于20)。"
		founderr=true
	else
		pass1=nohack(request("psw"))
	end if
	if request("pswc")="" or strLength(request("pswc"))>20 then
		errmsg=errmsg+"<br>"+"<li>请输入确认密码(长度不能大于20)。"
		founderr=true
	else
		pass2=nohack(request("pswc"))
	end if
	if pass1<>pass2 then
		errmsg=errmsg+"<br>"+"<li>您输入的密码和确认密码不一致。"
		founderr=true
	else
		password=pass2
	end if
	if IsValidEmail(trim(request("e_mail")))=false then
   		errmsg=errmsg+"<br>"+"<li>您的Email有错误。"
   		founderr=true
	else
		useremail=nohack(request("e_mail"))
	end if
	if request("myface")<>"" then
		if request("width")="" or request("height")="" then
			errmsg=errmsg+"<br>"+"<li>请输入图片的宽度和高度。"
			founderr=true
		elseif not isInteger(request("width")) or not isInteger(request("height")) then
			errmsg=errmsg+"<br>"+"<li>您输入的字符不合法。"
			founderr=true
		elseif request("width")<20 or request("width")>120 then
			errmsg=errmsg+"<br>"+"<li>您输入的图片宽度不符合标准。"
			founderr=true
		elseif request("height")<20 or request("height")>120 then
			errmsg=errmsg+"<br>"+"<li>您输入的图片高度不符合标准。"
			founderr=true
		else
			face=nohack(request("myface"))
			width=clng(request("width"))
			height=clng(request("height"))
		end if
	else
		if request("face")="" then
			errmsg=errmsg+"<br>"+"<li>请选择您的个性头像。"
			founderr=true
		elseif Instr(request("face"),"faces/")>0 then
			face=nohack(request("face"))
			width=100
			height=100
		else
			errmsg=errmsg+"<br>"+"<li>您选择了错误的头像。"
			founderr=true
		end if
	end if
	if request("oicq")<>"" then
		if chkoicq(request("oicq"))=false then
			errmsg=errmsg+"<br>"+"<li>Oicq号码只能是4-10位数字，您可以选择不输入。"
			founderr=true
		end if
	end if
end sub

sub saveuserinfo()

	set rs=server.createobject("adodb.recordset")
	sql="select * from huiyuan where huiyuan='"&username&"'"
	rs.open sql,conn,1,3
	if not rs.eof and not rs.bof then
		errmsg=errmsg+"<br>"+"<li>对不起，您输入的用户名已经被注册，请重新输入。"
		founderr=true
	else
		rs.addnew
		rs("huiyuan")=username
		rs("password")=password
		rs("mail")=useremail
		rs("userclass")="小精灵"
		if request("Signature")<>"" then
		rs("sign")=nohack(request("Signature"))
		end if
		if request("oicq")<>"" then
		rs("oicq")=clng(request("oicq"))
		end if
        	Rs("article")=0
        	Rs("lockuser")=0
        	Rs("xb")=sex
		rs("jifen")=200
        	Rs("sj")=NOW()
		rs("face")=face
        	Rs("width")=width
        	Rs("height")=height
		rs("logins")=1
        	Rs("lastlogin")=NOW()
		rs.update
		rs.close
		set rs=nothing
		conn.close
		set conn=nothing
	end if
end sub

if founderr=true then
	call error()
else
	call saveuserinfo()
	if founderr=true then
		call error()
	else
%>
<table cellpadding=0 cellspacing=0 border=0 width=762 bgcolor=#efefef align=center class=pian>
<tr><td align=center>
                <table cellpadding=3 cellspacing=1 border=0 width=600>
  <TBODY>
  <TR align=middle bgcolor=#efefef>
    <TD colSpan=2 height=24><font color=red>用户注册成功</font></TD></TR>
 
 
 <TR bgcolor=#ffffff>
    <TD colspan=2><center><b>
    <%
	topic="您在"&ForumName&"注册的个人资料"
    mailbody=mailbody &"<style>A:visited {	TEXT-DECORATION: none	}"
	mailbody=mailbody &"A:active  {	TEXT-DECORATION: none	}"
	mailbody=mailbody &"A:hover   {	TEXT-DECORATION: underline overline	}"
	mailbody=mailbody &"A:link 	  {	text-decoration: none;}"
	mailbody=mailbody &"A:visited {	text-decoration: none;}"
	mailbody=mailbody &"A:active  {	TEXT-DECORATION: none;}"
	mailbody=mailbody &"A:hover   {	TEXT-DECORATION: underline overline}"
	mailbody=mailbody &"BODY   {	FONT-FAMILY: 宋体; FONT-SIZE: 9pt;}"
	mailbody=mailbody &"TD	   {	FONT-FAMILY: 宋体; FONT-SIZE: 9pt	}</style>"
	mailbody=mailbody &"<TABLE border=0 width='95%' align=center><TBODY><TR><TD>"
	mailbody=mailbody &""&htmlencode(username)&"，您好：<br><br>"
	mailbody=mailbody &"欢迎您注册乐购一号通帐号，我们将提供给您最好的服务！<br>"
	mailbody=mailbody &"下面是您的注册信息：<br>"
	mailbody=mailbody &"注册名："&htmlencode(username)&"<br>"
	mailbody=mailbody &"密  码："&htmlencode(password)&"<br>"
	mailbody=mailbody &"<br><br>"
	mailbody=mailbody &"<center><font color=red>再次感谢您注册本系统，让我们一起来建设这个网上家园！</font>"
	mailbody=mailbody &"<br><br><br>"
	mailbody=mailbody &"<tr align=right><td><font size=3.5pt>Loogoo.com  "&now()&"</font></td></tr>"
	mailbody=mailbody &"<br><br><br><br><br>"
	mailbody=mailbody &"***********************************************************************************************"
	mailbody=mailbody &"乐购·享受快乐购物生活"
	mailbody=mailbody &"</TD></TR></TBODY></TABLE>"
	on error resume next
    %>
    <%if EmailFlag=0 then%><center><b>欢迎使用本系统，有任何问题，请与网管(<a href=mailto:<%=systememail%>><%=systememail%></A>)联系!</b>
    <%elseif EmailFlag=1 then
    Response.Write "<center><b> 一封注册信已经发送到你您注册时填写的信箱，请查收！</b>"
    email = useremail
    call Jmail(email)
    %>
     <%elseif EmailFlag=2 then
    Response.Write "<center><b> 一封注册信已经发送到你您注册时填写的信箱，请查收！</b>"
    email = useremail
    call Cdonts(email)
    %>
    <%elseif EmailFlag=3 then
    Response.Write "<center><b> 一封注册信已经发送到你您注册时填写的信箱，请查收！</b>"
    email = useremail
    call Aspemail(email)
    end if
    %>
    </TD></TR>
   <TR bgcolor=#ffffff>
    <TD width=150>注 册 名**</TD>
    <TD><%=htmlencode(username)%></TD></TR>
  <TR bgcolor=#ffffff>
    <TD width=150>性 别</TD>
    <TD><%if sex="男" then%>男<%else%>女<%end if%></TD></TR>
  <TR bgcolor=#ffffff>
    <TD width=150>密&nbsp;&nbsp;&nbsp;&nbsp;码**</TD>
    <TD><%=htmlencode(password)%>
    </TD></TR>
  <TR bgcolor=#ffffff>
    <TD width=150 height=32>Email地址 **</TD>
    <TD height=32><%=useremail%></TD></TR>
  <TR bgcolor=#ffffff>
    <TD width=150 height=32>形象**</TD>
    <TD height=32><img src="<%=face%>">
  </TR>
  <TR bgcolor=#ffffff>
    <TD width=150>OICQ号码</TD>
    <TD><%if request("oicq")="" then%>未注册<%else%><%=request("oicq")%><%end if%> </TD></TR>
  <TR bgcolor=#ffffff>
    <TD width=150>签 名<BR><BR>文字将出现在您发表的文章的结尾处。体现您的个性。 </TD>
    <TD><%if trim(request("Signature"))="" then%>未填写<%else%><%=trim(request("Signature"))%><%end if%>
    </TD></TR>
  <TR align=middle bgcolor=#ffffff>
    <TD colSpan=2>
<DIV align=center><a href=login.asp>请登陆论坛</a></DIV></TD></TR></TBODY></TABLE></td></tr></table>
<%
	end if
end if
%>
<!--#include file="bbsend.asp"-->