<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/safe.asp"-->
<%
dim errmsg
errmsg=""

dim username,userpass,question,answer,sex,birthday,email,realname,sfz,provence,city
dim height,weight,character,school,vocation,fancy,people,blood,shuxiang,marry,friendrelation
dim revenue,car,house,company,qq,cell,phone,declaration,realpass,dubai,chatpass,zeyou

username=trim(ReplaceBadChar(request.Form("userid")))
userpass=trim(ReplaceBadChar(request.Form("pwd1")))
realpass=trim(ReplaceBadChar(request.Form("pwd2")))
question=trim(ReplaceBadChar(request.Form("question")))
answer=trim(ReplaceBadChar(request.Form("answer")))
sex=request.Form("sex")
byear=request.Form("birthyear")
bmonth=request.Form("birthmonth")
bday=request.Form("birthday")
email=trim(ReplaceBadChar(request.Form("email")))
realname=request.Form("realname")
sfz=request.Form("sfz")
sheng=request.Form("sheng1")
shi=request.Form("shi1")
provence=request.Form("sheng")
city=request.Form("shi")
height=request.Form("height")
weight=request.Form("weight")
character=request.Form("xingge")
school=request.Form("xueli")
vocation=request.Form("zhiye")
fancy=request.Form("active")
people=request.Form("minzu")
blood=request.Form("blood")
shuxiang=request.Form("shengxiao")
marry=request.Form("marry")
friendrelation=request.Form("mudi")
revenue=request.Form("yuexin")
car=request.Form("car")
house=request.Form("house")
company=request.Form("company")
qq=trim(ReplaceBadChar(request.Form("qq")))
cell=trim(ReplaceBadChar(request.Form("cell")))
phone=trim(ReplaceBadChar(request.Form("phone")))
declaration=request.Form("xuanyan")
dubai=convert(request.Form("dubai"))
zeyou=convert(request.Form("zeyou"))

'on error resume next
set rs=server.CreateObject("adodb.recordset")
sql="select * from user_info where username='"& username &"'"
rs.open sql,conn,1
if not(rs.eof or rs.bof) then
  errmsg=errmsg+"<li><strong><font size=4>该帐号已被注册，请换一个试试！</font></strong>"
end if 
rs.close
set rs=nothing

if username="" then errmsg=errmsg+"<br>"+"<li>您的帐号不能为空！"
if invalidch(username) or instr(username,"，")>0  then errmsg=errmsg+"<br>"+"<li>您的帐号可能含特殊符号，请检查！"
if checkshit(username) then  errmsg=errmsg+"<br>"+"<li>帐号可能含不文明词语，请检查！"
if checkforbidword(username) then  errmsg=errmsg+"<br>"+"<li>帐号可能含系统禁止使用词语(如管理员等)，请检查！"
if byear="" or bmonth="" or bday="" then errmsg=errmsg+"<br>"+"<li>您的出生日期不能空！"
if sheng="" or shi="" or provence="" or city="" then errmsg=errmsg+"<br>"+"<li>请选择您的籍贯和所在城市！"
if school=0 then errmsg=errmsg+"<br>"+"<li>请选择您的学历！"
if userpass<>realpass then errmsg=errmsg+"<br>"+"<li>您两次输入的密码不同，请检查！"
if not isnumeric(height) or clng(height)>250 or clng(height)<90 then errmsg=errmsg+"<br>"+"<li>请正确填写您的身高！"
if not isnumeric(weight) or clng(weight)>300 or clng(weight)<20 then errmsg=errmsg+"<br>"+"<li>请正确填写您的体重"
if invalidch(dubai) then errmsg=errmsg+"<br>"+"<li>您的个人独白可能含特殊符号，请检查！"
if checkshit(dubai) then  errmsg=errmsg+"<br>"+"<li>个人独白可能含不文明词语，请检查！"
if invalidch(zeyou) then errmsg=errmsg+"<br>"+"<li>您的择友要求可能含特殊符号，请检查！"
if checkshit(zeyou) then  errmsg=errmsg+"<br>"+"<li>择友要求可能含不文明词语，请检查！</li>"

if errmsg<>"" then 
response.Write "错误信息：<br>"
response.write("　　　"+ errmsg)
response.Write "<input type='button' value='返回修改' onClick='javascript:window.history.back(-1);'>"
response.Write "<input type='button' value='关闭窗口' onClick='javascript:window.close();'>"
response.end
end if

birthday=cdate(byear&"-"& bmonth &"-"& bday)

userpass=md5(userpass)  'md5加密密码
chatpass=trpass(realpass) '聊天室帐号密码

set rst=server.CreateObject("adodb.recordset")   '添加交友帐号
sql1="select * from user_info where userid is null"
rst.open sql1,conn,1,3
rst.addnew
rst("username")=username
rst("userpass")=userpass
rst("question")=question
rst("answer")=md5(answer)
rst("sex")=sex
rst("grade")=1
rst("birthday")=birthday
rst("realname")=realname
rst("age")=datediff("yyyy",birthday,now())
rst("sheng")=sheng
rst("shi")=shi
rst("prov")=provence
rst("city")=city
rst("email")=email
rst("height")=height
rst("weight")=weight
rst("character")=character
rst("school")=school
rst("vocation")=vocation
rst("fancy")=fancy
rst("people")=people
rst("blood")=blood
rst("shuxiang")=shuxiang
rst("marry")=marry
rst("friendrelation")=friendrelation
rst("revenue")=revenue
rst("car")=car
rst("house")=house
rst("company")=company
rst("qq")=qq
rst("cell")=cell
rst("phone")=phone
rst("sfz")=sfz
rst("declaration")=declaration
rst("outnum")=OutNum
rst("innum")=InNum
rst("addmodel")=0
rst("renqi")=0
rst("logins")=0
rst("chengxin")=0  '诚信点
rst("dubai")=dubai
rst("zeyou")=zeyou
rst("regtime")=now()
rst("artnum")=0
rst("honorold")="0,0,0,0"
rst("honornew")="0,0,0,0"  '身份证，学历证件，企业证件，职业证件
rs("score")=0      '点数
rs("xuanxiu")=0
rst.update
rst.close
set rst=nothing

'聊天室帐号
if sex="男" then
  head="boy2"
  sex1="男生"
else
  head="girl7"  
  sex1="女生"
end if

conn.execute("insert into [user](username,password,email,aihao,sex,info,head,reg_ip) values('"&username &"','"& chatpass &"','"& email &"','* 未注册项 *','"& sex1 &"','* 这家伙很懒，什么都没留下。。。 *','"& head &"','127.0.0.1')")

'************************发送邮件

topic="红嫂视屏交友网欢迎您的加入！" ' 信件主题
mailbody="<html>"
	mailbody=mailbody & "<title>注册信息</title>"
	mailbody=mailbody & "<body>"
	mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
	mailbody=mailbody & "<TD valign=middle align=top>"
	mailbody=mailbody & htmlencode(username)&"，您好：<br><br>"
	mailbody=mailbody & "欢迎您注册交友中心，我们将提供给您最好的交友服务！<br>"
	mailbody=mailbody & "下面是您的注册信息：<br>"
	mailbody=mailbody & "注册名："&htmlencode(username)&"<br>"
	mailbody=mailbody & "密  码："&realpass&"<br>"
	mailbody=mailbody & "<br><br>"
	'mailbody=mailbody & "请点击下面的地址，获取交友中心赠送的金钱点数！"
	'mailbody=mailbody & "<a href=http://"&request.servervariables("server_name")&replace(lcase(request.servervariables("script_name")),"reg.asp","")&"activepower.asp?username="&username&" target=_blank>激活您的帐号获得交友中心赠送的金币</a><br>"
	'mailbody=mailbody & "<br>"
	mailbody=mailbody & "<center><font color=red>再次感谢您注册本中心，让我们为您牵起生命中的另一半！</font>"
	mailbody=mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
	mailbody=mailbody & "<p align=center> &nbsp;<a href='http://shiping.hosao.com' target='_blank'>红嫂视屏交友网</a>&nbsp; </p>"
	mailbody=mailbody & "</body>"
	mailbody=mailbody & "</html>"
	
	
	Set Jmail = Server.CreateObject("JMAIL.Message") '建立发送邮件的对象
    Jmail.silent = true '屏蔽例外错误，返回FALSE跟TRUE两值j
    Jmail.logging = true '启用邮件日志
    Jmail.Charset = "GB2312" '邮件的文字编码为国标
    Jmail.ContentType = "text/html" '邮件的格式为HTML格式
    Jmail.AddRecipient email '邮件收件人的地址
	Jmail.From = AllMail '发件人的E-MAIL地址
	'Jmail.priority=1
    Jmail.MailServerUserName = Mailuser '登录邮件服务器所需的用户名
    Jmail.MailServerPassword = Mailpass '登录邮件服务器所需的密码
    Jmail.Subject = Topic '邮件的标题 
    Jmail.Body = MailBody '邮件的内容	
	
	JMail.Send(Mailsmtp)	
    Jmail.Close() '关闭对象	
    Set JMail = Nothing
	
if err.number<>0 then
 sendmsg="<li>由于系统错误，不能发送注册资料到你的邮箱"&email&"里，请记住您的注册信息。用户名:"&username&" 密码:"&realpass&"</li>"
else
 sendmsg="<li>您的注册信息和密码已经发往您的邮箱，请使用系统给您的密码登录。用户名:"&username&" 密码:"&realpass&"</li>"
end if
conn.close
set conn=nothing
%>
<html>
<meta HTTP-EQUIV=REFRESH CONTENT='5; URL=index.asp'>
<link href="style.css" rel="stylesheet" type="text/css">
<body>
<table cellpadding=3 cellspacing=1 align=center class=STYLE4>
<tr>
<th height=24>注册成功：红嫂视屏交友网欢迎您的到来</th>
</tr>
<tr><td class="style4"><br>
<ul><%=sendmsg%><li><a href="index.asp">进入红嫂视屏交友网</a></li></ul>
</td></tr>
</table>
</body>
</html>
