<!--#include file="conn/md5.asp"-->
<!--#include file="conn/conn.asp"-->
<!--#include file="conn/nosql.asp"-->
<!--#include file="conn/config.asp"-->
<%if Not ChkPosturl then response.redirect ("login.asp")
  Response.Buffer = true
  Response.ExpiresAbsolute=now()-1
  Response.Expires=0
  Response.CacheControl="no-cache"

if session("user")<>"" then
response.write "<script language='javascript'>"
response.write "alert('您已经是会员而且已经登录，如果还想再注册会员请先退出当前登录！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
else 
end if

set rsconfig=server.CreateObject("adodb.recordset")
rsconfig.open"select * from snsn_config",conn,1,1
user=nosql(request.form("user"))
pass=md5(nosql(request.form("pass")))
question=nosql(request.form("question"))
answer=nosql(request.form("answer"))
name1=nosql(request.form("name"))
ch=nosql(request.form("ch"))
email=nosql(request.form("email"))
face=nosql(request.form("face"))
szd="中国,安徽,合肥"
homename=replace(nosql(request.form("homename")),".com","*")
homename=replace(homename,".net","*")
homename=replace(homename,"www.","*")
homename=replace(homename,"http://","*")
shenri=nosql(request.form("n1"))&"-"&nosql(request.form("y1"))&"-"&nosql(request.form("r1"))&"-"&nosql(request.form("a1"))&"-"&nosql(request.form("b1"))
idate=date()
zy=nosql(request.form("zy"))
tjr=nosql(request.form("tjr"))
set rs=server.CreateObject("adodb.recordset")
sql="select * from snsn_user where username='"&user&"' or homename='"&homename&"' or email='"&email&"'"
rs.open sql,conn,1,3
set rs1=server.CreateObject("adodb.recordset")
sql="select * from snsn_zy where zy='"&zy&"' order by dj"
rs1.open sql,conn,1,3
if not (rs.Bof and rs.eof) then
response.write"<SCRIPT language=JavaScript>alert('您填写的会员登陆名或个人主页名称或E-mail已存在，请返回重新填写！');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
else
rs.addnew
rs("username")=user  '注册用户名
rs("pass")=pass  '注册密码
rs("question")=question  '问题
rs("answer")=answer  '答案
rs("name")=name1  '真实名称
rs("ch")=ch  '性别
rs("email")=email  '用户邮箱
rs("face")=face  '头像
rs("szd")=szd  '所在地
rs("post")=000000  '邮编
rs("homename")=homename  '主页名称
rs("idate")=idate  '注册时间
rs("reg_ip")=Request.ServerVariables("REMOTE_ADDR")  '用户IP
rs("uflag")=3   '1为已经是普通会员，2普通会员加个人主页，3为诚信通会员加个人主页,
rs("logindate")=now()'登录时间
rs("jifen")=rsconfig("zhucefen")'用户积分
rs("jine")=0 '
rs("zy")=zy'职业
rs("dj")=rs1("dj")'职业等级
rs("shenri")=shenri'生日
rs.update

'推荐人计数
conn.execute"update snsn_user set tjr=tjr+1 where username='"&tjr&"'"

'爱心(发贴，传相片，传音乐，推荐人)
Set huaq= Server.CreateObject("ADODB.Recordset") 
huaq.open "select id from snsn_user where username='"&tjr&"'",conn,1,3
if not  huaq.eof then
Set hua= Server.CreateObject("ADODB.Recordset") 
hua.open "select * from snsn_hua where userid="&huaq("id"),conn,1,3
if not hua.eof then 
if hua("ax")<hua("max1")  then
if datediff("d",hua("axdate"),now)>=1 then
hua("dayax")=0
hua("axdate")=now()
hua.update
end if
if hua("dayax")<8 then
gwjga=8
if gwjga+hua("dayax")>8 then
gwjga=8-hua("dayax")
end if
hua("dayax")=hua("dayax")+gwjga
hua("ax")=hua("ax")+gwjga
hua.update

end if
end if
end if
end if
'end 爱心

'给TA的家园评论发一句欢迎词'
nr="欢迎你的加入，家园很不错呀，加油呀♀"
fren="好友"
title="<b>欢迎加入少男少女虚拟社区</b>"
content="欢迎您：新加入的朋友，请尽量先完成以下几步！<br>一：新加入时我们将会赠送你一些银两，请用这些银两到<a href=/minishow/index.asp  target=_blank><b>物品商店</b></a>中购买一些相关物品，购买物品的时间不要忘记进入虚拟形象SHOW栏目，里面可是你所需要的服饰等物品哟！<br>二：有了物品后进入<a href=/minishow/minishow.asp  target=_blank><b>家园管理</b></a>里面就可以开始装饰你的小家了，点击里面物品这时你将会看到物品会出现在页面上方的家园里面。然后依次点击装饰，装饰完成后不要忘记点击保存按钮哟！<br>三：家园装饰完成后可以打开你的<a href=""javascript:;"" onClick=""window.open('/web/1/index.asp?web_id="&rs("id")&"','cheng','scrollbars=no,resizable=no,width=920,height=565,menubar=no,top=10,left=10')"" class=over><b>迷你主页</b></a>里面还有更多功能供你使用呀，如相册，收藏，论坛，日记，心得，留言等赶快体验吧！！！"
set rsxx=server.createobject("adodb.recordset")
sql="select * from snsn_getprice where (id is null)" 
rsxx.open sql,conn,1,3
rsxx.addnew
rsxx("title")=title
rsxx("content")=content
rsxx("sendemail")=0
rsxx("sendcontact")=0
rsxx("checkdate")=0

rsxx("mycid")=rs("id")
rsxx("sendcid")=1
rsxx("datetime")=now()
rsxx.update
rsxx.close


session("id")=rs("id")
session("user")=rs("username")
session("Email")=rs("Email")
session("uflag")=rs("uflag")   '申请即开通普通会员
session("jifen")=rs("jifen")

if rs("mini_sl")="" then
session("mini_sl")=0
else
session("mini_sl")=rs("mini_sl")
end if
if rs("mini_jg")="" then
session("mini_jg")=0
else
session("mini_jg")=rs("mini_jg")
end if




Set rsd= Server.CreateObject("ADODB.Recordset") 
rsd.open"select * from snsn_zy where zy='"&rs("zy")&"' and dj="&rs("dj"),conn,1,3
session("jifen_qian")=jfen_qian '积分银两比
session("djzy")=rsd("zy")'职业
session("djname")=rsd("djname")'等级名称
session("youhui")=rsd("youhui")'等级购物优惠

session("jine")=rs("jine")
Response.Cookies("MyName") = rs("username")
Response.Cookies("MyName").Expires=date()+365
session("logindate")=now()
session("ip")=Request.ServerVariables("REMOTE_ADDR")

'如果等于3是诚信通有个人主页的话，则计算器要加以下一段话
conn.execute("insert into snsn_count (hit,dayhit,userid)VALUES(0,0,"&rs("id")&")")      
end if

Dim mailbody
' 声明变量

	mailbody="<html>"
	mailbody=mailbody & "<head>"
	mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
	mailbody=mailbody & "<TD valign=middle align=top>"
	mailbody=mailbody & session("user")&"，您好：<br><br>"
	mailbody=mailbody & "欢迎您成为" & webname & "的会员，我们将提供给您最好的服务！<br>"
	mailbody=mailbody & "下面是您的注册信息：<br><br>"
	mailbody=mailbody & "注册名："&session("user")&"<br>"
	mailbody=mailbody & "密  码："&pass&"<br>"
	mailbody=mailbody & "<br><br>"
	mailbody=mailbody&""&webname&" ◎ 客户服务中心<br>" 
    mailbody=mailbody&"================================================== <br>电话："&dh&"<br>"
    mailbody=mailbody&"Email："&webemail&"<a href="&weburl&" target=_blank>"&weburl&"</a> </body></html>" 
 	
topic=""&webname&"会员资格确认信" ' 信件主题
mailbody=mailbody ' 信件内容
Dim JMail
	on error resume next
	 Set jmail = Server.CreateObject("JMAIL.Message")   '建立发送邮件的对象
     jmail.silent = true    '屏蔽例外错误，返回FALSE跟TRUE两值j
     mail.logging = true   '启用邮件日志
     jmail.Charset = "GB2312"     '邮件的文字编码为国标
     jmail.ContentType = "text/html"    '邮件的格式为HTML格式
     jmail.AddRecipient session("Email")     '邮件收件人的地址
     jmail.From = fmail   '发件人的E-MAIL地址
     jmail.MailServerUserName = umail     '登录邮件服务器所需的用户名
     jmail.MailServerPassword = pmail     '登录邮件服务器所需的密码
     jmail.Subject = Topic    '邮件的标题 
     jmail.Body = MailBody      '邮件的内容
     jmail.Prority = 1      '邮件的紧急程序，1 为最快，5 为最慢， 3 为默认值
     jmail.Send(smail)     '执行邮件发送（通过邮件服务器地址）
     jmail.Close()   '关闭对象
	Set JMail = Nothing
	
	
	response.write "<script language='javascript'>"
response.write "alert('恭喜您，您已经成功注册,正在返回首页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
response.End()
%>