<%
Dim ApplyFlag
ApplyFlag = 0
Dim Form_UserName,Form_Pass,Form_Mail,Form_Address
Dim Form_Sex,Form_Birthday,Form_ApplyTime,Form_ICQ,Form_OICQ,Form_Sessionid,Form_Online
Dim Form_Prevtime,Form_Userphoto,Form_IP,Form_UserLevel,Form_Homepage,Form_Underwrite,Form_PrintUnderwrite
Dim Form_Officer,Form_Points
Dim Form_Password1,Form_Password2,Form_byear,Form_bday,Form_bmonth
Dim Form_FaceHeight,Form_FaceWidth,Form_FaceUrl,Form_ShowFlag,Form_NotSecret
Dim Form_Question,Form_Answer,Form_UserTitle
Dim Form_FaceUrl_Old

Rem =====初始化变量=====
Form_Sex = 0
Form_Online = 0
Form_Officer = 0
Form_UserLevel = 0
'Form_Userphoto = "224"
Form_Points = 0
Form_ApplyTime=GetTimeValue(DEF_Now)
Form_Prevtime=Form_ApplyTime
Form_IP = GBL_IPAddress
Form_Sessionid = session.sessionid
Rem =====初始化结束=====

Function checkFormDate

	Dim DEF_FiltrateUserNameStringArray
	DEF_FiltrateUserNameStringArray = Split(DEF_FiltrateUserNameString,"|")

	If ApplyFlag = 1 Then Form_UserName = Left(Trim(Request("Form_UserName")),20)
	Form_Mail = Trim(Request("Form_Mail"))
	Form_Address = Trim(Request("Form_Address"))
	Form_Sex = Trim(Request("Form_Sex"))
	Form_ICQ = Left(Trim(Request("Form_ICQ")),14)
	Form_OICQ = Left(Trim(Request("Form_OICQ")),14)
	Form_Userphoto = Left(Trim(Request("Form_Userphoto")),14)
	Form_Homepage = Trim(Request("Form_Homepage"))
	Form_Underwrite = Request("Form_Underwrite")
	Form_Password1 = Trim(Request("Form_Password1"))
	Form_Password2 = Trim(Request("Form_Password2"))
	Form_byear = Left(Trim(Request("Form_byear")),14)
	Form_bday = Left(Trim(Request("Form_bday")),14)
	Form_bmonth = Left(Trim(Request("Form_bmonth")),14)
	Form_ShowFlag = Trim(Request("Form_ShowFlag"))
	Form_NotSecret = Trim(Request("Form_NotSecret"))
	Form_Answer = Trim(Request("Form_Answer"))
	Form_Question = Trim(Request("Form_Question"))
	
	If Form_ShowFlag <> "0" and Form_ShowFlag <> "1" Then Form_ShowFlag = 0
	If Form_NotSecret <> "0" and Form_NotSecret <> "1" Then Form_NotSecret = 0

	If DEF_AllDefineFace = 1 Then
		Form_FaceUrl = Trim(Request("Form_FaceUrl"))
		Form_FaceWidth = Left(Trim(Request("Form_FaceWidth")),14)
		Form_FaceHeight = Left(Trim(Request("Form_FaceHeight")),14)
	End If
	If DEF_UserEnableUserTitle = 1 and Form_UserLevel >= DEF_UserUserTitleNeedLevel Then Form_UserTitle = UBB_FiltrateBadWords(LeftTrue(Trim(Request("Form_UserTitle")),14))

	For Loop_N = 0 to Ubound(DEF_FiltrateUserNameStringArray)
		If inStr(LCase(Form_UserTitle),LCase(DEF_FiltrateUserNameStringArray(Loop_N))) and DEF_FiltrateUserNameStringArray(Loop_N) <> "" Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "非法的头衔! <br>" & VbCrLf
			GBL_CHK_Flag = 0
			Exit Function
		End If
	Next

	If GBL_CHK_LastWriteTime < DEF_WriteEventSpace and ApplyFlag = 0 Then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "您在修改资料的过程中提交得太频，请稍候再作提交! <br>" & VbCrLf
		GBL_CHK_Flag = 0
		Exit Function
	End If

	Dim DateFlag

	DateFlag=1

	If GBL_UserID > 0 Then
		If CheckUserIDExist(GBL_UserID) = 0 Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "用户不存在，不能完成修改! <br>" & VbCrLf
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If

	Dim TempURL,Loop_N
	If ApplyFlag = 1 Then
		If Form_UserName="" then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "请输入用户名!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		Else
			If Form_UserName = "游客" or Form_UserName = "隐身会员" Then
				GBL_CHK_TempStr = "不允许使用“" & Form_UserName & "”作为用户名!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If

			If Len(Form_UserName) > 14 Then
				GBL_CHK_TempStr = "用户名太长!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If

			Dim TempChar
			TempURL = Len(Form_UserName)
			For Loop_N = 1 to TempURL
				TempChar = ASC(Mid(Form_UserName,Loop_N,1))
				If TempChar < 0 Then TempChar = TempChar + 65535
				If LMT_UserNameEnableEnglishWords = 0 Then
					If TempChar < 33088 Then
						GBL_CHK_TempStr = "非法的用户名,不允许使用西文字符(a-z,A-Z,数字)!<br>"
						GBL_CHK_Flag = 0
						Exit Function
					End If
				Else
					If TempChar < 45 or (TempChar>45 and TempChar<48) or (TempChar>57 and TempChar<65) or (TempChar>90 and TempChar < 95) or TempChar = 96 or (TempChar > 122 and TempChar < 33088) Then
						GBL_CHK_TempStr = "用户名含有非法字符(请使用数字,字母,下划线)!<br>"
						GBL_CHK_Flag = 0
						Exit Function
					End If
				End If
				
				IF LMT_UserNameEnableChineseChar = 0 Then
					If TempChar > 41214 and TempChar < 43584 Then
						GBL_CHK_TempStr = "非法的用户名,不允许使用中文全角字符!<br>"
						GBL_CHK_Flag = 0
						Exit Function
					End If
				End If
				
				IF LMT_UserNameEnableChineseWords = 0 Then
					If (TempChar >= 33088 and TempChar < 41378) or TempChar > 43508 Then
						GBL_CHK_TempStr = "非法的用户名,不允许使用中文汉字!<br>"
						GBL_CHK_Flag = 0
						Exit Function
					End If
				End If
				
				If TempChar > 65184 Then
					GBL_CHK_TempStr = "非法的用户名,含有非法字符,请确认!<br>"
					GBL_CHK_Flag = 0
					Exit Function
				End If
			Next
			If Left(Form_UserName,1) = "_" or Left(Form_UserName,1) = "-" or Right(Form_UserName,1) = "-" or Right(Form_UserName,1) = "_" Then
				GBL_CHK_TempStr = "用户名不能以连接号_或减号-开始或结束!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If

			If inStr(UBB_FiltrateBadWords(Form_UserName),"*") > 0 Then
				GBL_CHK_TempStr = "用户名含有禁用字，请更换一个用户名!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		
			If inStr(Form_UserName,"'")>0 or inStr(Form_UserName,chr(34))>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含'或" & chr(34) & "符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If

			If inStr(Form_UserName,"`")>0 or inStr(Form_UserName,"~")>0 or inStr(Form_UserName,"&")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含`或&符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,"!")>0 or inStr(Form_UserName,"@")>0 or inStr(Form_UserName,"^")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含!@^符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,"#")>0 or inStr(Form_UserName,"$")>0 or inStr(Form_UserName,"%")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含#$%符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,"*")>0 or inStr(Form_UserName,"(")>0 or inStr(Form_UserName,")")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含*()符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,"+")>0 or inStr(Form_UserName,"=")>0 or inStr(Form_UserName,"|")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含+=|符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName," ")>0 or inStr(Form_UserName,chr(10))>0 or inStr(Form_UserName,chr(13))>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含空格,换行等符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,chr(127))>0 or inStr(Form_UserName,chr(9))>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含制表符等符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,"[")>0 or inStr(Form_UserName,"]")>0 or inStr(Form_UserName,"\")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含[]\等符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,"{")>0 or inStr(Form_UserName,"}")>0 or inStr(Form_UserName,";")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含{};等符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,":")>0 or inStr(Form_UserName,",")>0 or inStr(Form_UserName,".")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含:,.等符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			If inStr(Form_UserName,"<")>0 or inStr(Form_UserName,">")>0 or inStr(Form_UserName,"/")>0 or inStr(Form_UserName,"?")>0 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含<>?/等符号!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			
			For Loop_N = 0 to Ubound(DEF_FiltrateUserNameStringArray)
				If inStr(Lcase(Form_UserName),DEF_FiltrateUserNameStringArray(Loop_N)) and DEF_FiltrateUserNameStringArray(Loop_N) <> "" then
					GBL_CHK_TempStr = GBL_CHK_TempStr & "此用户名已经禁止使用，请使用其它的名字!<br>"
					GBL_CHK_Flag = 0
					Exit Function
				End If
			Next

			Dim FobWords
			FobWords = Array(91,92,304,305,430,431,437,438,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12485,12486,12487,12488,12489,12490,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12532,12533,65339,65340)
			TempURL = Ubound(FobWords,1)
			For Loop_N = 1 to TempURL
				If inStr(Form_UserName,ChrW(FobWords(Loop_N))) > 0 Then
					GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名中的字符<u>" & ChrW(FobWords(Loop_N)) & "</u>属于非法字符!<br>"
					GBL_CHK_Flag = 0
					Exit Function
				End If
			Next
		End If

		If strLength(Form_UserName) > 14 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名太长!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		
		If strLength(Form_UserName) < DEF_ShortestUserName then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名太短，最少要求" & DEF_ShortestUserName & "个字符!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If		

		If CheckUserNameExist(Form_UserName) = 1 Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名已经存在，请用其它用户名! <br>" & VbCrLf
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If Form_Question="" then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "请输入密码提示!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If len(Form_Question)>20 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "密码提示不能超过20个字!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If Form_Answer="" then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "请输入密码提示答案!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If Len(Form_Answer) < 4 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "密码提示答案太短!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If (Len(Form_Answer) = 4 and isNumeric(Form_Answer)) or Replace(Form_Answer,Left(Form_Answer,1),"") = "" Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "密码提示答案太简单!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If LCase(Form_Answer) = LCase(Form_Question) then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "密码提示与提示答案不能相同!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If len(Form_Answer)>20 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "密码提示答案不能超过20个字!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
	Else
		Form_pass = Request.Form("oldpass")
		If Form_pass <> GBL_CHK_Pass and MD5(Form_pass) <> GBL_CHK_Pass and Mid(MD5(Form_pass),9,16) <> GBL_CHK_Pass Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "旧的密码错误，无法完成修改!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If

	If Len(Form_Mail) > 60 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "邮箱地址不能长于60个字符!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If Form_Mail <> "" Then
		If IsValidEmail(Form_Mail) = false Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "邮箱地址填写错误!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If
			

	If Form_Mail = "" then
		GBL_CHK_TempStr = "邮箱地址必须填写!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	If inStr(Form_Mail,"@") = false then
		GBL_CHK_TempStr = "邮箱地址错误!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	If ApplyFlag = 1 Then
		If CheckMailExist(Form_Mail) = 1 Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "邮箱</b><u>" & htmlencode(Form_Mail) & "</u><b>已经有人使用，请换用邮箱地址! <br>" & VbCrLf
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If

	If Form_ICQ <> "" then
		If IsNumeric(Form_ICQ) = 0 or instr(Form_ICQ,",")>0 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "ICQ号码必须是数字!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		else 
			If Form_ICQ>1999999999 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "ICQ号码错误!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If
	End If

	If Form_OICQ <> "" then
		If IsNumeric(Form_OICQ) = 0 or instr(Form_OICQ,",")>0 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "你的OICQ(QQ)号码必须是数字!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		else
			If Form_OICQ>9999999999 then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "你的OICQ(QQ)号码错误!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If
	End If

	If Len(Form_Address) > 150 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "地址太长!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	If Len(Form_Underwrite) > 510 Then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "签名太长!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	ElseIf StrLength(Form_Underwrite) > 255 Then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "签名太长!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	For Loop_N = 0 to Ubound(DEF_FiltrateUserNameStringArray)
		If inStr(Lcase(Form_Underwrite),DEF_FiltrateUserNameStringArray(Loop_N)) and DEF_FiltrateUserNameStringArray(Loop_N) <> "" Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "非法的签名，请仔细确认输入的字符<br>" & VbCrLf
			GBL_CHK_Flag = 0
			Exit Function
		End If
	Next

	If Form_Sex <> "密" and Form_Sex <> "男" and Form_Sex <> "女" then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "性别错误!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	If Form_byear <> "" and Form_byear <> "19" then
		If IsNumeric(Form_byear) = 0 or instr(Form_byear,",")>0 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "出生年错误!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		else
			Form_byear = cCur(Form_byear)
			If (Form_byear>year(date) or Form_byear<1900) then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "出生年错误!1<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If
	else
		DateFlag = 0
	End If

	If Form_bmonth <> "" then
		If IsNumeric(Form_bmonth) = 0 or instr(Form_bmonth,",")>0 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "出生月份错误!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		else
			If Form_bmonth>12 or Form_bmonth<0 then
				Form_bmonth = cCur(Form_bmonth)
				GBL_CHK_TempStr = GBL_CHK_TempStr & "出生月份错误!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If
	else
		DateFlag = 0
	End If

	If Form_bday <> "" then
		If IsNumeric(Form_bday) = 0 or instr(Form_bday,",")>0 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "出生日期错误!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		else
			If Form_bday>31 or Form_bday<0 then
				Form_bday = cCur(Form_bday)
				GBL_CHK_TempStr = GBL_CHK_TempStr & "出生日期错误!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If
	else
		DateFlag = 0
	End If


	If strLength(Form_Homepage) > 250 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "主页地址太长!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	Form_birthday = 0
	If DateFlag = 1 then Form_birthday = GetTimeValue(dateserial(Form_byear,Form_bmonth,Form_bday))

	If isNumeric(Form_Userphoto) = 0 or instr(Form_Userphoto,",")>0 then
		If Form_Sex = "男" then
			Form_Userphoto = 1
		else
			If Form_Sex = "女" then
				Form_Userphoto = 2
			else
				Form_Userphoto = 3
			End If
		End If
	End If
	
	Form_Userphoto = cCur(Form_Userphoto)
	
	If Form_Userphoto < 1 or Form_Userphoto > DEF_faceMaxNum Then
		If Form_Sex = "男" then
			Form_Userphoto = 1
		else
			If Form_Sex = "女" then
				Form_Userphoto = 2
			else
				Form_Userphoto = 3
			End If
		End If
	End If
	
	If DEF_AllDefineFace = 1 Then
		If IsNumeric(Form_FaceWidth) = 0 or instr(Form_FaceWidth,",")>0 or Form_FaceWidth = "" then
			If Form_FaceUrl <> "" Then
				GBL_CHK_TempStr = "自定义头像宽度填写错误!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If		
		If IsNumeric(Form_FaceHeight) = 0 or instr(Form_FaceHeight,",")>0 or Form_FaceHeight = "" then
			If Form_FaceUrl <> "" Then
				GBL_CHK_TempStr = "自定义头像高度填写错误!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If
		
		If Form_FaceUrl <> "" Then
			Form_FaceWidth = cCur(Form_FaceWidth)
			Form_FaceHeight = cCur(Form_FaceHeight)
			If Form_FaceWidth <20 or Form_FaceWidth > DEF_AllFaceMaxWidth or Form_FaceHeight < 20 or Form_FaceHeight > DEF_AllFaceMaxWidth Then
				GBL_CHK_TempStr = "自定义头像高度和宽度大小只能在20-" & DEF_AllFaceMaxWidth & "之间!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If
	End If
		
	If ApplyFlag = 1 Then
		If CheckIsRestSpaceTime = 1 Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "不能连续申请太多的用户，请稍候!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If
	
	If Form_FaceUrl = "" Then
		If IsNumeric(Form_FaceWidth) = 0 or instr(Form_FaceWidth,",")>0 or Form_FaceWidth = "" then
			Form_FaceWidth = 0
		Else
			Form_FaceWidth = cCur(Form_FaceWidth)
		End If
		
		If IsNumeric(Form_FaceHeight) = 0 or instr(Form_FaceHeight,",")>0 or Form_FaceHeight = "" then
			Form_FaceHeight = 0
		Else
			Form_FaceHeight = cCur(Form_FaceHeight)
		End If
	Else
		If Lcase(Left(Replace(Form_FaceUrl,"\","/"),7)) <> "http://" and Lcase(Left(Replace(Form_FaceUrl,"\","/"),6)) <> "ftp://" and Lcase(Left(Replace(Form_FaceUrl,"\","/"),8)) <> "https://" Then
			If Left(Form_FaceUrl,1) <> "/" and Left(Form_FaceUrl,1) <> "\" and Left(Form_FaceUrl,1) <> "." and Lcase(Left(Form_FaceUrl,5)) <> "http:" and Lcase(Left(Form_FaceUrl,4)) <> "ftp:" and Lcase(Left(Form_FaceUrl,6)) <> "https:" Then
				GBL_CHK_TempStr = "自定头像错误，不存在的图片."
				GBL_CHK_Flag = 0
			End If
			Dim Temp
			Temp = Lcase(Right(Form_FaceUrl,4))
			If Temp <> ".gif" and Temp <> ".jpg" and Temp <> "jpeg" and Temp <> ".jpe" and Temp<>".png" Then
				GBL_CHK_TempStr = "自定头像填写错误，必须是jpg,gif,png等图像格式!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
			on error resume next
			If DEF_FSOString <> "" Then
				Dim fs
				Set fs = CreateObject(DEF_FSOString)
				if (Err = 0) Then
					If (not fs.FileExists(Server.Mappath(Form_FaceUrl))) then
						if err Then
							GBL_CHK_TempStr = "自定头像填写错误，请确定是否填写正确!<br>"
							err.clear
						Else
							GBL_CHK_TempStr = "自定头像填写错误，本服务器上没有此文件!<br>"
						End If
						GBL_CHK_Flag = 0
						Set fs = Nothing
						Exit Function
					End If
				Else
					Set fs = Nothing
					If DEF_EnableGFL = 1 Then
						Dim TempW,TempH
						TempW = DEF_AllFaceMaxWidth
						TempH = DEF_AllFaceMaxWidth
						If CheckIsGoodImg(Server.Mappath(Form_FaceUrl),TempW,TempH) = 0 Then
							GBL_CHK_TempStr = "自定头像错误，原因是" & GBL_CHK_TempStr & "!<br>"
							GBL_CHK_Flag = 0
							Exit Function
						Else
							Form_FaceWidth = TempW
							Form_FaceHeight = TempH
						End If
					End If
				End If
			End If
		End If
	End If

	Form_PrintUnderwrite = UBB_Code_UnderWrite(Form_Underwrite)
	If StrLength(Form_PrintUnderwrite) > 1024 Then 
		GBL_CHK_TempStr = GBL_CHK_TempStr & "签名太长!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	If Form_Password1 = "" and Form_Password2 = "" and ApplyFlag = 0 Then
		Form_Password1 = ""
		Form_Password2 = ""
	Else
		If Form_Password1="" then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "请输入密码!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If Len(Form_Password1) > 15 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "密码太长!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		
		If Form_Password2="" then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "请输入验证密码!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If Len(Form_Password2) > 15 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "验证密码太长!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If Form_Password1 <> Form_Password2 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "两次密码输入不相同!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If Form_Password2 = Form_UserName or Len(Form_Password2)<4 Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "密码不能和用户名相同，并且不能小于四位!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		If Len(Form_Password2) = 4 and isNumeric(Form_Password2) Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "密码太简单!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If

	If ApplyFlag = 1 and DEF_EnableAttestNumber > 2 Then
		If CheckRndNumber = 0 Then
			GBL_CHK_TempStr = "<b><font color=ff0000>验证码填写错误!</font></b><br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If

	GBL_CHK_Flag = 1

End Function

Function CheckIsGoodImg(LoadFile,W,H)

	on error resume next

	Dim MyObj
	Set MyObj = Server.CreateObject("GflAx190.GflAx")
	If err Then
		CheckIsGoodImg = 0
		GBL_CHK_TempStr = "论坛未完整安装！"
		Exit Function
	End If
	MyObj.EnableLZW = True
	MyObj.LoadBitmap(LoadFile)
	if err Then
		CheckIsGoodImg = 0
		GBL_CHK_TempStr = "非图像文件！"
		Set MyObj = Nothing
		Exit Function
	End If
	
	Dim Img_Width,Img_Height
	
	Img_Height = MyObj.Height
	Img_Width = MyObj.Width
	
	Set MyObj = Nothing
	
	If Img_Height > H or Img_Height < 20 or Img_Width > W or Img_Width < 20 Then
		CheckIsGoodImg = 0
		GBL_CHK_TempStr = "图像大小不符合要求！"
		Exit Function
	End If
	
	W = Img_Width
	H = Img_Height
	
	CheckIsGoodImg = 1

End Function

Rem 检测某用户名是否存在
Function CheckUserNameExist(UserName)

	Dim Rs
	Set Rs = Con.ExeCute("Select top 2 ID from LeadBBS_User where UserName='" & Replace(UserName,"'","''") & "'")
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		CheckUserNameExist = 0
	Else
		If  cCur(Rs(0)) <> GBL_UserID then
			CheckUserNameExist = 1
		Else
			Rs.MoveNext
			If Not Rs.Eof then
				CheckUserNameExist = 1
			Else
				CheckUserNameExist = 0
			End If
		End If
	End if
	Rs.Close
	Set Rs = Nothing

End Function

Rem 检测某邮箱是否存在
Function CheckMailExist(Mail)

	Dim Rs
	Set Rs = Con.ExeCute("Select top 2 ID from LeadBBS_User where Mail='" & Replace(Mail,"'","''") & "'")
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		CheckMailExist = 0
	Else
		If  cCur(Rs(0)) <> GBL_UserID then
			CheckMailExist = 1
		Else
			Rs.MoveNext
			If Not Rs.Eof then
				CheckMailExist = 1
			Else
				CheckMailExist = 0
			End If
		End If
	End if
	Rs.Close
	Set Rs = Nothing

End Function

Rem 检测某用户名ID是否存在
Function CheckUserIDExist(UserID)

	Dim Rs
	Set Rs = Server.CreateObject("ADODB.RecordSet")
	Set Rs = Con.ExeCute("Select top 1 * from LeadBBS_User where ID=" & UserID)
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		CheckUserIDExist = 0
	Else
		CheckUserIDExist = 1
	End if
	Rs.Close
	Set Rs = Nothing

End Function

Function CheckIsRestSpaceTime

	Dim Rs,ApplyTime,IP,Temp_ID
	Set Rs = Con.ExeCute("Select top 1 ApplyTime,IP,ID from LeadBBS_User order by id desc")
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		CheckIsRestSpaceTime = 0
		Rs.Close
		Set Rs = Nothing
		Exit Function
	Else
		ApplyTime = Rs(0)
		IP = Rs(1)
		Temp_ID = Rs(2)
		Rs.Close
		Set Rs = Nothing
	End if
	
	If DEF_RegNewUserTotalRestTime > 0 Then
		If DateDiff("s", RestoreTime(ApplyTime), DEF_Now) < DEF_RegNewUserTotalRestTime and DateDiff("s", RestoreTime(ApplyTime), DEF_Now) > 0 Then
			CheckIsRestSpaceTime = 1
			GBL_CHK_TempStr = GBL_CHK_TempStr & " 论坛限制" & DEF_RegNewUserTotalRestTime & "秒内只允许注册一名新用户，请稍候再来．<br>" & VbCrLf
			Exit Function
		End If
	End If
		
	If DateDiff("s", RestoreTime(ApplyTime), DEF_Now) < 0 or IP<>Form_IP Then
		CheckIsRestSpaceTime = 0
		Exit Function
	End If
	If DateDiff("s", RestoreTime(ApplyTime), DEF_Now) < DEF_RestSpaceTime Then
		CheckIsRestSpaceTime = 1
		'con.execute("Update LeadBBS_User set Applytime=" & GetTimeValue(DEF_Now) & " where id=" & Temp_ID)
		'GBL_DBNum = GBL_DBNum + 1
	Else
		CheckIsRestSpaceTime = 0
	End If

End Function

Function IsValidEmail(Email)

	Dim names, name, i, c
	IsValidEmail = true
	names = Split(Email, "@")
	If UBound(names) <> 1 Then
		IsValidEmail = false
		Exit Function
	End If

	For Each Name in Names
		If Len(name) <= 0 Then
			IsValidEmail = false
			Exit Function
		End If
		For i = 1 to Len(name)
			c = Lcase(Mid(name, i, 1))
			If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) Then
				IsValidEmail = false
				Exit Function
			End If
		Next
		If Left(name, 1) = "." or Right(name, 1) = "." Then
			IsValidEmail = false
			Exit Function
		End If
	Next
	If InStr(names(1), ".") <= 0 Then
		IsValidEmail = false
		Exit Function
	End If
	i = Len(names(1)) - InStrRev(names(1), ".")
	If i <> 2 and i <> 3 Then
		IsValidEmail = false
		Exit Function
	End If
	If InStr(Email, "..") > 0 Then
		IsValidEmail = false
	End If

End Function

Function CheckRndNumber
     If DEF_EnableAttestNumber = 0 Then
           CheckRndNumber = 1
           Exit Function
     End If

	Dim RndNumber
	RndNumber = Left(Session(DEF_MasterCookies & "RndNum") & "",4)
	If RndNumber = "" or isNumeric(RndNumber) = 0 Then
		'RndNumber = 0
		Randomize
		RndNumber = Fix(Rnd*9999)+1
		Session(DEF_MasterCookies & "RndNum") = RndNumber
	End If
	RndNumber = cCur(RndNumber)

	Dim ForumNumber
	ForumNumber = Left(Request.Form("ForumNumber"),4)
	If isNumeric(ForumNumber) = False Then ForumNumber = 0
	ForumNumber = Fix(cCur(ForumNumber))
	If RndNumber = ForumNumber and RndNumber > 0 Then
		CheckRndNumber = 1
	Else
		CheckRndNumber = 0
	End If
	Randomize
	Session(DEF_MasterCookies & "RndNum") = Fix(Rnd*9999)+1

End Function
%>