<!--#include file="main.asp"-->
<!--#include file="Inc/SendMail.asp"-->
<!--#include file="bbs/inc/md5.asp"-->
<%
'action="reg_validate"

ypxxone_id=request("ypxxone_id")
ypxxtwo_id=request("ypxxtwo_id")
addone_id=request("addone_id")
addtwo_id=request("addtwo_id")
user=request("user")
pass=request("pass")
colxr=request("colxr")
colxrsex=request("colxrsex")
coname=request("coname")
coaddress=request("coaddress")
cotelq=request("cotelq")
cotel=request("cotel")
mail=request("mail")
vip=request("vip")
tyvip=request("tyvip")
'---------------------数据判断-----------------------------
citypingname=split(citypingname,"|")
for i=0 to UBound(citypingname)
if instr(user,citypingname(i)) then
response.write"<script>alert('用户注册出错，下面是产生错误的可能原因：\n\n·此用户名可能已被禁止注册，请重新选择');history.go(-1);</script>"
response.end
end if
next

'----------------------------------------以下读取数据库------------------------------------
set rs_dv=Server.CreateObject("Adodb.Recordset")
sql_check="select * from dv_user where username='"&user&"'"
rs_dv.open sql_check,conn,1,3                                             
if not rs_dv.eof then                                           '判断在论坛中是否有该用户注册.
response.write"<SCRIPT language=JavaScript>alert('该户名已经存在，请重新填写用户名。');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
'-------------------------------------------判断结束----------------------------------------------
if dlxf_citysendmail(7)=1 then
dlxf_mailkey=" or dlxf_mail='"&mail&"'"
dlxf_mailcnkey="或邮箱地址"
end if

set rs=Server.CreateObject("Adodb.Recordset")
rs.Open "Select *  from dlxf_yp where dlxf_user='"&user&"'"&dlxf_mailkey&"",conn
if not rs.EOF then
Response.Write "<script>alert('用户注册出错，下面是产生错误的可能原因：\n\n·对不起，该用户名"&dlxf_mailcnkey&"已经存在，请重新选择');history.go(-1);</Script>"
Response.End   
end if
rs.close
set rs=nothing

if mail="" or len(mail)<8  or instr(mail,"@")=0 or instr(mail,".")=0 then
response.write"<script>alert('用户注册出错，下面是产生错误的可能原因：\n\n·请输入正确的企业客户联系邮箱');history.go(-1)</script>"
response.end
end if

if vip=1 then
if tyvip<>1 then
response.write"<script>alert('用户注册出错，下面是产生错误的可能原因：\n\n·您注册的是VIP会员，请先同意VIP会员服务条款');history.go(-1)</script>"
response.end
end if
end if
'---------------------取得开通时间及说明-----------------------------
select case vip
 case 3
   citypkey=citysypkey
   ktdate=cdate(now()+citysydate)
   dlxf_level="试用会员(试用期为"&citysydate&"天)"
   payment=0
 case 1
   citypkey=cityvipypkey
   if cityvipp=1 then
       dlxf_payment="\n\nvip会员的注册费用为 "&cityvippm&" 元/年\n\n请您务必在 "&cityjysj&" 个工作日内交齐所有费用，以便您的工作能正常开展！"
       ktdate=cdate(now()+cityjysj)
	   payment=1
   else
       ktdate=cdate(now()+citysyvipdate+365)
	   payment=0
   end if
   dlxf_level="VIP会员(VIP审核中，赠送使用"&citysyvipdate&"天)"
 case 5
   citypkey=cityypkey
   if cityuserp=1 then
       dlxf_payment="\n\n普通会员的注册费用为 "&cityuserpm&" 元/年\n\n请您务必在 "&cityjysj&" 个工作日内交齐所有费用，以便您的工作能正常开展！"
       ktdate=cdate(now()+cityjysj)
	   payment=1
   else
       ktdate=cdate(now()+365)
	   payment=0
   end if
   dlxf_level="普通会员"
end select
'-----------------------发邮件---------------------------
if dlxf_citysendmail(5)=1 and dlxf_citysendmail(4)<>"0" then

if dlxf_payment<>"" then dlxf_payment=replace(right(dlxf_payment,len(dlxf_payment)-4),"\n\n","，")
dlxf_cityregmail=replace(dlxf_cityregmail,"{$dlxf_name}",cityname)
dlxf_cityregmail=replace(dlxf_cityregmail,"{$dlxf_url}",cityurl)
dlxf_cityregmail=replace(dlxf_cityregmail,"{$dlxf_user}",user)
dlxf_cityregmail=replace(dlxf_cityregmail,"{$dlxf_pass}",pass)
dlxf_cityregmail=replace(dlxf_cityregmail,"{$dlxf_level}",dlxf_level)
dlxf_cityregmail=replace(dlxf_cityregmail,"{$dlxf_payment}",dlxf_payment)

Topic=cityname&"用户注册确认邮件"

select case dlxf_citysendmail(4)
  case "Jmail"
     call Jmail(mail,Topic,dlxf_cityregmail)
  case "Cdonts"
     call Cdonts(mail,Topic,dlxf_cityregmail)
  case "AspEmail"
     call AspEmail(mail,Topic,dlxf_cityregmail)
end select

if sendmail="False" then
response.write"<script>alert('用户注册确认邮件发送出错，下面是产生错误的可能原因：\n\n·您输入的客户联系邮箱有错误或根本不存在，请重新输入\n\n·联系管理员查看邮件发送功能设置');history.go(-1)</script>"
response.end
end if

citypkey=4

end if
'-----------------------判断会员是否开通-------------------
if citypkey="" then citypkey=0
citypkey=int(citypkey)
'-----------------------保存数据---------------------------
set rs=Server.CreateObject("Adodb.Recordset")
sql="select *  from dlxf_yp"
rs.open sql,conn,1,3
rs.addnew
password=md5(pass,32)                       '取32位
rs("dlxf_user")=user
rs("dlxf_pass")=password
rs("dlxf_colxr")=colxr
rs("dlxf_colxrsex")=colxrsex
rs("dlxf_coname")=coname
rs("dlxf_coaddress")=coaddress
rs("dlxf_cotelq")=cotelq
rs("dlxf_cotel")=cotel
rs("dlxf_ypxxone_id")=ypxxone_id
rs("dlxf_ypxxtwo_id")=ypxxtwo_id
rs("dlxf_addone_id")=addone_id
rs("dlxf_addtwo_id")=addtwo_id
rs("dlxf_mail")=mail
rs("dlxf_vip")=vip
rs("dlxf_ktdate")=ktdate
rs("dlxf_co")="co1"
rs("dlxf_key")=citypkey
rs("dlxf_enrol")=0
rs.update
'-----------------------------------写入会员数据库(普通会员注册)-----------------------------------------

set rs_dv1=Server.CreateObject("Adodb.Recordset")	
	sql_dv="select * from dv_user "
    rs_dv1.open sql_dv,conn,1,3 
	rs_dv1.AddNew
		password=md5(pass,16)             '取16位
		rs_dv1("UserName")=user
		rs_dv1("UserPassword")=password
		rs_dv1("UserEmail")="service@126.com"
		rs_dv1("Userclass")="新手上路"
		rs_dv1("TitlePic")="level0.gif"
		rs_dv1("UserQuesion")="1"
		rs_dv1("UserAnswer")="a0b923820dcc509a"           '问题答案也是1
		rs_dv1("TruePassWord")="r84y6115O3q4tQFJ"         '随意设定的
		rs_dv1("UserIM")="||||||||||||||||||"
		rs_dv1("UserSign")=""
		rs_dv1("UserPost")=0
		rs_dv1("userlastip")="127.0.0.1"                   '随意设定ip地址.
		rs_dv1("UserGroupID")=9
		rs_dv1("Lockuser")=0
		rs_dv1("UserSex")=0                                '默认为女性
		rs_dv1("UserGroup")=""
		rs_dv1("JoinDate")=Now()
		rs_dv1("UserFace")="Images/userface/image1.gif"
		rs_dv1("userviews")=0
		rs_dv1("UserWidth")=32
		rs_dv1("Usertoday")="0|0|0|0|0"
		rs_dv1("UserHeight")=32
		rs_dv1("UserLogins")=1
		rs_dv1("LastLogin")=Now()
		rs_dv1("userWealth")=108
		rs_dv1("userEP")=66
		rs_dv1("usercP")=33
		rs_dv1("UserInfo")="||||||||||||||||||||||||||||||||||||||||||"
		rs_dv1("UserSetting")="1|||0|||0"
		rs_dv1("UserPower")=0
		rs_dv1("UserDel")=0
		rs_dv1("UserIsbest")=0
		rs_dv1("UserMoney")=0
		rs_dv1("UserTicket")=0
		rs_dv1("UserFav")="陌生人,我的好友,黑名单"
		rs_dv1("IsChallenge")=0
		rs_dv1("userisava")=0
		rs_dv1("UserHidden")=0
		rs_dv1.Update
		conn.Execute("UpDate Dv_Setup Set Forum_UserNum=Forum_UserNum+1,Forum_lastUser='"&user&"'")
'----------------------------------------------数据库写入结束-------------------------------------------------
rs.close
rs_dv1.close
set rs=nothing
set rs_dv1=nothing

select case payment
   case 0
       gotourl="index.asp"
	   gotoname="现在返回首页？"
   case 1
       gotourl="about.asp?action=buy"
	   gotoname="现在查看付款方式？"
end select

select case citypkey
   case 0
      response.write"<script>if (confirm('操作成功，您可以进行以下操作\n\n·请等待管理员的开通"&dlxf_payment&mailto&"\n\n\n\n"&gotoname&"')){window.location='"&gotourl&"'}else{window.location='index.asp'}</script>"
      response.end
   case 1
      response.write"<script>if (confirm('操作成功，您可以进行以下操作\n\n·您可以登录管理中心对您的企业资料进行修改和完善\n\n·您可以发布免费商贸机会\n\n·您可以发布您的产品\n\n... ..."&dlxf_payment&mailto&"\n\n\n\n"&gotoname&"')){window.location='"&gotourl&"'}else{window.location='index.asp'}</script>"
      response.end
   case 4
      response.write"<script>if (confirm('操作成功，您可以进行以下操作\n\n·系统已经自动发送一封邮件到您的邮箱，请立即查看！\n\n\n\n"&gotoname&"')){window.location='"&gotourl&"'}else{window.location='index.asp'}</script>"
      response.end
end select     
%>