<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/email.asp"-->
<!--#include file="inc/chkinput.asp"-->
<!--#include file="inc/md5.asp"-->
<%
Dim DownloadClass_Ads
Dim Rs
Dim SQL
Dim ErrMsg
Dim Sucmsg
Dim FoundErr
Dim loginum
Dim NowStats
Dim HtmlTitle
Dim Style_CSS
Dim HtmlTempStr
Dim TempTopStr
Dim TempFootStr
UserReg
If IsObject(DownloadClass_Ads) Then
	Set DownloadClass_Ads = Nothing
End If
CloseConn
Public Sub UserReg()
	FoundErr = False
	DownsysClass.LoadTemplates ("softinfo")
	Set DownloadClass_Ads = New Adcolumn_Cls
	Set Rs = Server.CreateObject("adodb.recordset")
	NowStats = "会员注册"
	HtmlTitle = "会员注册"
	TempTopStr = DownsysClass.mainhtml(0) & DownsysClass.mainhtml(1) & DownsysClass.mainhtml(2) & DownsysClass.mainhtml(3)
	TempFootStr = DownsysClass.mainhtml(4)
	Style_CSS = Replace(Replace(DownsysClass.Style_CSS, "{$SetupDir}", DownsysClass.SetupDir), "{$PicUrl}", DownsysClass.TempDir)
	HtmlTempStr = TempTopStr
	HtmlTempStr = Replace(HtmlTempStr, "{$NavMenu}", DownsysClass.SortingMenu)
	HtmlTempStr = Replace(HtmlTempStr, "{$Width}", DownsysClass.mainset(0))
	HtmlTempStr = Replace(HtmlTempStr, "{$Style_CSS}", Style_CSS)
	If CInt(DownsysClass.Setting(5)) = 0 Then
		HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(9))
	Else
		HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(10))
	End If
	HtmlTempStr = Replace(HtmlTempStr, "{$NowStats}", NowStats)
	HtmlTempStr = Replace(HtmlTempStr, "{$Title}", HtmlTitle)
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(0)}", DownloadClass_Ads.RunScriptAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(1)}", DownloadClass_Ads.BannerAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(2)}", DownloadClass_Ads.AdsColumn(7, 2))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(3)}", DownloadClass_Ads.AdsColumn(7, 3))
	Response.Write HtmlTempStr
	If CInt(DownsysClass.Setting(5)) = 1 Then
		TempFootStr = Replace(TempFootStr, "{$FootMeun}", DownsysClass.mainset(11))
	Else 
		TempFootStr = Replace(TempFootStr, "{$FootMeun}", DownsysClass.mainset(44))
	End If
	TempFootStr = Replace(TempFootStr, "{$Width}", DownsysClass.mainset(0))
	TempFootStr = Replace(TempFootStr, "{$Adcolumn(4)}", DownloadClass_Ads.ScriptFloatAds(7))
	TempFootStr = Replace(TempFootStr, "{$Adcolumn(5)}", DownloadClass_Ads.ScriptFixedAds(7))
	Response.Write "<TABLE width="""
	Response.Write DownsysClass.mainset(0)
	Response.Write """ class=TableBorder cellSpacing=0 cellPadding=0 align=center border=0>" & vbCrLf
	Response.Write " <TR>" & vbCrLf
	Response.Write " <TD vAlign=top class=Border2>" & vbCrLf
	If CInt(DownsysClass.Setting(31)) = 0 Then
		Response.Write "<script>alert('"& DownsysClass.mainset(35) &"');javascript:history.back(1)</script>"
		Response.End
	End If
	Select Case Request("action")
		Case "save"
			Call regsave
		Case Else
			Call main
	End Select
	If FoundErr = True Then
		Response.Write "<script>alert('" & ErrMsg & "');javascript:history.back(1)</script>"
		Response.End
	End If
	Response.Write "<BR style=""OVERFLOW: hidden; LINE-HEIGHT: 3px"">" & vbCrLf
	Response.Write "</TD></TR></TABLE>" & vbCrLf
	Response.Write TempFootStr
End Sub


Private Sub main()
	Response.Write "<script language=""JavaScript"">" & vbCrLf
	Response.Write "<!--" & vbCrLf
	Response.Write "function CheckForm()" & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.username.value.length == 0)" & vbCrLf
	Response.Write " {" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入用户名."");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.username.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf

	Response.Write Chr(9) & "if (document.myform.username.value.length < 2)" & vbCrLf
	Response.Write " {" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""用户名至少要2位."");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.username.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf

	Response.Write Chr(9) & "if (document.myform.username.value.indexOf(""<"")!=-1 || document.myform.username.value.indexOf("">"")!=-1 || document.myform.username.value.indexOf(""$"")!=-1)" & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""用户名中包含非法字符 (<,>,$) "");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.username.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.username.value.indexOf(""'"")!=-1 || document.myform.username.value.indexOf(""%"")!=-1 || document.myform.username.value.indexOf(""&"")!=-1)" & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""用户名中包含非法字符 (',%,&) "");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.username.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.password1.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入密码！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.password1.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.password2.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入密码确认！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.password2.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.truename.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的真实姓名！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.truename.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.usertel.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的联系电话！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.usertel.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & "if (document.myform.address.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的联系地址！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.address.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf

	Response.Write Chr(9) & "if (document.myform.question.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的密码提示问题！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.question.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf

	Response.Write Chr(9) & "if (document.myform.question.value.length < 6) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""密码提示问题至少6位！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.question.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf

	Response.Write Chr(9) & "if (document.myform.answer.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的密码提示答案！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.answer.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf

	Response.Write Chr(9) & "if (document.myform.answer.value.length < 4) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""密码提示答案至少四位！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.answer.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf

	Response.Write Chr(9) & "if (document.myform.question.value == document.myform.answer.value) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""密码提示答案和密码提示问题不能相同！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.answer.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf

	Response.Write Chr(9) & "if (document.myform.postcode.value.length == 0) " & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入你的邮政编码！"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "document.myform.postcode.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return false;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return true;" & vbCrLf
	Response.Write "}" & vbCrLf
	Response.Write "//-->"
	Response.Write "</script>" & vbCrLf

	Response.Write " <BR style=""OVERFLOW: hidden; LINE-HEIGHT: 5px"">" & vbCrLf
	Response.Write "<TABLE cellSpacing=0 cellPadding=0 width=""100%"" border=0>" & vbCrLf
	Response.Write " <TR>" & vbCrLf
	Response.Write " <TD>" & vbCrLf
	Response.Write " <TABLE cellSpacing=0 cellPadding=0 width=""100%"" border=0>" & vbCrLf
	Response.Write " <TR>" & vbCrLf
	Response.Write " <TD width=150 bgColor=#AEC0EC><STRONG><SPAN class=clear>新用户注册</SPAN></STRONG></TD>" & vbCrLf
	Response.Write " <TD width=1 rowSpan=2><IMG height=1 src="""" width=1></TD>" & vbCrLf
	Response.Write " <TD bgColor=#e6e8ed><IMG height=15 src="""" width=8>　<font color=""#FF0000"">请认真填写以下注册信息！</font></TD></TR>" & vbCrLf
	Response.Write " <TR>" & vbCrLf
	Response.Write " <TD bgColor=#416194><IMG height=1 src="""" width=1></TD>" & vbCrLf
	Response.Write " <TD bgColor=#b7c1ce><IMG height=1 src="""" width=1></TD></TR></TABLE></TD></TR></TABLE>" & vbCrLf
	Response.Write " <BR style=""OVERFLOW: hidden; LINE-HEIGHT: 5px"">" & vbCrLf
	Response.Write "<table width=""96%"" border=""0"" cellspacing=""1"" align=center bgColor=#e6e6e6 cellpadding=""5"">" & vbCrLf
	Response.Write "<form method=""post"" name=myform action=""reg.asp?action=save"" onSubmit=""return CheckForm();"">" & vbCrLf
	Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
	Response.Write " <td width=""30%""><div align=""right"">用户名：</div></td>" & vbCrLf
	Response.Write " <td width=""70%""><input name=""username"" type=""text"" id=""username"" size=""20"">" & vbCrLf
	Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#fefdf5>" & vbCrLf
	Response.Write " <td><div align=""right"">真实姓名：</div></td>" & vbCrLf
	Response.Write " <td><input name=""truename"" type=""text"" id=""truename"" size=""20"">" & vbCrLf
	Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
	Response.Write " <td><div align=""right"">密　码：</div></td>" & vbCrLf
	Response.Write " <td><input name=""password1"" type=""password"" id=""password1"">" & vbCrLf
	Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
	Response.Write " <td><div align=""right"">确认密码：</div></td>" & vbCrLf
	Response.Write " <td><input name=""password2"" type=""password"" id=""password2"">" & vbCrLf
	Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
	Response.Write " <td><div align=""right"">电子邮箱：</div></td>" & vbCrLf
	Response.Write " <td><input name=""usermail"" type=""text"" id=""usermail"">" & vbCrLf
	Response.Write " <font color=""#FF0000"">*</font> 注意：请填写你常用的邮箱</td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
	Response.Write " <td><div align=""right"">密码提示问题：</div></td>" & vbCrLf
	Response.Write " <td><input name=""question"" type=""text"" id=""question"" size=""30"" maxlength=""30"">" & vbCrLf
	Response.Write " 如：<font color=""#FF0000"">你最喜欢的宠物</font></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
	Response.Write " <td><div align=""right"">密码提示答案：</div></td>" & vbCrLf
	Response.Write " <td><input name=""answer"" type=""text"" id=""answer"" size=""30"" maxlength=""30"">" & vbCrLf
	Response.Write " 如：<font color=""#FF0000"">小花狗笨笨</font></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
	Response.Write " <td><div align=""right"">联系电话：</div></td>" & vbCrLf
	Response.Write " <td><input name=""usertel"" type=""text"" id=""usertel"">" & vbCrLf
	Response.Write " <font color=""#FF0000"">*</font> 85188888</td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
	Response.Write " <td><div align=""right"">你的ＱＱ：</div></td>" & vbCrLf
	Response.Write " <td><input name=""oicq"" type=""text"" id=""oicq"" onkeyup=if(isNaN(this.value))this.value='' maxlength=""20""></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
	Response.Write " <td><div align=""right"">邮政编码：</div></td>" & vbCrLf
	Response.Write " <td><input name=""postcode"" type=""text"" id=""postcode"" maxlength=""20"">" & vbCrLf
	Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#f6f6f6> " & vbCrLf
	Response.Write " <td><div align=""right"">联系地址：</div></td>" & vbCrLf
	Response.Write " <td><input name=""address"" type=""text"" id=""address"" size=""45"" maxlength=""50"">" & vbCrLf
	Response.Write " <font color=""#FF0000"">*</font></td>" & vbCrLf
	Response.Write " </tr>" & vbCrLf
	Response.Write " <tr bgColor=#fefdf5> " & vbCrLf
	Response.Write " <td>&nbsp;</td>" & vbCrLf
	Response.Write " <td>&nbsp;&nbsp;" & vbCrLf
	Response.Write " <input name=""Submit"" type=""submit"" class=""button"" value=""　注  册"">" & vbCrLf
	Response.Write " <input name=""Submit2"" type=""reset"" class=""button"" value=""　重　置"">" & vbCrLf
	Response.Write " </td>" & vbCrLf
	Response.Write " </tr></form>" & vbCrLf
	Response.Write "</table>" & vbCrLf
End Sub


Private Sub checkreg()
	If DownsysClass.checkpost = False Then
		ErrMsg = ErrMsg + "您提交的数据不合法，请不要从外部提交注册。\n"
		FoundErr = True
	End If
	If InStr(Request("username"), "=") > 0 Or InStr(Request("username"), "%") > 0 Or InStr(Request("username"), Chr(32)) > 0 Or InStr(Request("username"), "?") > 0 Or InStr(Request("username"), "&") > 0 Or InStr(Request("username"), ";") > 0 Or InStr(Request("username"), ",") > 0 Or InStr(Request("username"), "'") > 0 Or InStr(Request("username"), ",") > 0 Or InStr(Request("username"), Chr(34)) > 0 Or InStr(Request("username"), Chr(9)) > 0 Or InStr(Request("username"), "") > 0 Or InStr(Request("username"), "$") > 0 Then
		ErrMsg = ErrMsg + "<br>" + "用户名中含有非法字符。\n"
		FoundErr = True
	End If
	If InStr(Request("password1"), "=") > 0 Or InStr(Request("password1"), "%") > 0 Or InStr(Request("password1"), "?") > 0 Or InStr(Request("password1"), "&") > 0 Or InStr(Request("password1"), ";") > 0 Or InStr(Request("password1"), ",") > 0 Or InStr(Request("password1"), "'") > 0 Or InStr(Request("password1"), ",") > 0 Or InStr(Request("password1"), "") > 0 Or InStr(Request("password1"), "$") > 0 Then
		ErrMsg = ErrMsg + "<br>" + "用户名中含有非法字符。\n"
		FoundErr = True
	End If
	If Len(Request("username")) > 20 Then
		FoundErr = True
		ErrMsg = ErrMsg + "用户名不能大于20个字符。\n"
	End If
	If Trim(Request.Form("username")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "你没有输入用户名。\n"
	End If
	If Len(Request.Form("truename")) > 15 Then
		FoundErr = True
		ErrMsg = ErrMsg + "真实姓名不能大于15个字符。\n"
	End If
	If Trim(Request.Form("truename")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "你没有输入真实姓名。\n"
	End If
	If Request.Form("password1") = "" And Request.Form("password2") = "" Then
		ErrMsg = ErrMsg + "您的密码不能为空。\n"
		FoundErr = True
	End If
	If Request.Form("password1") <> Request.Form("password2") Then
		ErrMsg = ErrMsg + "您输入的密码和确认密码不一致。\n"
		FoundErr = True
	End If
	If Trim(Request.Form("usermail")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "您的Email不能为空。\n"
	End If
	If IsValidEmail(Trim(Request.Form("usermail"))) = False Then
		ErrMsg = ErrMsg + "您的Email有错误。\n"
		FoundErr = True
	End If
	If Trim(Request.Form("question")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "请输入密码提示问题。\n"
	End If
	If Trim(Request.Form("answer")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "请输入密码提示问题答案。\n"
	End If
	If Trim(Request.Form("usertel")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "请输入你的联系电话。\n"
	End If
	If Not IsValidTel(Trim(Request.Form("usertel"))) Then
		FoundErr = True
		ErrMsg = ErrMsg + "联系电话号码输入错误 \n"
	End If
	If Trim(Request.Form("address")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "请输入你的联系地址。\n"
	End If
	If Not IsNumeric(Request.Form("oicq")) And Request.Form("oicq") <> "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "QQ号码请用数字填写。\n"
	End If
	Rs.Open "Select * from [NC_User] where username = '" & Request("username") & "'", Conn, 1, 1
	If Not Rs.EOF Then
		FoundErr = True
		ErrMsg = ErrMsg + "对不起，该用户名已经存在\n"
		Exit Sub
	End If
	Rs.Close
End Sub


Private Sub regsave()
	Dim getpass
	Dim topic
	Dim mailbody
	Dim username
	Dim useremail
	Call checkreg
	If FoundErr = False Then
		SQL = "select * from NC_User where (userid is null)"
		Rs.Open SQL, Conn, 1, 3
		Rs.addnew
		Rs("username") = Trim(Request.Form("username"))
		Rs("password") = md5(Trim(Request.Form("password1")))
		Rs("usermail") = Trim(Request.Form("usermail"))
		Rs("regtime") = Now
		Rs("postcode") = Trim(Request.Form("postcode"))
		Rs("question") = Trim(Request.Form("question"))
		Rs("answer") = md5(Trim(Request.Form("answer")))
		Rs("oicq") = Trim(Request.Form("oicq"))
		Rs("truename") = Trim(Request.Form("truename"))
		Rs("usertel") = Trim(Request.Form("usertel"))
		Rs("address") = Trim(Request.Form("address"))
		Rs("sex") = 0
		Rs("money") = CCur(DownsysClass.Setting(33))
		Rs("grade") = 1
		Rs("logintime") = Now
		Rs("userip") = DownsysClass.GetUserip
		Rs("loginum") = 0
		Rs("DayDateTime") = Now
		Rs("DayDownNum") = 0
		If CInt(DownsysClass.Setting(32)) = 1 Then
			Rs("isLock") = 1
		Else
			Rs("isLock") = 0
		End If
		Rs.Update
		Rs.Close
		Rs.Open "select userid,username,password,grade,isLock,loginum from NC_user where username = '" & Request.Form("username") & "' ", Conn, 1, 3
		If Rs("isLock") = 0 Then
			Response.Cookies(DownsysClass.Download_sn)("username") = Rs("username")
			Response.Cookies(DownsysClass.Download_sn)("userid") = Rs("userid")
			Response.Cookies(DownsysClass.Download_sn)("password") = Rs("password")
			Response.Cookies(DownsysClass.Download_sn)("grade") = Rs("grade")
			Conn.Execute (" update NC_user set logintime = " & DownsysClass.SqlString & ",loginum = loginum + 1,userip = '" & DownsysClass.GetUserip & "' where userid = " & Rs("userid") & " ")
		End If
		Rs.Close
		Set Rs = Nothing
		If CInt(DownsysClass.Setting(13)) = 1 And CInt(DownsysClass.Setting(14)) = 1 Then
			On Error Resume Next
			'发送注册邮件

			topic = "您在" & DownsysClass.Setting(0) & "的注册资料"
			getpass = DownsysClass.HtmlEncode(Request("password1"))
			username = DownsysClass.HtmlEncode(Request("username"))
			useremail = Request.Form("usermail")
			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 & DownsysClass.HtmlEncode(username) & "，您好：<br><br>"
			mailbody = mailbody & "欢迎您注册成为本站会员，我们将提供给您最好的下载服务！<br>"
			mailbody = mailbody & "下面是" & topic & "：<br>"
			mailbody = mailbody & "注册名：" & DownsysClass.HtmlEncode(username) & "<br>"
			mailbody = mailbody & "密  码：" & getpass & "<br>"
			mailbody = mailbody & "<br><br>" & DownsysClass.Setting(0) & "<BR><BR>"
			mailbody = mailbody & "<center><font color=red>非常感谢您对我们站点的关注和对我们工作的支持！<BR>无论何时," & DownsysClass.Setting(0) & "都将会一如既往的给您提供优质的服务。</font>"
			mailbody = mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
			mailbody = mailbody & "<p align=center>网    址：<a href=http://www.DownsysClass.net target=_blank>http://www.DownsysClass.net</a></p>"
			mailbody = mailbody & "</body>"
			mailbody = mailbody & "</html>"
			Select Case CInt(DownsysClass.Setting(10))
				Case 0
					Sucmsg = Sucmsg + "系统未开启邮件功能，请记住您的注册信息。\n"
				Case 1
					Call Jmail(useremail, topic, mailbody)
				Case 2
					Call Cdonts(useremail, topic, mailbody)
				Case 3
					Call aspemail(useremail, topic, mailbody)
				Case Else
					Sucmsg = Sucmsg + "系统未开启邮件功能，请记住您的注册信息。\n"
			End Select
			If SendMail = "OK" Then
				Sucmsg = Sucmsg + "您的注册信息已经发往您的邮箱，[" & Request("usermail") & "] 请注意查收。\n"
			Else
				Sucmsg = Sucmsg + "由于系统错误，给您发送的注册资料未成功。\n"
			End If
		End If
		If CInt(DownsysClass.Setting(32)) = 1 Then
			Response.Write "<script>alert('提示: " & username & DownsysClass.mainset(36) &"');location.replace('" & DownsysClass.Setting(6) & "')</script>"
		Else
			Response.Write "<script>alert('恭喜你 " & username & " 已注册成功!\n " & Sucmsg & "');location.replace('" & DownsysClass.Setting(6) & "')</script>"
		End If
	End If
End Sub
%>
