<!--#INCLUDE FILE="conn.asp" -->
<!--#INCLUDE virtual="inc/msgbox.asp" -->
<!--#INCLUDE virtual="inc/MD5.asp" -->
<%
username=trim(request.form("username"))
userID=trim(request.form("userID"))
password=MD5(trim(request.form("password")))
password2=MD5(trim(request.form("password2")))
'response.write HTMLEncode("password")
'Response.write "系统维护中，暂停注册"
'response.end
years=trim(request.form("years"))
mons=trim(request.form("mons"))
days=trim(request.form("days"))
sex=trim(request.form("user_sex"))
email=trim(request.form("email"))
homeurl=trim(request.form("homeurl"))
address=trim(request.form("address"))
tel=trim(request.form("tel"))
psqs=trim(request.form("psqs"))
psas=trim(request.form("psas"))
qq=trim(request.form("qq"))
zjtype=trim(request.form("zjtype"))
zjNumber=trim(request.form("zjNumber"))
face=trim(request.form("face"))
messages=trim(request.form("messages"))
if userID="" then
	msgbox "你怎么连帐号都不输啊!","back"
	Response.End 
end if
if username="" then
	msgbox "你怎么连名字都不输啊!","back"
	Response.End 
end if
if password="" then
	msgbox "请输入您的密码!","back"
	Response.End 
end if
if password2="" then
	msgbox "请确认您的密码!","back"
	Response.End 
end if
if not password=password2 then
	msgbox "两次输入的密码不一样!","back"
	response.end
end if
if tel="" then
tel="None"
end if
if qq="" then
qq=0
end if
if email="" or email="@" then
email="None"
end if
if homeurl="" then
homeurl="None"
end if
if messages="" then
messages="None"
end if
if address="" then
address="None"
end if
if psqs="" then
psqs="None"
end if
if psas="" then
psas="None"
end if
if zjNumber="" then
zjNumber=0
end if
if trim(QQ)<>"" then
      if not(isnumeric(QQ)) then 
         msgbox "OICQ号码必须是数字!","back"
         Response.End 
      end if
end if
if trim(zjNumber)<>"" then
      if not(isnumeric(QQ)) then 
         msgbox "证件号码必须是数字!","back"
         Response.End 
      end if
end if

if trim(Email)<>"None" then
    if instr(Email,"@")<=1 then 
        msgbox "对不起,你的E-mail地址有错误","back"
        Response.End 
    else
        aEmail=right(Email,len(Email)-instr(Email,"@"))
        bEmail=right(Email,len(Email)-instr(Email,"."))
        if len(aEmail)<=1 then
        msgbox "对不起,你的E-mail地址有错误","back"
        Response.End 
        end if
        if instr(aEmail,".")=0 then
        msgbox "对不起,你的E-mail地址有错误","back"
        Response.End 
        end if
        if len(bEmail)<=1 then
        msgbox "对不起,你的E-mail地址有错误","back"
        Response.End 
        end if
    end if
end if

if trim(address)<>"" then
      if isnumeric(address) then 
         msgbox "你住的那里怎么能全部是数字呢!","back"
         Response.End 
      end if
end if

exec="select * from user where userID='"+userID+"'"
set rs=server.createobject("adodb.recordset") 
rs.open exec,conn,1,1
if rs.RecordCount=0 then
	rs.close
	exec="select * from user where username='"+username+"'"
	set rs=server.createobject("adodb.recordset") 
	rs.open exec,conn,1,1
	if rs.RecordCount=0 then
	exec="insert into user	(userID,username,password,sex,years,mons,days,email,homeurl,address,tel,psqs,psas,qq,zjtype,zjNumber,face,messages)values('"&userID&"','"&username&"','"&password&"','"&sex&"',"&years&","&mons&","&days&",'"&email&"','"&homeurl&"','"&address&"','"&tel&"','"&psqs&"','"&psas&"',"&qq&",'"&zjtype&"','"&zjNumber&"','"&face&"','"&messages&"')"
'response.write exec
'response.end
	conn.execute exec
	msgbox "用户注册成功!","close"
	else
	msgbox "用户昵称已经存在！","back"
	end if
else
msgbox "用户ID已经存在！","back"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>