<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc.asp"-->
<!--#include file="../Inc/md5.asp"-->
<%
If useroff=0 then Call Alert("网站目前已经关闭会员功能","../")
Dim UserName
UserName = LoseHtml(trim(request.form("UserName")))
set rs = server.CreateObject ("adodb.recordset")
sql="select * From ["&tbname&"_User] where username='"&UserName&"'"
rs.open sql,conn,1,3
if not rs.eof and not rs.bof then
rs.close
set rs=nothing
Call Alert ("错误：对不起,该用户已存在，请选择新的用户名!","-1")
elseif Not ChkRegName(UserName) then
Call Alert ("注册失败，你想要注册的用户中含有本站禁止注册的字符!","-1")
else
dim sql,rs

UserName = 		LoseHtml(trim(request.form("UserName")))
PassWord = 		trim(request.form("UserPassWord"))
Sex = 			trim(request.form("UserSex"))
Email = 		trim(request.form("UserEmail"))
QQ = 			trim(request.form("UserQQ"))
TrueName = 		trim(request.form("TrueName"))
myyear=			Angel_aspRequest(request("year"))
mymonth=		Angel_aspRequest(request("month"))
myday=			Angel_aspRequest(request("day"))
Birthday = 		myyear&"-"&mymonth&"-"&myday
Province = 		request.form("Province")
City = 			request.form("City")

		if UserName="" then
			Call Alert ("请填写用户名!","-1")
		elseif len(UserName)<2 then
			Call Alert ("用户名不得少于2个字!","-1")
		elseif PassWord="" then
			Call Alert ("请填写密码!","-1")
		elseif myyear="" or mymonth="" or myday="" then
			Call Alert ("请选择出生日期!","-1")
		elseif Province="" or City="" then
			Call Alert ("请选择籍贯!","-1")
		elseif Email="" then
			Call Alert ("请填写Email!","-1")
		elseif QQ="" then
			Call Alert ("请填写QQ!","-1")
		end if
		If Not Checkpost(True) Then Call Alert("禁止外部提交!","-1")
		rs.AddNew
		rs("UserName")			=UserName
		rs("PassWord")			=md5(PassWord,16)
		rs("Sex")				=Sex
		rs("Email")				=Email
		rs("UserQQ")			=QQ
		rs("TrueName")			=TrueName
		rs("Birthday")			=Birthday
		rs("Province")			=Province
		rs("City")				=City
		rs("RegTime")			=Now()
		rs("LastTime")			=Now()
		rs("IP")				=GetIP
		rs("LastIP")			=GetIP
		rs("UserMoney")			=0
		rs("usergroupid")		=3
		rs("yn")				=userynoff
		rs("QQOpenID")			=""
		
		set rs4 = server.CreateObject ("adodb.recordset")
		sql="select top 1 * from "&tbname&"_UserGroup Where usermoney <> -1 order by Usermoney asc"
		rs4.open sql,conn,1,1




		dengji=rs4("GroupName")
		dengjipic=rs4("GroupPic")
		rs4.close
		set rs4=nothing	
		rs("dengji")			=dengji
		rs("dengjipic")			=dengjipic
		rs.update
		If userynoff=1 Then
		Response.Cookies("Angel").path=SitePath
		Response.Cookies("Angel")("UserName")=username
		Response.Cookies("Angel")("UserPass")=md5(PassWord,16)
		Response.Cookies("Angel")("ID")=rs("ID")
		Call Alert ("恭喜你,注册成功","UserAdd.asp?action=useredit")
		Else
		Call Alert ("恭喜你,注册成功,请等待管理员审核!","../")
		End if
	rs.close
	Set rs=nothing
End if
%>