<!--#include file="Inc/syscode_article.asp"-->
<!--#include file="Inc/md5.asp"-->
<!--#include file="Inc/RegBBS.asp"-->
<%
if EnableUserReg<>"Yes" then
	FoundErr=true
	ErrMsg=ErrMsg & "<br><li>对不起，本站暂停新用户注册服务！</li>"
	call WriteErrMsg()
	response.end
end if

const ChannelID=2
Const ShowRunTime="Yes"
SkinID=0

dim RegUserName,Password,PwdConfirm,Question,Answer,Sex,city,Email,Homepage,QQ,MSN
RegUserName=trim(request("UserName"))
Password=trim(request("Password"))
PwdConfirm=trim(request("PwdConfirm"))
Question=trim(request("Question"))
Answer=trim(request("Answer"))
Sex=trim(Request("Sex"))
city=trim(Request("city"))
Email=trim(request("Email"))
Homepage=trim(request("Homepage"))
if Homepage="" or isnull(Homepage) then Homepage=""
QQ=trim(request("QQ"))
MSN=trim(request("MSN"))
dim CheckNum,CheckUrl
randomize
CheckNum = int(7999*rnd+2000) '随机验证码
CheckUrl=Request.ServerVariables("HTTP_REFERER")
CheckUrl=left(CheckUrl,instrrev(CheckUrl,"/")) & "User_RegCheck.asp?Action=Check&UserName=" & RegUserName & "&Password=" & Password & "&CheckNum=" & CheckNum
if RegUserName="" or strLength(RegUserName)>14 or strLength(RegUserName)<4 then
	founderr=true
	errmsg=errmsg & "<br><li>请输入用户名(不能大于14小于4)</li>"
else
  	if Instr(RegUserName,"=")>0 or Instr(RegUserName,"%")>0 or Instr(RegUserName,chr(32))>0 or Instr(RegUserName,"?")>0 or Instr(RegUserName,"&")>0 or Instr(RegUserName,";")>0 or Instr(RegUserName,",")>0 or Instr(RegUserName,"'")>0 or Instr(RegUserName,",")>0 or Instr(RegUserName,chr(34))>0 or Instr(RegUserName,chr(9))>0 or Instr(RegUserName,"　")>0 or Instr(RegUserName,"$")>0 then
		errmsg=errmsg+"<br><li>用户名中含有非法字符</li>"
		founderr=true
	end if
end if
if Password="" or strLength(Password)>12 or strLength(Password)<6 then
	founderr=true
	errmsg=errmsg & "<br><li>请输入密码(不能大于12小于6)</li>"
else
	if Instr(Password,"=")>0 or Instr(Password,"%")>0 or Instr(Password,chr(32))>0 or Instr(Password,"?")>0 or Instr(Password,"&")>0 or Instr(Password,";")>0 or Instr(Password,",")>0 or Instr(Password,"'")>0 or Instr(Password,",")>0 or Instr(Password,chr(34))>0 or Instr(Password,chr(9))>0 or Instr(Password,"　")>0 or Instr(Password,"$")>0 then
		errmsg=errmsg+"<br><li>密码中含有非法字符</li>"
		founderr=true
	end if
end if
if PwdConfirm="" then
	founderr=true
	errmsg=errmsg & "<br><li>请输入确认密码(不能大于12小于6)</li>"
else
	if Password<>PwdConfirm then
		founderr=true
		errmsg=errmsg & "<br><li>密码和确认密码不一致</li>"
	end if
end if
if Question="" then
	founderr=true
	errmsg=errmsg & "<br><li>密码提示问题不能为空</li>"
end if
if Answer="" then
	founderr=true
	errmsg=errmsg & "<br><li>密码答案不能为空</li>"
end if
if Sex="" then
	founderr=true
	errmsg=errmsg & "<br><li>性别不能为空</li>"
else
	sex=cint(sex)
	if Sex<>0 and Sex<>1 then
		Sex=1
	end if
end if
if Email="" then
	founderr=true
	errmsg=errmsg & "<br><li>Email不能为空</li>"
else
	if IsValidEmail(Email)=false then
		errmsg=errmsg & "<br><li>您的Email有错误</li>"
   		founderr=true
	end if
end if
if QQ<>"" then
	if not isnumeric(QQ) or len(cstr(QQ))>10 then
		errmsg=errmsg & "<br><li>QQ号码只能是4-10位数字，您可以选择不输入。</li>"
		founderr=true
	end if
end if
if MSN<>"" then
	if IsValidEmail(MSN)=false then
		errmsg=errmsg & "<br><li>你的MSN有误。</li>"
		founderr=true
	end if
end if

if founderr=false then
	dim sqlReg,rsReg
	sqlReg="select * from " & db_User_Table & " where " & db_User_Name & "='" & RegUserName & "'"
	set rsReg=server.createobject("adodb.recordset")
	rsReg.open sqlReg,Conn_User,1,3
	if not(rsReg.bof and rsReg.eof) then
		founderr=true
		errmsg=errmsg & "<br><li>你注册的用户已经存在！请换一个用户名再试试！</li>"
	else
		rsReg.addnew
		rsReg(db_User_Name)=RegUserName
		rsReg(db_User_Password)=md5(Password)
		rsReg(db_User_Question)=Question
		rsReg(db_User_Answer)=md5(Answer)
		rsReg(db_User_Sex)=Sex
		rsReg(db_User_city)=city
		rsReg(db_User_Email)=Email
		rsReg(db_User_Homepage)=Homepage
		rsReg(db_User_QQ)=QQ
		'rsReg(db_User_Msn)=MSN
		rsReg(db_User_RegDate)=Now()
		rsReg(db_User_ArticleCount)=0
		rsReg(db_User_ArticleChecked)=0
		rsReg(db_User_LoginTimes)=1
		rsReg(db_User_LastLoginTime)=NOW()
		rsReg(db_User_ChargeType)=ChargeType_999
		rsReg(db_User_UserPoint)=UserPoint_999
		rsReg(db_User_BeginDate)=formatdatetime(now(),2)
		rsReg(db_User_Valid_Num)=ValidDays_999
		rsReg(db_User_Valid_Unit)=1
		rsReg("showre")=0
		if EmailCheckReg="Yes" then
			rsReg(db_User_UserLevel)=3000
			call SendRegEmail()
		else
			if AdminCheckReg="Yes" then
				rsReg(db_User_UserLevel)=2000
			else			
				rsReg(db_User_UserLevel)=999
				Response.Cookies("asp163")("UserName")=RegUserName
				Response.Cookies("asp163")("Password") =md5(Password)
				Response.Cookies("asp163")("UserLevel")=999
			end if
		end if		

		if UserTableType="Dvbbs6.0" or UserTableType="Dvbbs6.1" then
			rsReg(db_User_UserClass) = FU_UserClass
			rsReg(db_User_TitlePic) = FU_TitlePic
			rsReg(db_User_UserGroupID) = FU_UserGroupID
			rsReg(db_User_Face) = FU_Face
			rsReg(db_User_FaceWidth) = FU_FaceWidth
			rsReg(db_User_FaceHeight) = FU_FaceHeight
			rsReg(db_User_UserWealth) = FU_UserWealth
			rsReg(db_User_UserEP) = FU_UserEP
			rsReg(db_User_UserCP) = FU_UserCP
			rsReg(db_User_UserGroup) = FU_UserGroup
			rsReg(db_User_Showre) = FU_Showre
		end if 

		rsReg.update
		call UpdateUserNum(RegUserName)
	end if
	rsReg.close
	set rsReg=nothing
end if		
PageTitle="注册成功"
%>
<html>
<head>
<title><%=SiteName%> >>> 用户注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>芜湖播客家园免费视频分享平台 - 芜湖播客家园516show.cn - 新用户注册</title>
<link rel="stylesheet" type="text/css" href="imgs/base2.css" />
<link rel="stylesheet" type="text/css" href="imgs/helpheader.css" />
</head>
<body>
<div id="Head">
	<div class="narrow">
		<a href="http://www.516show.cn/"><img src="imgs/LOGO.png" alt="芜湖播客家园-516show.cn" id="Logo"></a>
		<div id="HelpMenu">
			<div class="desc"><img src="imgs/share2.gif" alt="分享视频,分享快乐"></div>
			<div class="toplink"><a href="help/" target="_blank">帮助中心</a></div>
			<div style="float:clear;height:62px;"></div>
		</div>
	</div>
</div>

<br>
<link href="img0415/css.CSS" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FF6600;
	font-weight: bold;
}
.STYLE2 {color: #993300;
	font-weight: bold;
}
-->
</style>
</head> 


 <table width="950" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
                        <tr>
                          <td height="400" align="center" bgcolor="#FFFFFF" ><table width="100%" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr>
                              <td height="12"></td>
                            </tr>
                          </table>









                            <%
if founderr=false then
	call RegSuccess()
else
	call WriteErrmsg()
end if
%>
          <table width="100%" height="8" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="9"><img src="img0415/space.gif"></td>
                </tr>
            </table></td>
      </tr>
    </table></td>
    <td width="1" bgcolor="#CCCCCC"><img src="img0415/space.gif" width="1" height="1"><img src="img0415/space.gif"></td>
    <td width="5" bgcolor="f2f2f2"></td>
  </tr>
</table>
<% call PopAnnouceWindow(400,300) %>
<%' call ShowAD(0) %>
<%' call ShowAD(4) %>
<%' call ShowAD(5) %>
</body>
</html>
<%
call CloseConn
call CloseConn_User

sub WriteErrMsg()
    response.write "<br><br><table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
    response.write "<tr class='title'><td align='center' height='22'>由于以下的原因不能注册用户！</td></tr>"
    response.write "<tr class='tdbg'><td align='left' height='100'><br>" & errmsg & "<p align='center'>【<a href='javascript:onclick=history.go(-1)'>返 回</a>】<br></p></td></tr>"
	response.write "</table>" 
end sub

sub RegSuccess()
    response.write "<br><br><table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
	response.redirect "/"
	if EmailCheckReg="Yes" then
		response.write "系统已经发送了一封确认信到你注册时填写的信箱中，你必须在收到确认信并通过确认信中链接进行确认后，你才能正式成为本站的注册用户。"
	else
		if AdminCheckReg="Yes" then
			response.write "请等待管理通过你的注册申请后，你就可以正式成为本站的注册用户了。"
		else			
			response.write "欢迎您的加入！！！"
		end if
	end if		
	response.write "<p align='center'>【<a href='javascript:onclick=window.close()'>关 闭</a>】<br></p></td></tr>"
	response.write "</table>" 
end sub

sub SendRegEmail()
	dim MailtoAddress,MailtoName,Subject,MailBody,FromName,MailFrom,Priority
	MailtoAddress=Email
	MailtoName=RegUserName
	Subject="注册确认信"
	MailBody="这是一封注册确认信。你的验证码是：" & CheckNum & vbcrlf & "<br>请点此进行确认：<a href='" & CheckUrl & "'>" & CheckUrl & "</a>"
	FromName=SiteName
	MailFrom=WebmasterEmail
	Priority=3
	ErrMsg=SendMail(MailtoAddress,MailtoName,Subject,MailBody,FromName,MailFrom,Priority)
	if ErrMsg<>"" then FoundErr=True
end sub
%>
<!--#include file="end.asp"-->
</div>
</div>
</body>
</html>